From cceac6093e6343423eb29f430a27a0becc23d5bd Mon Sep 17 00:00:00 2001 From: tanzhenxin Date: Fri, 27 Mar 2026 11:47:01 +0000 Subject: [PATCH] fix(cli): skip stdin read for ACP mode - Extend stdin handling to skip reading for ACP mode, similar to stream-json - Remove duplicate line in .dockerignore ACP mode passes protocol data via stdin that should be forwarded to the sandbox intact, not consumed as a user prompt. Co-authored-by: Qwen-Coder --- .dockerignore | 1 - packages/cli/src/gemini.tsx | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.dockerignore b/.dockerignore index f83243eb9..f8700bbc7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,7 +6,6 @@ node_modules dist **/dist **/tsconfig.tsbuildinfo -**/tsconfig.tsbuildinfo # Version control .git diff --git a/packages/cli/src/gemini.tsx b/packages/cli/src/gemini.tsx index b28ed2591..3d0e180db 100644 --- a/packages/cli/src/gemini.tsx +++ b/packages/cli/src/gemini.tsx @@ -282,11 +282,13 @@ export async function main() { process.exit(1); } } - // For stream-json mode, don't read stdin here - it should be forwarded to the sandbox - // and consumed by StreamJsonInputReader inside the container + // For stream-json and ACP modes, don't read stdin here — stdin carries + // protocol data (not a user prompt) and should be forwarded to the sandbox + // intact via stdio: 'inherit'. const inputFormat = argv.inputFormat as string | undefined; + const isAcpMode = argv.acp || argv.experimentalAcp; let stdinData = ''; - if (!process.stdin.isTTY && inputFormat !== 'stream-json') { + if (!process.stdin.isTTY && inputFormat !== 'stream-json' && !isAcpMode) { stdinData = await readStdin(); }