diff --git a/agents/opencode.ts b/agents/opencode.ts index 648ead5..80f7367 100644 --- a/agents/opencode.ts +++ b/agents/opencode.ts @@ -83,7 +83,8 @@ export const opencode = agent({ timeout: 600000, // 10 minutes timeout to prevent infinite hangs stdio: ["ignore", "pipe", "pipe"], onStdout: async (chunk) => { - console.log(JSON.stringify(JSON.parse(chunk), null, 2)); + const parsed = JSON.parse(chunk); + log.debug(JSON.stringify(parsed, null, 2)); const text = chunk.toString(); output += text; @@ -125,7 +126,12 @@ export const opencode = agent({ } }, onStderr: (chunk) => { - console.log(JSON.stringify(JSON.parse(chunk), null, 2)); + try { + const parsed = JSON.parse(chunk); + log.debug(JSON.stringify(parsed, null, 2)); + } catch { + // if not JSON, fall through to regular error logging + } const trimmed = chunk.trim(); if (trimmed) { log.warning(trimmed); diff --git a/agents/shared.ts b/agents/shared.ts index a2c68ad..b71ce72 100644 --- a/agents/shared.ts +++ b/agents/shared.ts @@ -58,9 +58,13 @@ export interface ConfigureMcpServersParams { * @returns Whitelisted environment object safe for subprocess spawning */ export function createAgentEnv(agentSpecificVars: Record): Record { + const home = agentSpecificVars.HOME || process.env.HOME; return { PATH: process.env.PATH, - HOME: process.env.HOME, + HOME: home, + // XDG_CONFIG_HOME must match HOME to ensure CLI tools find config files in the right place. + // GitHub Actions sets XDG_CONFIG_HOME to /home/runner/.config which would override $HOME/.config lookup. + XDG_CONFIG_HOME: home ? join(home, ".config") : undefined, LOG_LEVEL: process.env.LOG_LEVEL, NODE_ENV: process.env.NODE_ENV, GITHUB_TOKEN: getGitHubInstallationToken(), @@ -465,6 +469,8 @@ export async function installFromCurl({ // Run the install script with HOME set to temp directory // ensuring a fresh install for each run HOME: tempDir, + // XDG_CONFIG_HOME must match HOME so CLI tools find config in the right place + XDG_CONFIG_HOME: join(tempDir, ".config"), SHELL: process.env.SHELL, USER: process.env.USER, }, diff --git a/entry b/entry index 7e1ebea..0122338 100755 --- a/entry +++ b/entry @@ -89933,9 +89933,13 @@ function parseRepoContext() { // agents/shared.ts function createAgentEnv(agentSpecificVars) { + const home = agentSpecificVars.HOME || process.env.HOME; return { PATH: process.env.PATH, - HOME: process.env.HOME, + HOME: home, + // XDG_CONFIG_HOME must match HOME to ensure CLI tools find config files in the right place. + // GitHub Actions sets XDG_CONFIG_HOME to /home/runner/.config which would override $HOME/.config lookup. + XDG_CONFIG_HOME: home ? join4(home, ".config") : void 0, LOG_LEVEL: process.env.LOG_LEVEL, NODE_ENV: process.env.NODE_ENV, GITHUB_TOKEN: getGitHubInstallationToken(), @@ -90117,6 +90121,8 @@ async function installFromCurl({ // Run the install script with HOME set to temp directory // ensuring a fresh install for each run HOME: tempDir, + // XDG_CONFIG_HOME must match HOME so CLI tools find config in the right place + XDG_CONFIG_HOME: join4(tempDir, ".config"), SHELL: process.env.SHELL, USER: process.env.USER }, @@ -91302,7 +91308,8 @@ var opencode = agent({ // 10 minutes timeout to prevent infinite hangs stdio: ["ignore", "pipe", "pipe"], onStdout: async (chunk) => { - console.log(JSON.stringify(JSON.parse(chunk), null, 2)); + const parsed2 = JSON.parse(chunk); + log.debug(JSON.stringify(parsed2, null, 2)); const text = chunk.toString(); output += text; const lines = text.split("\n"); @@ -91336,7 +91343,11 @@ var opencode = agent({ } }, onStderr: (chunk) => { - console.log(JSON.stringify(JSON.parse(chunk), null, 2)); + try { + const parsed2 = JSON.parse(chunk); + log.debug(JSON.stringify(parsed2, null, 2)); + } catch { + } const trimmed = chunk.trim(); if (trimmed) { log.warning(trimmed);