COMMENT review: a verdict plus findings, with inline comments
anchored to diff lines:

Structure
The agent function (opencomputer/agents/pr-review/agent.ts) is a
synchronous render, called before every model step. It reads the current
input and selects the instructions and tool set for that step. The write
tool is attached only when the request asks for a live post:
if
statement, and a tool the render does not select does not exist for that
model step.
The tools module (opencomputer/agents/pr-review/tools/github-tools.ts)
declares one HTTP connection and three typed tools that use it.
get_pull_request and get_diff read; post_review writes one COMMENT
review and falls back to summary-only when GitHub rejects an inline anchor:
github.fetch("/repos/…"), and the platform validates origin, method, and
path prefix before attaching the token at its outbound edge. The token never
enters the agent runtime, so a prompt-injected model step cannot read or
exfiltrate it. See Secrets and runtime variables.
The managed runtime provides the rest: the durable session and turn
queue, the model/tool loop that calls the render before each step, and
deployments. npm run deploy -- --watch builds an immutable
content-addressed deployment on every save and advances the Development
alias; sessions stay pinned to the deployment they started on.
Run it
OpenComputer Pull Request Reviewer
Clone the complete agent, tools, and tests from GitHub.
Configure the GitHub token
Create a fine-grained personal access token scoped to the repositories the agent should review, with Pull requests: read and write and Contents: read. Store it as a managed secret:Review a pull request
COMMENT review — the verdict and findings as the
body, plus inline comments for findings it can anchor to new-side diff
lines. It never approves or requests changes.
Trigger from another system
Idempotency-Key returns the original session instead of starting a second
review. See Agent webhooks.
GitHub webhooks sign with an HMAC header and cannot supply the bearer
token, so reviewing PRs on open requires a relay — for example a GitHub
Actions pull_request job holding the webhook URL and token as repository
secrets.
Safety properties
- The GitHub token is write-only, attached outside the agent runtime, and constrained to declared origin, method, and path prefix.
- The agent’s toolset is exactly what the render selects; posting requires an explicit request, and dry run is the default.
- Reviews are
COMMENTevents only; the agent cannot approve, request changes, merge, or push. - Diffs above 150,000 characters are truncated, and the tool result reports the truncation and full size.