--acp never answers initialize when a sandbox is enabled (stdin read as a piped prompt before the sandbox hop)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 70/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- node.js, typescript
- Domain
- cli
Research direction
Start in packages/cli/src/gemini.tsx around the stdin read inside the if (sandboxConfig) branch, then read packages/cli/src/utils/readStdin.ts to see why the 1 s timer is cleared on the first chunk. Decide how the ACP flag (--acp / --experimental-acp) is known at that point and skip the piped-prompt read when it is set, so the sandbox hop happens immediately. Done means GEMINI_SANDBOX=sandbox-exec gemini --acp answers initialize right away, with existing CLI tests still passing.
Written by the indexing model from the issue text.
Description
What happened?
With a sandbox enabled (GEMINI_SANDBOX, --sandbox, or tools.sandbox in settings), gemini --acp never answers an ACP client's initialize request when the client writes it as soon as the process starts. Without a sandbox it answers at once.
The cause: before hopping into the sandbox, the CLI reads a non-TTY stdin as a piped prompt:
https://github.com/google-gemini/gemini-cli/blob/v0.70.0/packages/cli/src/gemini.tsx#L705-L728
readStdin() clears its 1 s "nothing piped" timer at the first chunk, then waits for an end of input that an ACP stdio transport never sends. So the CLI waits forever and never starts the sandboxed process:
A client that holds its first write back for about 3 s does get an answer, because the timer fires first and the read ends empty, but that's a race, not a fix.
This looks like the cause of #22782 (--acp hanging, with sandbox-exec (permissive-open) in its client information), which was closed as not planned.
Steps to reproduce
- On macOS, start
GEMINI_SANDBOX=sandbox-exec gemini --acp. - Immediately write an ACP
initializerequest line to its stdin. - No response arrives (waited 15 s). Without
GEMINI_SANDBOX, the response arrives at once.
What did you expect to happen?
With a sandbox enabled, --acp hops into the sandbox and answers initialize from inside it. ACP never takes a piped prompt, so skipping the stdin read when --acp (or --experimental-acp) is set should fix it.
Client information
- CLI version: 0.70.0 (also 0.69.0)
- Platform: macOS (darwin arm64)
- Sandbox: sandbox-exec (permissive-open)
The read sits inside if (sandboxConfig), before the hop, so any sandbox command should behave the same.
Login information
None needed: reproduced with a fresh GEMINI_CLI_HOME and no account configured.
- Dominant language
- TypeScript
- Stars
- 109k
- Forks
- 15k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 106
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google-gemini/gemini-cli
-
status/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30412 · 1 comment ·
Maintainers usually reply within 1 day
-
** Docs: `/shells` slash command (and `/bashes`) is documented but was removed in #22740 — tutorial and tip tell users to run a command that doesn't existPossibly taken @DZH166 claimed this 1 day ago. Openstatus/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
google-gemini/gemini-cli#30396 · 2 comments ·
Maintainers usually reply within 1 day
-
** Docs: System Prompt Override guide links "Persisting Environment Variables" to an anchor that does not exist in authentication.mdxPossibly taken @DZH166 claimed this 1 day ago. Openstatus/need-triage
Difficulty 1/5 Under an hour Newbie friendliness 82/100
google-gemini/gemini-cli#30394 · 2 comments ·
Maintainers usually reply within 1 day
-
core tests: orphan PTY slave fd test fails on Macs where /dev/ttys001 existsPossibly taken @Anoshor claimed this 2 days ago. Openstatus/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
google-gemini/gemini-cli#30384 · 2 comments ·
Maintainers usually reply within 1 day
-
cli tests: gemini.test.tsx fails locally unless GEMINI_CLI_TRUST_WORKSPACE is setPossibly taken @Anoshor claimed this 2 days ago. Openstatus/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
google-gemini/gemini-cli#30383 · 3 comments ·
Maintainers usually reply within 1 day
All issues in google-gemini/gemini-cli
Similar issues
-
bug done
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
neavo/LinguaGacha#1124 ·
Maintainers usually reply within 1 day
-
[fullsend] E2E: backstage-microsoft-auth — catalogQuery missing error handler for network errorsPossibly taken @fullsend-ai-coder claimed this today. Opene2e-failure ready-to-code
Difficulty 2/5 Under an hour Newbie friendliness 78/100
redhat-developer/rhdh-plugin-export-overlays#4821 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
brylie/mission-island#225 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
sagemathinc/sagebrush#1683 ·
Maintainers usually reply within 1 day