--acp never answers initialize when a sandbox is enabled (stdin read as a piped prompt before the sandbox hop)

Open Beginner friendly
#30,398 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Raamia is already working on this.

Since Nov 22, 2026.

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

status/need-triage
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:

https://github.com/google-gemini/gemini-cli/blob/v0.70.0/packages/cli/src/utils/readStdin.ts#L35-L120

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

  1. On macOS, start GEMINI_SANDBOX=sandbox-exec gemini --acp.
  2. Immediately write an ACP initialize request line to its stdin.
  3. 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google-gemini/gemini-cli

All issues in google-gemini/gemini-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.