SIGN IN SIGN UP

fix(agents): drop --dir from opencode run (OpenCode v2 rejects it) (#1610)

* fix(agents): drop --dir from opencode run; the job's spawn cwd carries the directory (#1609)

OpenCode v2's `run` rejects --dir ("Unrecognized flag: --dir in command
opencode run"), which broke Guided Review and review-agent jobs on the
OpenCode engine. Both runtimes already spawn marker-engine jobs with the
review's cwd, so the flag is removed and the directory rides the process
cwd, which OpenCode 1.x and 2.x both honor.

* fix(agents): spawn jobs with PWD set to their cwd; honor the live PATH in Pi's whichCmd (#1609)

OpenCode (1.x and 2.x) resolves its session directory from process.env.PWD
before process.cwd(), and both job spawners copied the server's own PWD into
the child env, so with --dir gone an OpenCode job ran in the server's
directory instead of the review's (PR pool checkouts, worktrees, workspace
roots). Both runtimes now set PWD to the spawn cwd for every job.

Pi's whichCmd called execFileSync without env, which under Bun resolves the
binary on the startup PATH rather than the current process.env.PATH; it now
passes process.env.

The launch tests use a bun-script fake (a POSIX shell rewrites a mismatched
PWD and would hide the leak), run with the server's PWD pointed elsewhere,
and pass with no real opencode on PATH.
M
Michael Ramos committed
25971baaaafcd58f723c15e913a24ff9f249b968
Parent: e5dd435
Committed by GitHub <noreply@github.com> on 9/24/2026, 11:35:17 PM