fix(server): honor auto-accept edits for the OpenCode provider - #7100
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: Approved 2a32b4a This is a small, well-tested bug fix that makes the 'auto-accept-edits' runtime mode honor the user's preference. The change is a single conditional with clear intent, comprehensive test coverage, and inline documentation explaining the reasoning. You can customize Macroscope's approvability policy. Learn more. |
## What's Changed * fix(server): bound OpenCode skill discovery output by @Lucenx9 in pingdotgg/t3code#7675 * fix(mobile): persist thread shelf collapse state by @PixPMusic in pingdotgg/t3code#5152 * fix(mobile): restore Android tablet thread controls, clean up header by @PixPMusic in pingdotgg/t3code#5385 * fix(mobile): land the first thread open above the composer on Android by @PollyGlot in pingdotgg/t3code#5585 * fix(server): check out submodules in a new worktree by @Brechard in pingdotgg/t3code#7674 * fix(server): preserve merged PR badges after branch deletion by @tris203 in pingdotgg/t3code#6216 * fix(server): return fresh live pull request reads by @Adamulek123 in pingdotgg/t3code#6472 * fix(web): compare client and server versions as semver, not strings by @spiky02plateau in pingdotgg/t3code#7579 * fix(web): stop follow-ups from leaving giant blank space by @t3dotgg in pingdotgg/t3code#8068 * fix(marketing): stop automatic Vercel deployments on pull requests by @t3dotgg in pingdotgg/t3code#8070 * chore: vouch repeat contributors by @t3dotgg in pingdotgg/t3code#8071 * fix(server): keep the authoritative subagent model when snapshots race task_started by @spiky02plateau in pingdotgg/t3code#7583 * fix(server): honor auto-accept edits for the OpenCode provider by @Rishet11 in pingdotgg/t3code#7100 * fix(server): run the CLI on Node versions without import.meta.main by @CDVolvik in pingdotgg/t3code#7141 * fix(server): recover from provider interrupt failures by @mrmg in pingdotgg/t3code#7412 * fix(server): recreate a thread's worktree before starting a turn by @mackinleysmith in pingdotgg/t3code#7839 * fix(server): thread delete no longer fails on already-removed worktrees by @t3dotgg in pingdotgg/t3code#8076 * fix(web): stop update notices showing through the composer by @t3dotgg in pingdotgg/t3code#8083 ## New Contributors * @spiky02plateau made their first contribution in pingdotgg/t3code#7579 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260824.1175...v0.0.34-nightly.20260824.1176 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260824.1176
What Changed
On OpenCode, picking Auto-accept edits did nothing. Every file edit still stopped and waited for approval, exactly as in Supervised. The mode was selectable and had no effect.
buildOpenCodePermissionRulesonly branched onfull-access. Everything else -approval-required,auto-accept-edits,auto- got the same blanket ruleset witheditset toask, so three different modes behaved identically.Edits are now pre-approved in Auto-accept edits, which is what the mode already promises.
Why
docs/user/permission-modes.mdalready specifies the behaviour:That is the documented contract, and OpenCode was not honouring it.
ClaudeAdaptermaps the same mode to Claude'sacceptEdits, and Codex maps it onto a workspace-write sandbox, so OpenCode was the odd one out.autois deliberately left alone. My first draft changed it too, on the reasoning thatautosits aboveauto-accept-editsand should not prompt more than the mode below it. The same doc rules that out:OpenCode falling back to Supervised for
autois documented and intended, not a bug, so this PR does not touch it.What this does not change
This is a change that makes the app ask permission less often, so the limits are worth stating plainly:
edit, and only in one mode.bash,webfetch,websearch,codesearch,external_directory,doom_loopand the*catch-all still ask, in every mode belowfull-access. Running a command is still gated.approval-requiredandautoare untouched. Both still ask for everything, edits included.full-accessis untouched.The issue also asks for a second thing - wiring the
auto_reviewguardian subagent into OpenCode forautomode. I have not done that, for two reasons. It is the documented fallback described above, and OpenCode's permission model is a static rule table whose SDK action type is"allow" | "deny" | "ask", with no reviewer or callback hook to wire a guardian into. Giving OpenCode an AI reviewer is a design decision for you, not something to infer from the issue.On rule precedence
Worth spelling out, since the ruleset keeps a
*catch-all set toaskand the new rule has to win against it.The resolution happens inside the OpenCode server rather than here, and the SDK type carries no precedence documentation -
PermissionRuleis just{ permission, pattern, action }. The existing ruleset answers it though:{ permission: "question", action: "allow" }already sits after{ permission: "*", action: "ask" }, and questions do get through today. If the catch-all took precedence that line would never have worked. The neweditrule is in exactly the same position, so it resolves the same way.If that is wrong and the catch-all does win, this PR is inert rather than dangerous - the mode would keep asking, as it does now.
UI Changes
n/a - no interface change. The difference is that an OpenCode edit in Auto-accept edits no longer opens an approval prompt.
Checklist
Verification
The new test file pins the whole table, not just the changed cell: edits allowed under
auto-accept-edits, edits still asked underapproval-requiredand underauto(the documented fallback),bash/webfetch/external_directory/*still asked, andfull-accessstill a single allow-all rule. That last group is the one that matters for review - it fails if a future change quietly widens anything beyond edits.Putting
action: "ask"back on theeditrule fails it:Fixes #5164
Implemented with Claude Opus 5 via Claude Code.
Note
Low Risk
Narrow server-side permission mapping change with tests; only relaxes prompts for edits in one mode, leaving commands and other actions gated.
Overview
Auto-accept edits on the OpenCode provider now matches the documented behavior: file
editpermissions areallowinstead of prompting like Supervised.buildOpenCodePermissionRulessetseditActiontoallowonly whenruntimeMode === "auto-accept-edits".approval-required,auto(documented Supervised fallback without an AI reviewer), andfull-accessare unchanged; bash, webfetch, and other permissions stillaskoutside full access.New unit tests in
opencodeRuntime.permissions.test.tslock the permission table for each runtime mode.Reviewed by Cursor Bugbot for commit 2a32b4a. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
buildOpenCodePermissionRulesto allow edits in auto-accept-edits modePreviously, the
editpermission was hardcoded toaskin opencodeRuntime.ts regardless of runtime mode. Now,editis set toallowwhenruntimeModeisauto-accept-edits, and remainsaskforautoandapproval-requiredmodes.Macroscope summarized 2a32b4a.