Triage newly opened GitHub issues with an assistant

Python · LLM apps · intermediate · modification

Adds an issue-triage assistant to our GitHub app. When an issue is opened, the agent reads it, can browse the repository's files to find the code it is about, and is instructed to finish with one triage comment: the likely area, the files worth reading and what information is missing. It runs unattended, so the limits live in the tool layer rather than the prompt: arguments are checked against the tool schemas before anything runs, the agent is kept to the issue's repository, comments go only on the issue that started the run and at most once, and the issue text reaches the model only as the user message. GitHub failures come back to the model as short errors, with the detail in the log. Tried it on a sandbox repository with a handful of real bug reports: each got one comment pointing at the right module.

Python 3.12 service behind the org's GitHub App. `app/webhooks/receiver.py` (existing, unchanged) verifies `X-Hub-Signature-256`, answers GitHub 202 and enqueues the delivery; the job worker calls `handlers.dispatch` once per delivery, never retries, and logs any exception a handler raises. The payload is GitHub's `issues` webhook payload: `issue.number` is a positive integer, `issue.title` a non-empty string, `issue.body` a string of up to 65,536 characters or `null`. The app is installed on all of the org's repositories, public and private, with contents read and issues write, and the service calls GitHub with that installation token; the org's public repositories accept issues from any GitHub account. `app/github_client.py` (existing, unchanged) wraps the REST API with that token: `list_directory(owner, repo, path)` returns a list of `{"name", "type"}` dicts (at most 1,000), `get_file(owner, repo, path)` returns the file's text (files up to 1 MB, decoded as UTF-8), `post_comment(owner, repo, issue_number, body)` returns nothing; each URL-encodes its arguments and raises `github_client.GitHubError` (attribute `status`: the HTTP status, or 0 when GitHub was unreachable) on any failure, including a missing path or one of the wrong kind. Owner and repository names are ASCII (GitHub's rule). `app/agents/release_notes.py` is the existing release-notes agent.

Requirements

Files touched

Review this PR

Python practice