Fix opencode not found: symlink installer binary to /usr/local/bin
All checks were successful
CI / lint-and-test (push) Successful in 34s
Deploy Production / deploy (push) Successful in 1m30s
CI / build (push) Successful in 1m51s

The opencode curl installer puts the binary in /root/.local/bin which
isn't on PATH for the nextjs user. Add a symlink to /usr/local/bin
after install. Also ensure /usr/local/bin is always in the PATH
passed to spawned agent processes.
This commit is contained in:
Julia McGhee
2026-03-21 22:10:13 +00:00
parent 0906efe60e
commit bf67446480
2 changed files with 8 additions and 0 deletions

View File

@@ -14,6 +14,12 @@ export async function buildAgentEnv(
): Promise<NodeJS.ProcessEnv> {
const env: NodeJS.ProcessEnv = { ...process.env, TERM: "xterm-256color" };
// Ensure global bin paths are available (npm -g, opencode installer)
const path = env.PATH || "/usr/local/bin:/usr/bin:/bin";
if (!path.includes("/usr/local/bin")) {
env.PATH = `/usr/local/bin:${path}`;
}
const providersToInject =
config.runtime === "opencode"
? Object.keys(PROVIDER_ENV_VARS)