mts1b-githubbot
Claude-powered GitHub bot: AI issue triage + auto-fix PR + AI code review across all MTS1B repos.
Repo: github.com/MTS1B/mts1b-githubbot Layer: 7 Wave: 3 (months 8-12) Depends on: foundation, platform, llm Audience: every MTS1B contributor + maintainers
What it is
A GitHub App that watches every repo in the MTS1B org and:
- Triages new issues — labels, suggests duplicates, asks clarifying questions
- Auto-fixes simple bugs — opens a PR with the fix for review
- Reviews PRs — posts AI code review as a comment
- Suggests CI fixes — when CI fails, comments with the diff that would fix it
The bot output is advisory, not authoritative. A human maintainer always merges.
Architecture
GitHub event ──webhook──▶ mts1b-githubbot
│
├──▶ mts1b-llm (persona: "code_reviewer")
├──▶ mts1b-llm (persona: "bug_fixer")
└──▶ GitHub API (post comment / open PR)
Personas
Three LLM personas in mts1b-llm, used by this bot:
| Persona | Role |
|---|---|
triager | Read new issue → assign labels, link duplicates, ask for repro steps |
code_reviewer | Review PR diffs → flag bugs, style violations, design smells |
bug_fixer | Read issue + repo → propose a code change → open PR |
Triage example
User opens issue:
Title: "HRP broken on small universes" Body: "Got AssertionError when running hrp_weights on 3 assets"
Bot responds:
👋 Hi @user, thanks for reporting!
Labels assigned: bug, mts1b-quantkit, allocators
Possible duplicate: #142 "HRP linkage fails for n < 4"
To help diagnose, could you share:
1. Your input array shape (`returns.shape`)?
2. The full traceback?
3. Reproduction command?
The maintainer typically responds within 24h. If urgent, ping #help in
our Discord: https://community.mts1b.investmentparadisellc.com
Code review example
PR opens. Bot comments:
🤖 AI Code Review
LGTM overall! 3 suggestions:
1. **Line 47: missing type annotation**
```python
def calculate_returns(prices): # → prices: pd.Series
return prices.pct_change().dropna()
-
Line 89: docstring mismatch Docstring says returns
dictbut function returnsHRPResultnamed tuple. -
Test gap: edge case missing
test_hrp.pycovers n >= 5 but not n < 3. Suggest adding:def test_hrp_too_few_assets():with pytest.raises(ValueError, match="need >= 4 assets"):hrp_weights(small_returns_df)
This review is advisory. A human maintainer will make the final call.
## Auto-fix PR example
For high-confidence simple bugs (typos, missing imports, deterministic test failures):
🤖 Auto-fix PR
I detected this looks like a simple typo bug. Opened #243 with the proposed fix.
A human maintainer will review before merging. If the fix is wrong, just close the PR and the bot will learn from the feedback.
The auto-fix is **gated** — only opens PRs for changes < 50 LoC, with passing local tests, and explicit confidence > 0.85 from the LLM.
## Module layout
mts1b_githubbot/ ├── app/ │ ├── webhook.py # FastAPI POST /github/webhook │ ├── signature.py # GitHub HMAC verification │ └── handlers/ │ ├── issue_opened.py │ ├── pull_request.py │ ├── check_suite.py │ └── ... ├── triager/ │ ├── label_classifier.py │ ├── dupe_finder.py │ └── clarify_questioner.py ├── reviewer/ │ ├── diff_analyzer.py │ └── style_checker.py ├── bug_fixer/ │ ├── repro_runner.py # tries to reproduce + fix locally │ └── pr_builder.py └── governor/ └── budget.py # daily LLM budget cap
## Budget controls
LLM calls cost money. Per-org daily budget enforced via `mts1b-llm` governor:
```yaml title="mts1b-githubbot/config.yaml"
budget:
daily_usd: 5.0
per_repo_daily_cap: 1.0
expensive_actions:
bug_fixer: 0.20 # max $0.20 per attempt
code_reviewer: 0.05
triager: 0.01
When budget exhausts: bot continues to triage cheaply but stops opening fix PRs until next day.
Safety
| Safety | Mechanism |
|---|---|
| Bot can't push to main | Always opens PR, never direct commit |
| Bot can't merge | No contents: write on protected branches |
| Bot can't change CI | .github/workflows/ is in CODEOWNERS protected paths |
| Bot can't access secrets | GitHub App, read-only on most scopes |
| Bot output flagged | Every comment starts with 🤖 AI |
Installation
# Initial install (one time, by org owner)
mts1b-githubbot install \
--org MTS1B \
--app-id <github_app_id> \
--private-key-path /etc/mts1b/githubbot.pem
# Verify
gh app installation list --org MTS1B
# mts1b-githubbot: installed, 29 repos
Self-hosting
The bot runs as a regular MTS1B service:
# mts1b.config
optional:
githubbot: true
After mts1b-deploy install, the webhook endpoint is at:
https://mts1b.investmentparadisellc.com/githubbot/webhook
Set this in the GitHub App config.
Build + test
pip install -e ".[dev]"
pytest -m unit
# Live test against a sandbox repo
GITHUB_APP_PRIVATE_KEY=... pytest -m live
Roadmap
| Version | Items |
|---|---|
| 0.1 (Wave 3) | Triager + code reviewer + simple auto-fix |
| 0.2 (Wave 3) | Complex multi-file refactors with maintainer chat |
| 0.3 | Documentation auto-updater (when API changes) |
| 1.0 (LTS) | Stable persona API |
See also
mts1b-llm— LLM providermts1b-discordbot— sibling community bot- Concept: Foundation types — defines bot's view of repos