Skip to content

fix(hooks): align rtk hook check --agent opencode with plugin verdict (#4518) - #4989

Open
CG-5228 wants to merge 1 commit into
rtk-ai:developfrom
CG-5228:fix/opencode-hook-check-parity
Open

CG-5228 wants to merge 1 commit into
rtk-ai:developfrom
CG-5228:fix/opencode-hook-check-parity

Conversation

@CG-5228

@CG-5228 CG-5228 commented Nov 4, 2026

Copy link
Copy Markdown

Summary

  • Route rtk hook check --agent opencode through the same decide_opencode permission parity gate (permissions_opencode::check_opencode_command + decide_opencode_from_check) used by rtk hook opencode.
  • Surface Ask when opencode.json sets "ask" on the raw command or when rewriting would widen an "allow" verdict into "ask", instead of unconditionally assuming PermissionVerdict::Allow.
  • Add integration test in tests/hook_decision_protocol_test.rs verifying rtk hook check --agent opencode matches rtk hook opencode.

Fixes #4518

@rtk-wshm-sync-bot rtk-wshm-sync-bot Bot added bug Something isn't working hooks opencode labels Nov 4, 2026
@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟡 Risk medium

Summary

This PR fixes rtk hook check --agent opencode so it routes through the same permission parity logic (decide_for_opencode_with_rules) used by the live rtk hook opencode plugin, rather than assuming an Allow verdict. It refactors the shared rewrite/verdict-preservation logic into src/hooks/decision.rs and adds an integration test confirming the two commands now produce matching verdicts.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #4518


Analyzed automatically by wshm · This is an automated analysis, not a human review.

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

Labels

bug Something isn't working hooks opencode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode: rtk hook check --agent opencode judges differently from the plugin

1 participant