From 861457719b32644a450cc414f2f07ba522b65a62 Mon Sep 17 00:00:00 2001 From: Rene Fichtmueller Date: Fri, 17 Jul 2026 17:49:35 +0200 Subject: [PATCH] fix(gateway): run aider bridge non-interactively --- .../gateway/src/modules/bridge-spawner.ts | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/gateway/src/modules/bridge-spawner.ts b/packages/gateway/src/modules/bridge-spawner.ts index 6344eff..77d240c 100644 --- a/packages/gateway/src/modules/bridge-spawner.ts +++ b/packages/gateway/src/modules/bridge-spawner.ts @@ -21,6 +21,7 @@ interface RunningBridge { } const runningBridges = new Map(); +const PROMPT_ARG = '__LLM_GATEWAY_PROMPT__'; function extractCliContent(stdout: string): string { let lastAgentMessage = ''; @@ -54,9 +55,11 @@ async function runCli( ): Promise<{ success: boolean; content?: string; error?: string }> { return new Promise((resolve) => { try { + const finalArgs = args.map((arg) => arg === PROMPT_ARG ? prompt : arg); + const promptPassedAsArg = args.includes(PROMPT_ARG); const child = execFile( command, - args as string[], + finalArgs, { timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 }, (err, stdout) => { if (err) { @@ -66,7 +69,7 @@ async function runCli( } } ); - if (child.stdin) { + if (child.stdin && !promptPassedAsArg) { child.stdin.write(prompt); child.stdin.end(); } @@ -91,6 +94,21 @@ function buildCliInvocation(desc: SubscriptionDescriptor, model?: string): { cmd return { cmd: 'gh', args: ['copilot', 'suggest', '--shell'] }; } case 'inline-openai': { + if (desc.id === 'aider') { + const args = [ + '--yes-always', + '--no-show-model-warnings', + '--no-check-update', + '--no-analytics', + '--no-pretty', + '--no-stream', + '--no-git', + '--no-gitignore', + ]; + if (model && model !== 'aider-default') args.push('--model', model); + args.push('--message', PROMPT_ARG); + return { cmd: 'aider', args }; + } // Generic OpenAI-compatible CLI (chatgpt-cli, gemini-cli with OpenAI compat) return { cmd: desc.command, args: model ? ['--model', model] : [] }; }