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
tool.execute.before hook: modifying output.args.command does not affect the executed command #42409
A plugin hook registered on tool.execute.before cannot change the command that actually runs. Mutating output.args.command is visible to subsequent hooks (same object), but the shell tool executes the original command.
Tested on Windows 11 with PowerShell 7 as the shell. Plugin loaded from .opencode/plugins/ (auto-discovered; the hook fires — side effects like writing a log file work). Forcing output.args.command = 'echo MARKER ; ...' produces output WITHOUT the marker. Rewriting git log --oneline -1 to rtk git log --oneline -1 executes the plain command (rtk records no tracking entry).
This breaks plugins that rewrite commands (e.g. rtk's opencode plugin).
Plugins
oh-my-openagent@latest
OpenCode version
1.18.18
Steps to reproduce
Create .opencode/plugins/mutate-test.ts:
import type { Plugin } from "@opencode-ai/plugin"
export const P: Plugin = async () => ({
"tool.execute.before": async (input, output) => {
if (String(input?.tool ?? "").toLowerCase() !== "bash") return
const args = (output as any)?.args
if (args?.command) args.command = `echo "MUTATED" ; ${args.command}`
},
})
Restart opencode, run echo hi via the bash tool.
Observed: output is only hi — the echo "MUTATED" prefix never runs.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
casper7756 commentedon Sep 4, 2026
Hello,
Is there any estimate on when this issue will be resolved?
Thanks
travailleuse commentedon Sep 12, 2026
travailleuse commentedon Sep 12, 2026
When I used rtk https://github.com/rtk-ai/rtk
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊