fix(opencode): delegate RGR approval to implementer sessions #250

Merged
jwilger merged 1 commit from fix/rgr-subagent-approval-handoff into main 2026-05-18 11:27:40 -07:00
Owner

Why:

  • RGR implementation subagents could not edit production Rust after the orchestrating session approved RED because approval state was session-local.
  • Retrying RED approval inside the subagent failed and encouraged the wrong recovery path.
  • Delegated edit privileges need to stay scoped so unrelated sessions cannot consume them.

What:

  • Add scoped delegated implementation-edit leases for rgr-diagnostic-implementer task handoffs.
  • Consume the parent cycle's one-edit budget when the delegated subagent uses its lease.
  • Reject unscoped lease consumption when a delegation lacks an explicit subagent session identity.
  • Clarify the diagnostic implementer should return approval blockers to the orchestrator instead of recreating RED locally.

Validation:

  • node --test tests/opencode-rgr-task-gate.test.mjs
  • node --test .opencode/plugins/*.test.ts tests/opencode-rgr-task-gate.test.mjs
Why: - RGR implementation subagents could not edit production Rust after the orchestrating session approved RED because approval state was session-local. - Retrying RED approval inside the subagent failed and encouraged the wrong recovery path. - Delegated edit privileges need to stay scoped so unrelated sessions cannot consume them. What: - Add scoped delegated implementation-edit leases for `rgr-diagnostic-implementer` task handoffs. - Consume the parent cycle's one-edit budget when the delegated subagent uses its lease. - Reject unscoped lease consumption when a delegation lacks an explicit subagent session identity. - Clarify the diagnostic implementer should return approval blockers to the orchestrator instead of recreating RED locally. Validation: - `node --test tests/opencode-rgr-task-gate.test.mjs` - `node --test .opencode/plugins/*.test.ts tests/opencode-rgr-task-gate.test.mjs`
fix(opencode): delegate RGR approval to implementer sessions
All checks were successful
CI / Dependency policy (pull_request) Successful in 12s
CI / Test (pull_request) Successful in 54s
CI / Request auto_review semantic review (pull_request) Successful in 1s
CI / Format check (pull_request) Successful in 6s
CI / Clippy (pull_request) Successful in 41s
CI / Build (pull_request) Successful in 33s
CI / Build PR artifacts (no token) (pull_request) Successful in 2s
auto_review auto_review: no findings
d2351dbe36
Why:
- RGR implementation subagents could not edit after the parent session approved RED because approval state was session-local.
- Unscoped delegation must not let unrelated sessions consume implementation edit privileges.

What:
- Add scoped delegated implementation edit leases that carry the parent RED approval to one subagent session.
- Consume the parent edit budget when the delegated lease is used and reject unscoped lease consumption.
- Clarify the diagnostic implementer must return approval blockers to the orchestrator instead of recreating RED locally.

Validation:
- node --test tests/opencode-rgr-task-gate.test.mjs
- node --test .opencode/plugins/*.test.ts tests/opencode-rgr-task-gate.test.mjs
auto-review left a comment

The PR introduces scoped delegated implementation-edit leases to manage edit permissions for subagents in the RGR process. It ensures that only authorized sessions can consume these leases, preventing unauthorized edits. The changes include new functions for handling leases and tests to validate the correct behavior.

Walkthrough

  • .opencode/agents/rgr-diagnostic-implementer.md: Added clarification on the roles of orchestrating agents and subagents, preventing subagents from recreating RGR cycles.
  • .opencode/plugins/auto-review-discipline.ts: Updated imports and added functions to handle delegated implementation edit leases. The code now attempts to consume a lease if no current cycle is found.
  • .opencode/plugins/lib/shared.ts: Added functions to record and consume delegated implementation edit leases, ensuring proper tracking and consumption.
  • tests/opencode-rgr-task-gate.test.mjs: Added tests to verify that edit permissions are correctly enforced and that unauthorized edits are prevented.
The PR introduces scoped delegated implementation-edit leases to manage edit permissions for subagents in the RGR process. It ensures that only authorized sessions can consume these leases, preventing unauthorized edits. The changes include new functions for handling leases and tests to validate the correct behavior. ## Walkthrough - **.opencode/agents/rgr-diagnostic-implementer.md**: Added clarification on the roles of orchestrating agents and subagents, preventing subagents from recreating RGR cycles. - **.opencode/plugins/auto-review-discipline.ts**: Updated imports and added functions to handle delegated implementation edit leases. The code now attempts to consume a lease if no current cycle is found. - **.opencode/plugins/lib/shared.ts**: Added functions to record and consume delegated implementation edit leases, ensuring proper tracking and consumption. - **tests/opencode-rgr-task-gate.test.mjs**: Added tests to verify that edit permissions are correctly enforced and that unauthorized edits are prevented.
jwilger deleted branch fix/rgr-subagent-approval-handoff 2026-05-18 11:27:40 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Slipstream/auto_review!250
No description provided.