Repository navigation
Conversation
Plan only denies the file-editing tools, so shell commands that modify files ran unprompted and only the Plan system reminder asked the model not to change anything. The documented Plan permission set asks before every shell command, so add the missing shell rule.
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
This works. I ran OpenCode from source with a simulated model in the Plan agent and had it run the shell command from #53955. On the base the command ran without asking: it created src/repl.rs and deleted src/main.rs. With this change a permission prompt stops it. The plan and agent tests pass and packages/core type-checks.
The new rule uses shell, which is the action the shell tool checks. A user's agent.plan.permission config is applied after this plugin, so users can still loosen or tighten the rule. It also matches the documented Plan behaviour (bash set to ask).
The public API is unchanged. This only changes Plan's built-in permission defaults; no config keys, schema or SDK change.
No blocking concerns.
|
Closing this to stay within GitHub's 3-open-pull-request limit for contributors without write access, which currently blocks every new pull request here. The branch remains on my fork, so I can reopen it on request. |


Issue for this PR
Closes #53955
Type of change
What does this PR do?
In Plan mode the agent is supposed to plan, not mutate the repository. The Plan agent's
permission set in
packages/core/src/plugin/plan.tsdenies theedittool outside the Plandirectory, but it never declares a rule for the
shelltool.Permission.evaluateusesfindLast, so every shell command falls through to the agent default (* -> allow) andbash/python/git/rm/mvall run without any prompt. The Plan system reminderis the only thing asking the model not to change files, and a model that ignores it can edit
the worktree through the shell — which is exactly what #53955 reports (the reporter saw a
shell command create
src/repl.rs, edit and deletesrc/main.rs, and rungit add/git commitwith no permission prompt).The published agent docs describe Plan mode as setting both file edits and bash to
ask, so this is the documented behaviour not being implemented rather than a new policy.The change is one additive rule:
The action string is
"shell", not"bash": that is the tool's ownexport const name = "shell", and it is whattool/plugin/shell.tspasses topermission.assert. Read-onlycommands keep working after one confirmation, while a destructive command now has to be
approved.
exploreis deliberately left alone — other built-in agents stay on the* -> allowdefault, which an existing
test/agent.test.tscase pins.How did you verify your code works?
Added a case to the existing
plan plugin mutationsblock inpackages/core/test/plugin/plan.test.ts:Red-baselined both ways on the current
v2tip: with only the source hunk reverted to stockthe new case fails (
12 pass / 1 fail, readingallow), and with the change it passes(
13 pass / 0 fail).tsgo -b tsconfig.json tsconfig.tests.jsonis clean forpackages/coreand
oxlintreports 0 warnings / 0 errors on both files.Screenshots / recordings
Not a UI change.
Checklist
Added by the opencode bot (AI-generated).
Related: #53530, #39491, #34190