fix(opencode): reject stale review bindings - #2118
Conversation
📝 WalkthroughWalkthroughThe OpenCode review plugin now detects stale artifact-subject v1 bindings during preflight, returns typed recovery guidance, and reports the v1/v2 incompatibility. Tests verify stale bindings fail before reviewer launch and fresh v2 bindings succeed. ChangesStale artifact binding recovery
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/assets/review_plugin_recovery_test.go`:
- Around line 175-187: Extend the stale preflight test around the existing stale
result assertions to inspect the native mock’s invocation log and verify the
reviewer was not invoked. Keep the current error-text checks, but add an
assertion that stale rejection occurs before any reviewer launch using the
mock’s existing invocation-tracking symbol.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: ce7b4e78-d188-4d87-96ff-4798d3d3bf71
📒 Files selected for processing (2)
internal/assets/opencode/plugins/review-result-artifacts.tsinternal/assets/review_plugin_recovery_test.go
| for _, want := range []string{ | ||
| "repository_context_preflight_failed: stale artifact-subject v1 binding", | ||
| "current v2 review contract", | ||
| "The reviewer was not launched", | ||
| "Refresh the exact negotiated STATUS/next_transition", | ||
| } { | ||
| if !strings.Contains(stale, want) { | ||
| t.Fatalf("stale v1 binding result is missing %q: %s", want, stale) | ||
| } | ||
| } | ||
| if strings.Contains(stale, "retry the same opaque binding") { | ||
| t.Fatalf("stale v1 binding still advises a deterministically incompatible retry: %s", stale) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Assert that stale preflight does not invoke the reviewer.
The stale case checks only the returned error text. The plugin adds The reviewer was not launched while formatting a preflight error, so a regression that launches the reviewer and returns the same text could pass. Assert the native mock’s invocation log to prove that stale rejection occurs before reviewer launch.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/assets/review_plugin_recovery_test.go` around lines 175 - 187,
Extend the stale preflight test around the existing stale result assertions to
inspect the native mock’s invocation log and verify the reviewer was not
invoked. Keep the current error-text checks, but add an assertion that stale
rejection occurs before any reviewer launch using the mock’s existing
invocation-tracking symbol.
Linked Issue
Closes #2047
PR Type
Summary
Rejects provider-owned artifact-subject v1 bindings before reviewer launch because they are deterministically incompatible with the current v2 review contract. The recovery directs users to refresh the exact negotiated STATUS/next_transition and does not suggest retrying the stale opaque binding.
Changes
Test Plan
Receipt-driven development was disabled and unmanaged for this work; no review-lifecycle receipt is claimed.
Automated Checks
Contributor Checklist
Pending maintainer actions
Notes for Reviewers
The fail-closed path is limited to artifact-subject schema v1. It rejects that stale contract before reviewer launch, while a fresh v2 binding continues through preflight.
Summary by CodeRabbit