Skip to content

fix(opencode): reject stale review bindings - #2118

Closed
dnlrsls wants to merge 1 commit into
Gentleman-Programming:mainfrom
dnlrsls:fix/2047-stale-review-bindings
Closed

fix(opencode): reject stale review bindings#2118
dnlrsls wants to merge 1 commit into
Gentleman-Programming:mainfrom
dnlrsls:fix/2047-stale-review-bindings

Conversation

@dnlrsls

@dnlrsls dnlrsls commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Linked Issue

Closes #2047

PR Type

  • type:bug - Bug fix (non-breaking change that fixes an issue)

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

File / Area What Changed
internal/assets/opencode/plugins/review-result-artifacts.ts Classifies stale v1 artifact subjects and emits fail-closed recovery guidance.
internal/assets/review_plugin_recovery_test.go Covers stale-v1 rejection before launch and fresh-v2 preflight success.

Test Plan

  • go test ./internal/assets -count=1
  • go vet ./internal/assets
  • git diff --check
  • External Windows-native runtime proof against byte-identical managed plugin source: stale v1 is rejected before reviewer launch with the negotiated-refresh recovery; fresh v2 completes preflight.
  • go test ./... was not run for this focused change.
  • E2E tests were not run.
  • Benchmark validation was not run.
  • Manually verified the stale-v1 and fresh-v2 runtime scenarios.

Receipt-driven development was disabled and unmanaged for this work; no review-lifecycle receipt is claimed.

Automated Checks

Check Status Description
Check PR Cognitive Load Pending 49 changed lines (48 additions, 1 deletion).
Check Issue Reference Pending Closes #2047.
Check Issue Has status:approved Pending Issue #2047 has status:approved.
Check PR Has type:* Label Pending maintainer action type:bug must be applied by a maintainer.

Contributor Checklist

  • PR is linked to issue fix(opencode): invalidate stale review bindings after updates #2047 with status:approved.
  • PR stays within the 400 changed-line budget.
  • The appropriate type:* label is applied to this PR; pending maintainer action.
  • Focused unit test and vet commands above passed.
  • Full unit suite and E2E tests were not run.
  • Benchmark validation was not run.
  • Commits follow Conventional Commits format and contain no Co-Authored-By trailer.

Pending maintainer actions

  • Apply the type:bug label to this PR.

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

  • Bug Fixes
    • Improved handling of outdated artifact bindings during review setup.
    • Added clearer guidance to refresh stale bindings instead of retrying with an incompatible option.
    • Improved provider error messages for stale binding issues.
    • Current artifact bindings continue through review setup as expected.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Stale artifact binding recovery

Layer / File(s) Summary
Preflight classification and recovery
internal/assets/opencode/plugins/review-result-artifacts.ts, internal/assets/review_plugin_recovery_test.go
The plugin classifies stale v1 bindings, prioritizes refresh guidance, and reports a specific v1/v2 incompatibility. Tests verify stale bindings are rejected before reviewer launch and fresh v2 bindings inject the review binding successfully.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Gentleman-Programming/gentle-ai issue 2013 — Both changes address artifact-subject v1 handling, but that issue concerns valid v1 acceptance rather than stale bindings.
  • Gentleman-Programming/gentle-ai issue 2084 — Both changes address OpenCode artifact-subject binding failures during review preflight.

Possibly related PRs

Suggested labels: type:bug

Suggested reviewers: alan-thegentleman, matam15

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes rejecting stale OpenCode review bindings.
Linked Issues check ✅ Passed The changes classify stale v1 bindings, provide refresh-only guidance, reject before launch, and verify fresh v2 success for issue [#2047].
Out of Scope Changes check ✅ Passed The modified plugin logic and regression tests directly support stale-binding invalidation and recovery requirements for issue [#2047].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dnlrsls dnlrsls added the type:bug Bug fix label Jul 31, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between fdecaf5 and 393551e.

📒 Files selected for processing (2)
  • internal/assets/opencode/plugins/review-result-artifacts.ts
  • internal/assets/review_plugin_recovery_test.go

Comment on lines +175 to +187
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)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.

@dnlrsls

dnlrsls commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by the maintainer-owned design in 86ea91b and 47a03c1. Current main rejects every bound OpenCode reviewer task with the exact unsupported-capability result before native preflight or reviewer launch, so this PR's fresh-v2 success path is intentionally no longer supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(opencode): invalidate stale review bindings after updates

1 participant