Use precomputed runtime env in OpenCode execute

This commit is contained in:
Konan69
2026-03-05 16:11:11 +01:00
parent f4f9d6fd3f
commit 0078fa66a3

View File

@@ -108,7 +108,11 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
if (!hasExplicitApiKey && authToken) { if (!hasExplicitApiKey && authToken) {
env.PAPERCLIP_API_KEY = authToken; env.PAPERCLIP_API_KEY = authToken;
} }
const runtimeEnv = ensurePathInEnv({ ...process.env, ...env }); const runtimeEnv = Object.fromEntries(
Object.entries(ensurePathInEnv({ ...process.env, ...env })).filter(
(entry): entry is [string, string] => typeof entry[1] === "string",
),
);
await ensureCommandResolvable(command, cwd, runtimeEnv); await ensureCommandResolvable(command, cwd, runtimeEnv);
await ensureOpenCodeModelConfiguredAndAvailable({ await ensureOpenCodeModelConfiguredAndAvailable({
@@ -216,7 +220,7 @@ export async function execute(ctx: AdapterExecutionContext): Promise<AdapterExec
const proc = await runChildProcess(runId, command, args, { const proc = await runChildProcess(runId, command, args, {
cwd, cwd,
env, env: runtimeEnv,
stdin: prompt, stdin: prompt,
timeoutSec, timeoutSec,
graceSec, graceSec,