Skip to content

feat(mcp): add octobroker_commit_status_set broker-owned tool#52

Merged
chaodu-agent merged 1 commit into
mainfrom
feat/commit-status-tool
Jul 22, 2026
Merged

feat(mcp): add octobroker_commit_status_set broker-owned tool#52
chaodu-agent merged 1 commit into
mainfrom
feat/commit-status-tool

Conversation

@chaodu-agent

Copy link
Copy Markdown
Contributor

Summary

Review agents need to publish a PR-review verdict as a commit status check (e.g. context: "OpenAB PR Review", state: failure), but the upstream GitHub MCP server offers no commit-status mutation at all — only the read-only get_status. This surfaced in live operation: a review bot correctly refused to fabricate an endpoint and reported the capability gap.

This PR adds a second octobroker-owned local tool, octobroker_commit_status_set, following the octobroker_review_minimize_comment pattern from #45 (issue #44).

Changes

  • LOCAL_TOOLS registry — the early write gate, local dispatch, tools/list injection, and x-mcp-tools upstream filtering are generalized over all broker-owned tools. Each tool still requires its own explicit per-agent allowlist entry to be advertised or callable.
  • handle_commit_status_set — executes POST /repos/{owner}/{repo}/statuses/{sha} locally through the scoped GitHub App credential. Never forwarded upstream.
  • Strict validationowner/repo/sha become URL path segments: charset-checked and full 40/64-hex SHA enforced, so arguments cannot escape the policy-checked repository path. state must be one of error|failure|pending|success; context non-empty; description ≤ 140 chars; target_url must be http(s).
  • Fail closed — only HTTP 201 with an echoed state counts as success; anything else returns a tool error. Phase 1 (no-agent) mode and writes-disabled agents are denied before credential resolution.
  • Same guardrails as upstream writes — repository allowlist, write gate, per-agent in-flight cap, and fail-closed JSONL audit (pre-flight + result) all apply unchanged.
  • README — tool documentation + Commit statuses: write row in the App permission table.

Tests

8 new/updated tests; full suite 132 passed, 0 failed, clippy clean:

  • success path posts the exact /repos/{owner}/{repo}/statuses/{sha} path and payload (mock REST server)
  • bad arguments (state enum, short SHA, path-escape owner/repo/sha, blank context, javascript: target_url, >140-char description) rejected before any network call
  • GitHub 422 and non-201 responses fail closed
  • Phase 1 mode denies the tool (403, nothing reaches upstream)
  • tools/list injection requires each local tool's own allowlist entry; x-mcp-tools filter strips all local tools

App permission

Requires Commit statuses: write on the GitHub App installation(s) — grant + per-installation approval needed before agents can use it.

The upstream GitHub MCP server exposes no commit-status mutation (only
the read-only get_status), so review agents cannot publish a verdict as
a status check. Add a second octobroker-owned local tool that creates a
commit status via POST /repos/{owner}/{repo}/statuses/{sha} through the
scoped GitHub App credential.

- Introduce a LOCAL_TOOLS registry; generalize the write gate, local
  dispatch, tools/list injection, and x-mcp-tools filtering to cover
  every broker-owned tool (each still requires its own explicit
  allowlist entry)
- Strict argument validation: owner/repo/sha become URL path segments
  (charset + full 40/64-hex SHA enforced), state enum, non-empty
  context, description <= 140 chars, http(s) target_url
- Fail closed: only HTTP 201 with an echoed state counts as success
- Same repository policy, write gate, in-flight cap, and fail-closed
  audit as upstream write tools; Phase 1 / writes-disabled agents are
  denied before credential resolution
- Requires 'Commit statuses: write' on the GitHub App (README updated)
@chaodu-agent
chaodu-agent merged commit dc181dc into main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant