fix(opencode): self-retire superseded verdict polls - #1649
Conversation
📝 WalkthroughWalkthroughOpenCode verdict polling이 각 반복마다 live PR 상태를 다시 확인합니다. head가 변경되면 polling을 실패로 종료하고, PR이 닫히거나 draft가 되면 성공적으로 종료합니다. 회귀 테스트와 운영 문서가 이 계약을 검증하고 기록합니다. ChangesOpenCode 폴링 자체 종료
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to The PR makes stale required-review polls re-check PR state and retire when superseded, reducing runner-capacity deadlocks without weakening verdict checks. Before merging, correct the doctoring document’s September 2, 2026 date or clearly label it as a planned example. Sequence Diagram(s)sequenceDiagram
participant Workflow as OpenCode workflow
participant GitHub as GitHub PR API
participant Reviews as Reviews API
Workflow->>GitHub: 각 polling 반복마다 PR head와 상태 조회
GitHub-->>Workflow: live head, draft, state 반환
alt head 변경
Workflow-->>Workflow: superseded poll 실패 종료
else PR closed 또는 draft
Workflow-->>Workflow: polling 성공 종료
else 상태 유효
Workflow->>Reviews: verdict 조회
Reviews-->>Workflow: 리뷰 상태 반환
end
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. (2 skipped: 2 unsupported.) ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@codex address the current unresolved rate-budget feedback on exact head |
|
@codex fix the production regression now pinned RED by commit |
| break | ||
| fi | ||
| sleep 30 | ||
| sleep "$poll_interval_seconds" |
There was a problem hiding this comment.
🔍 Stale workflow contract fails tests
The existing workflow contract still requires sleep 30 and the old Reviews URL (workflow contract). Both assertions now fail.
Was this helpful? React with 👍 or 👎 to provide feedback.
|
|
Summary
Testing
|
Summary
Testing
|
Root cause
A
Required OpenCode Reviewrun could validate its PR head once, enter an unbounded Reviews API wait, and keep occupying a runner after that PR advanced. Exact-head concurrency correctly prevents an older event from cancelling a newer authoritative head, while the separate cleanup job needs another runner; under Actions saturation this creates a capacity deadlock. The first self-retirement repair then exposed a second control-plane risk: re-fetching both live PR state and Reviews every 30 seconds roughly doubled repository REST pressure.Test-first repair chain
ebc9f46e482fe777e02f640eb537321a38910a99added the RED stale-poll self-retirement contract before production changed.41a0bfffc7d85e5c63abad2c1acaf07348a8bb22added the RED REST-rate budget contract after an external review identified the 30-second double-read pressure.b1378cc1e73754186a079a054a10ac9310b5ac8emade that contract GREEN: the poll cadence is 60 seconds, every wait uses the same interval, and Reviews usesper_page=100with pagination. Four healthy polls therefore issue about 480 baseline REST calls/hour before pagination rather than ~960.3455a3080abbc5ac975c631a99612a1ce1bfec0;tests/test_opencode_oidc_audience_contract.pynow prevents recurrence.1354a1ee0fae1c696be8993442e0e5ffc19fedbbupdates the doctoring/rollback record with the final cadence, retry, pagination, and observability contract.Exact scope
Current protected base:
main@546ebae907e997334195dabf0eac13cf6b648b42.Current exact head:
1354a1ee0fae1c696be8993442e0e5ffc19fedbb.Changed files:
.github/workflows/opencode-review.ymltests/test_opencode_poll_self_retirement.pytests/test_opencode_poll_rate_budget.pytests/test_opencode_oidc_audience_contract.pydocs/doctoring/opencode-stale-poll-self-retirement.mdNo review threshold, actor identity, branch protection, merge authority, provider route, or verdict semantics are weakened. The 30-second value is a per-request transport bound, not a semantic-review deadline; semantic review may continue indefinitely while the PR remains current and healthy.
Review-evaluation trace
Concrete external findings were turned into durable executable regressions rather than benchmark claims: Devin exposed structural-only poll tests; another reviewer exposed transient REST failure handling; CodeRabbit surfaced time-zone ambiguity in incident evidence; and the later external rate-budget finding demonstrated the double-read pressure. Current threads for those findings are resolved only after the corresponding source/test evidence became current.
Evidence boundary
Hosted exact-head checks/reviews remain authoritative. At the current head, GitHub Actions checks are materialized but still queued; queued, predecessor, skipped, or locally reasoned evidence is not promoted to a passing required check. After protected integration, affected leaf repositories must reacquire fresh exact-head OpenCode/Noema/Strix evidence and predecessor-poll release behavior must be re-observed.