-
Notifications
You must be signed in to change notification settings - Fork 0
fix(automation): make @opencode-agent mentions dispatch reliably #1115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
730508a
fix(automation): keep mention dispatch payloads within GitHub's 10-ke…
cursoragent d610b4a
Merge branch 'main' into cursor/mention-payload-ten-keys-82e4
seonghobae 6a4426b
Merge branch 'main' into cursor/mention-payload-ten-keys-82e4
opencode-agent[bot] 1c40b5d
Merge branch 'main' into cursor/mention-payload-ten-keys-82e4
seonghobae ee7761c
test(automation): reproduce dropped pending agent mentions
seonghobae 6b398de
fix(automation): isolate interactive agent mention queue
seonghobae 099faef
docs(automation): record mention routing reliability boundary
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # Review-agent mention routing reliability | ||
|
|
||
| Review date: **2026-08-19** | ||
|
|
||
| ## Incident | ||
|
|
||
| Trusted `@opencode-agent` comments could remain unacknowledged and fail to start the existing OpenCode review path. Two independent control-plane defects produced the same operator-visible symptom before model execution. | ||
|
|
||
| 1. The OpenCode `repository_dispatch.client_payload` exceeded GitHub's ten-property limit, so GitHub rejected the request with HTTP 422 before the trusted wrapper started. | ||
| 2. Interactive `issue_comment` routing and the five-minute organization sweep shared one workflow-level concurrency group. Under the default single-pending contract, a newly queued sweep could replace a pending interactive mention before exact-head resolution, durable claim creation, dispatch, or acknowledgement. | ||
|
|
||
| Neither defect is evidence that the requesting maintainer, model, repository allowlist, or final review result is invalid. | ||
|
|
||
| ## Test-first repair | ||
|
|
||
| The permanent regression contracts were committed before their corresponding production changes. | ||
|
|
||
| - `tests/test_agent_mention_dispatch_payload_limit.py` requires both dispatch hops to stay at or below ten top-level payload properties and requires the router to reject an oversized payload before GitHub does. | ||
| - `tests/test_agent_mention_queue_isolation.py` requires the interactive route and scheduled sweep to use different job-level concurrency groups, with `queue: max` on the interactive route and no cancellation of in-progress interactive work. | ||
|
|
||
| ## Decision | ||
|
|
||
| ### Bounded dispatch envelope | ||
|
|
||
| The router-to-wrapper OpenCode payload carries nine identity and provenance fields. Review-only behavior remains bound into the canonical invocation hash and is reconstructed by the trusted wrapper: | ||
|
|
||
| ```text | ||
| trigger_reviews=true | ||
| review_dispatch_limit=1 | ||
| enable_auto_merge=false | ||
| update_branches=false | ||
| merge_mode=disabled | ||
| ``` | ||
|
|
||
| The wrapper-to-scheduler payload carries exactly ten fields, including the three values that override unsafe scheduler defaults. The wrapper therefore remains review-only and cannot merge or update a branch. | ||
|
|
||
| ### Isolated concurrency queues | ||
|
|
||
| Concurrency is scoped to each job rather than the whole workflow: | ||
|
|
||
| ```yaml | ||
| route-local-agent-mention: | ||
| concurrency: | ||
| group: review-agent-mention-router-local-${{ github.repository }} | ||
| queue: max | ||
|
|
||
| sweep-organization-agent-mentions: | ||
| concurrency: | ||
| group: review-agent-mention-router-sweep-${{ github.repository }} | ||
| cancel-in-progress: false | ||
| ``` | ||
|
|
||
| GitHub documents that `queue: max` permits up to 100 pending jobs or workflow runs in one concurrency group and cannot be combined with `cancel-in-progress: true`. The interactive queue therefore retains bounded pending requests instead of replacing the previous pending request. Scheduled sweeps retain coalescing behavior in a separate group and cannot displace interactive work. | ||
|
|
||
| Concurrency is not the idempotency authority. Duplicate forwarding remains governed by the complete canonical invocation key, exact-key downstream concurrency, and the immutable exact-name Actions artifact ledger. | ||
|
|
||
| ## Preserved boundaries | ||
|
|
||
| - No model provider, reviewer identity, repository allowlist, token name, credential scope, or branch-protection rule changes. | ||
| - `COPILOT_GITHUB_TOKEN` remains unused. | ||
| - Workflow-default permissions remain read-only; existing bounded jobs keep only their required writes. | ||
| - Only trusted non-bot `OWNER`, `MEMBER`, or `COLLABORATOR` comments on open pull requests are eligible. | ||
| - Pull request number, exact head and base SHAs, base branch, source comment, requested agent, and requesting actor remain bound to the invocation key. | ||
| - Mention routing remains unable to approve, merge, update branches, publish, or release. | ||
|
|
||
| ## Operational acceptance | ||
|
|
||
| After protected integration: | ||
|
|
||
| 1. submit a fresh trusted `@opencode-agent` comment on an open pull request; | ||
| 2. require the hidden receipt marker, acknowledgement comment, or durable exact-name artifact for the source comment; | ||
| 3. require the trusted OpenCode wrapper and review-only scheduler dispatch to start for the same repository, pull request, and exact head; | ||
| 4. verify that a scheduled sweep cannot cancel or replace the interactive route; | ||
| 5. distinguish downstream provider or review failure from routing failure rather than treating every missing verdict as the same incident. | ||
|
|
||
| A receipt proves routing and durable claim processing. It is not an approval and never substitutes for exact-head checks or branch protection. | ||
|
|
||
| ## Rollback prohibition | ||
|
|
||
| Do not restore either defective boundary: | ||
|
|
||
| - do not increase the first- or second-hop payload beyond GitHub's limit; | ||
| - do not move local and scheduled work back into one workflow-level concurrency group; | ||
| - do not replace `queue: max` with the default single-pending interactive queue unless another independently reviewed durable queue preserves every eligible request. | ||
|
|
||
| A safe emergency degradation may suspend the scheduled sweep while retaining the isolated interactive route. | ||
|
|
||
| ## References | ||
|
|
||
| GitHub. (n.d.). *Control the concurrency of workflows and jobs*. GitHub Docs. Retrieved August 19, 2026, from https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency | ||
|
|
||
| GitHub. (n.d.). *REST API endpoints for repositories: Create a repository dispatch event*. GitHub Docs. Retrieved August 19, 2026, from https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event | ||
|
|
||
| GitHub. (n.d.). *Store and share data with workflow artifacts*. GitHub Docs. Retrieved August 19, 2026, from https://docs.github.com/en/actions/tutorials/store-and-share-data | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.