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
OpenCode plugin: no rewrite when rtk is not on OpenCode's PATH (Desktop launched from the macOS GUI) #4462
When OpenCode is started from a launcher whose PATH lacks the directory rtk is installed in (the macOS Dock with rtk in ~/.cargo/bin or /opt/homebrew/bin, for example), the OpenCode plugin finds no rtk and every command runs unrewritten. #2039 reported this and was closed into #3326; #4187 closes #3326 for the Desktop $ and Windows which failures, so this issue keeps the PATH case.
Measured while reviewing #4187, on OpenCode 1.18.10 and 2.0.22:
OpenCode's bash/shell tool runs commands with OpenCode's own PATH. It does not source .profile, .bashrc or .bash_profile; all three were tried with the directory exported.
So locating rtk somewhere else (RTK_BIN, ~/.cargo/bin, Homebrew) is not enough on its own: rtk hook opencode answers a bare rtk …, and the tool then fails with rtk: command not found.
A fix has to make the rewritten command resolve to the binary the plugin found. Two shapes to evaluate (neither tried yet): add that directory to the spawned shell's PATH (V1 shell.env, V2 ctx.shell.hook("create.before")), or have the rewrite carry the resolved path.
Rows a fix has to pass:
rtk only in ~/.cargo/bin, not on OpenCode's PATH → ls -la is rewritten and runs.
OpenCode plugin doesn't rewrite commands when rtk isn't on OpenCode's own PATH (e.g. Dock-launched Desktop), since the spawned shell doesn't inherit shell profile PATH additions.
📁 Relevant files
plugin/opencode.ts
src/hook/opencode.rs
Suggested Actions
Decide between injecting resolved dir into shell.env/create.before hook vs. emitting the resolved absolute rtk path in …
Validate against the three PATH scenarios listed (~/.cargo/bin only, RTK_BIN only, on PATH)
Activity
rtk-wshm-sync-bot commentedon Oct 5, 2026
🔍 Automated Triage
bugmediumSummary
OpenCode plugin doesn't rewrite commands when rtk isn't on OpenCode's own PATH (e.g. Dock-launched Desktop), since the spawned shell doesn't inherit shell profile PATH additions.
📁 Relevant files
plugin/opencode.tssrc/hook/opencode.rsSuggested Actions
rtk init --opencodeplugin silently does nothing on Desktop ($ is not a function) and on Windows (whichnot found) #3326 for how the Desktop$/Windowswhichcases were resolvedTriaged automatically by wshm · This is an automated analysis, not a human review.
fix(hooks/opencode): probe for the subcommand, resolve from PATH, for…
fix(opencode): resolve rtk binary path for GUI-launched OpenCode (rtk…
fix(opencode): inject rtk directory into shell PATH instead of editin…
fix(opencode): keep the environment's PATH key and pin rtk resolving …
docs(opencode): document rtk lookup order and why the rewrite stays b…
Merge pull request #4507 from TechWizard9999/fix/4462-opencode-path-r…