You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subagents (and occasionally the main agent) call the disabled native shell tool before falling back to pullfrog_shell #134
Hi Pullfrog team, thanks for building and maintaining Pullfrog. We've been using it for PR reviews and noticed something that looks like a small inefficiency. I wanted to share the details in case it's useful. Apologies if this is already known or expected.
Environment
pullfrog/pullfrog@v0, which resolves to pullfrog 0.1.138
Agent: opencode (V2 default)
shell: restricted, push: disabled
Main model: openrouter/claude-opus (resolved to ~anthropic/claude-opus-latest)
The agent sometimes calls the native shell tool. Pullfrog correctly rejects the call and points to pullfrog_shell:
[lens:<name>] » shell({
[lens:<name>] "command": "<grep over the PR diff file>"
[lens:<name>] })
[lens:<name>] » tool call failed: native shell is disabled in Pullfrog runs — call pullfrog_shell with the same command instead.
[lens:<name>] » pullfrog_shell({
The agent always recovers on the next turn by sending the same command through pullfrog_shell, so no run failed because of this. The cost is one wasted model turn per occurrence. That turn re-reads the cached context, which adds up on larger reviews that run several lenses.
How often (one day, 80 runs)
72 rejected native shell calls, spread across 34 of the 80 runs
64 of them came from review lens subagents (lines prefixed [lens:…])
8 came from the main agent, often as its first shell call right after pullfrog_checkout_pr
Why we think the tool is still visible to the model
The main system prompt already says "Use the pullfrog_shell MCP tool for all shell command execution… Do NOT use any native shell tool — it is disabled". The main agent still occasionally reaches for shell, which suggests the native tool is still registered and offered to the model. The lens subagents may not get that instruction at all, which would explain why most occurrences come from them.
Possible fixes (just ideas, you know the internals far better)
When shell is restricted or disabled, don't register the native shell tool with opencode, for the main agent or for subagents, so the model never sees it.
Or add the "use pullfrog_shell; native shell is disabled" guidance to the subagent/lens prompts as well.
How to confirm
In run logs from a Review with lens subagents on a moderately large diff, search for native shell is disabled in Pullfrog runs. In our runs it showed up in about 40% of runs.
We can share more redacted log excerpts if that would help. Thanks again!
The issue can be acted on, and it isn't a duplicate (the closest candidates, #94, #127 and #126, are unrelated). The report matches the code. The native shell tool is still offered to the model on purpose and is refused only when it is called. The subagent prompt also never says which shell tool to use.
Root cause
The native tool is offered to the model on purpose.agents/opencode.ts:132-136 sets permission.bash: "ask" and does not use "deny". The reason is that OpenCode Zen's free tier rejects any request whose tool list lacks bash, glob, grep or read (utils/runErrorRenderer.ts:168-177). The gate plugin (agents/opencodePlugin.ts:225 for V1, :360 for V2) then throws on every call with the native shell is disabled in Pullfrog runs — call pullfrog_shell… message from nativeShellRefusal(). That message is what the reporter sees, and it costs one wasted turn each time.
The Zen workaround applies to every provider. It is only needed for opencode/* free-tier models, but it currently applies to all of them, including the reporter's openrouter/* run.
The subagent prompt doesn't name the shell tool.REVIEWER_SYSTEM_PROMPT (agents/reviewer.ts:93-96) tells reviewfrog that read-only commands like cat, ls and git diff "are fine". It never names pullfrog_shell or says that native shell is disabled. Subagents also don't get the main prompt's ## Tools section (utils/instructions.ts:133). This explains why 64 of the 72 cases came from [lens:…] sessions.
Plan
1. Hide native shell when the model isn't on Zen (the main fix)
In buildSecurityConfig (agents/opencode.ts:129):
Keep bash: "ask" only when the resolved model's provider is opencode (Zen), or when no model is resolved and auto-select could land on Zen.
For every other provider, set bash: "deny".
Also in V2 (agents/opencode2.ts:170-173):
Add { action: "shell", resource: "*", effect: "deny" } next to the existing execute deny, under the same provider condition.
Session permissions are inherited by child sessions (opencode2.ts:8-9), so this covers lens subagents too.
Keep the gate plugin's throw in both generations unchanged. It is still the safety net if a deny fails to take effect, and it still covers Zen.
What still needs checking before merging:
That a "*" deny actually removes the tool from the list sent to the provider, in both V1 ([email protected]) and V2 (@opencode/[email protected]). The execute deny suggests V2 does this, since it is what moves MCP tools out of Code Mode. Check this by logging or capturing the tool list on one OpenRouter run per generation.
Whether Zen's free-tier check looks for bash or for shell under V2. Until that is measured, keep the Zen exemption for both generations.
Update the comments at opencode.ts:132-135, opencode.ts:46 and opencodePlugin.ts:171-175 so they describe the provider-scoped rule. The "never switch to deny" comment is currently written as a rule for every provider.
2. Name the shell tool in the subagent prompt (this also helps on Zen and Claude)
In agents/reviewer.ts, add one line to the read-only constraint. It should say that shell commands go through the Pullfrog MCP shell tool, and that the native shell/bash tool is disabled and will be refused.
REVIEWER_SYSTEM_PROMPT is shared with agents/claude.ts:227, where the tool name is different (mcp__pullfrog__shell vs pullfrog_shell). Either make it a small function of the agent, using formatMcpToolRef(agent, "shell") from external.ts, or use wording that doesn't depend on the agent ("the Pullfrog MCP shell tool").
When shell: disabled, mirror the existing branch in nativeShellRefusal() and say there is no shell, so the subagent should use read, grep and glob.
3. Tests
Unit test for buildSecurityConfig: openrouter/…, anthropic/… and similar get bash: "deny", and opencode/… keeps "ask".
Unit test for the V2 session permissions: the shell deny is present for non-Zen models.
Unit test for the reviewer prompt: it contains the correct shell tool reference for both opencode and claude.
Run pnpm test for agents/, including subagentRegistration.test.ts.
4. Check it worked
Use the reporter's own check. Search the logs of a multi-lens Review on an openrouter/* model for native shell is disabled in Pullfrog runs. It should no longer appear for non-Zen providers, and it should appear less often on Zen because of step 2.
Risks
If a deny in either OpenCode generation turns out to refuse calls without removing the tool from the list, step 1 changes nothing. Step 2 then becomes the only improvement, and the gate plugin keeps everything safe either way.
Some Zen models outside the free tier may not need the workaround, but limiting the exemption to free-tier models only is more than this fix needs.
Task list (2/2 completed)
Gather context on opencode native shell handling and subagent prompts
Fixed in v0.1.140, already on @v0. OpenCode's native shell tool is no longer offered to the main agent or review lenses on openrouter/* or any other provider except OpenCode Zen and Go, which won't serve a request without it.
A model can still occasionally call shell on its own and get the same refusal, but it's about 10x rarer now. Thanks for the detailed report.
Activity
pullfrog commentedon Nov 19, 2026
Triage
The issue can be acted on, and it isn't a duplicate (the closest candidates, #94, #127 and #126, are unrelated). The report matches the code. The native shell tool is still offered to the model on purpose and is refused only when it is called. The subagent prompt also never says which shell tool to use.
Root cause
agents/opencode.ts:132-136setspermission.bash: "ask"and does not use"deny". The reason is that OpenCode Zen's free tier rejects any request whose tool list lacksbash,glob,greporread(utils/runErrorRenderer.ts:168-177). The gate plugin (agents/opencodePlugin.ts:225for V1,:360for V2) then throws on every call with thenative shell is disabled in Pullfrog runs — call pullfrog_shell…message fromnativeShellRefusal(). That message is what the reporter sees, and it costs one wasted turn each time.opencode/*free-tier models, but it currently applies to all of them, including the reporter'sopenrouter/*run.REVIEWER_SYSTEM_PROMPT(agents/reviewer.ts:93-96) tellsreviewfrogthat read-only commands likecat,lsandgit diff"are fine". It never namespullfrog_shellor says that native shell is disabled. Subagents also don't get the main prompt's## Toolssection (utils/instructions.ts:133). This explains why 64 of the 72 cases came from[lens:…]sessions.Plan
1. Hide native shell when the model isn't on Zen (the main fix)
In
buildSecurityConfig(agents/opencode.ts:129):bash: "ask"only when the resolved model's provider isopencode(Zen), or when no model is resolved and auto-select could land on Zen.bash: "deny".Also in V2 (
agents/opencode2.ts:170-173):{ action: "shell", resource: "*", effect: "deny" }next to the existingexecutedeny, under the same provider condition.opencode2.ts:8-9), so this covers lens subagents too.Keep the gate plugin's throw in both generations unchanged. It is still the safety net if a deny fails to take effect, and it still covers Zen.
What still needs checking before merging:
"*"deny actually removes the tool from the list sent to the provider, in both V1 ([email protected]) and V2 (@opencode/[email protected]). Theexecutedeny suggests V2 does this, since it is what moves MCP tools out of Code Mode. Check this by logging or capturing the tool list on one OpenRouter run per generation.bashor forshellunder V2. Until that is measured, keep the Zen exemption for both generations.opencode.ts:132-135,opencode.ts:46andopencodePlugin.ts:171-175so they describe the provider-scoped rule. The "never switch to deny" comment is currently written as a rule for every provider.2. Name the shell tool in the subagent prompt (this also helps on Zen and Claude)
agents/reviewer.ts, add one line to the read-only constraint. It should say that shell commands go through the Pullfrog MCPshelltool, and that the native shell/bash tool is disabled and will be refused.REVIEWER_SYSTEM_PROMPTis shared withagents/claude.ts:227, where the tool name is different (mcp__pullfrog__shellvspullfrog_shell). Either make it a small function of the agent, usingformatMcpToolRef(agent, "shell")fromexternal.ts, or use wording that doesn't depend on the agent ("the Pullfrog MCPshelltool").shell: disabled, mirror the existing branch innativeShellRefusal()and say there is no shell, so the subagent should use read, grep and glob.3. Tests
buildSecurityConfig:openrouter/…,anthropic/…and similar getbash: "deny", andopencode/…keeps"ask".shelldeny is present for non-Zen models.opencodeandclaude.pnpm testforagents/, includingsubagentRegistration.test.ts.4. Check it worked
Use the reporter's own check. Search the logs of a multi-lens
Reviewon anopenrouter/*model fornative shell is disabled in Pullfrog runs. It should no longer appear for non-Zen providers, and it should appear less often on Zen because of step 2.Risks
Task list (2/2 completed)
claude-opus-5-5(free via Pullfrog for OSS) | 𝕏opencode: unlist native bash off Zen and Go (#1724)
colinhacks commentedon Nov 21, 2026
Fixed in v0.1.140, already on
@v0. OpenCode's nativeshelltool is no longer offered to the main agent or review lenses onopenrouter/*or any other provider except OpenCode Zen and Go, which won't serve a request without it.A model can still occasionally call
shellon its own and get the same refusal, but it's about 10x rarer now. Thanks for the detailed report.