Skip to content

fix(server): honor auto-accept edits for the OpenCode provider - #7100

Merged
t3dotgg merged 1 commit into
pingdotgg:mainfrom
Rishet11:fix/5164-opencode-auto-accept-edits
Aug 24, 2026
Merged

fix(server): honor auto-accept edits for the OpenCode provider#7100
t3dotgg merged 1 commit into
pingdotgg:mainfrom
Rishet11:fix/5164-opencode-auto-accept-edits

Conversation

@Rishet11

@Rishet11 Rishet11 commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

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.

buildOpenCodePermissionRules only branched on full-access. Everything else - approval-required, auto-accept-edits, auto - got the same blanket ruleset with edit set to ask, 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.md already specifies the behaviour:

Auto-accept edits: auto-approve edits, ask before other actions. File changes go through
without prompting; commands and anything else still stop for approval.

That is the documented contract, and OpenCode was not honouring it. ClaudeAdapter maps the same mode to Claude's acceptEdits, and Codex maps it onto a workspace-write sandbox, so OpenCode was the odd one out.

auto is deliberately left alone. My first draft changed it too, on the reasoning that auto sits above auto-accept-edits and should not prompt more than the mode below it. The same doc rules that out:

Auto: routine actions proceed without you; risky ones still ask. How this is enforced depends
on the provider: Codex delegates routine approvals to an AI reviewer, Claude uses its own auto
permission mode, and providers without an equivalent (such as OpenCode) fall back to asking, like
Supervised.

OpenCode falling back to Supervised for auto is 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:

  • Only edit, and only in one mode. bash, webfetch, websearch, codesearch, external_directory, doom_loop and the * catch-all still ask, in every mode below full-access. Running a command is still gated.
  • approval-required and auto are untouched. Both still ask for everything, edits included.
  • full-access is untouched.

The issue also asks for a second thing - wiring the auto_review guardian subagent into OpenCode for auto mode. 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 to ask and 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 - PermissionRule is 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 new edit rule 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

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes (n/a)
  • I included a video for animation/interaction changes (n/a)

Verification

vp test run apps/server/src/provider/opencodeRuntime.permissions.test.ts   #  5 passed
vp test run apps/server/src/provider/opencodeRuntime.cliParsers.test.ts    # 14 passed (unchanged)
vp run --filter @t3tools/server typecheck                                  # exit 0
vp lint / vp fmt --check on both touched files                             # clean

The new test file pins the whole table, not just the changed cell: edits allowed under auto-accept-edits, edits still asked under approval-required and under auto (the documented fallback), bash/webfetch/external_directory/* still asked, and full-access still 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 the edit rule fails it:

FAIL  buildOpenCodePermissionRules > pre-approves edits once the user has chosen to auto-accept them
AssertionError: Expected values to be strictly equal:
Expected: "allow"

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 edit permissions are allow instead of prompting like Supervised.

buildOpenCodePermissionRules sets editAction to allow only when runtimeMode === "auto-accept-edits". approval-required, auto (documented Supervised fallback without an AI reviewer), and full-access are unchanged; bash, webfetch, and other permissions still ask outside full access.

New unit tests in opencodeRuntime.permissions.test.ts lock 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 buildOpenCodePermissionRules to allow edits in auto-accept-edits mode

Previously, the edit permission was hardcoded to ask in opencodeRuntime.ts regardless of runtime mode. Now, edit is set to allow when runtimeMode is auto-accept-edits, and remains ask for auto and approval-required modes.

Macroscope summarized 2a32b4a.

Copilot AI lite review requested due to automatic review settings August 15, 2026 14:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b99fbb6-ad13-477a-a59e-96e264e3b00f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Aug 15, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

@t3dotgg
t3dotgg merged commit 04df98d into pingdotgg:main Aug 24, 2026
17 checks passed
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 24, 2026
## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(opencode): Supervised, Auto-accept edits, and Auto modes collapse into blanket 'ask' for all permissions

3 participants