Google’s Gemini CLI 0.63 release quietly addresses a persistent failure mode in headless environments, but the fix reveals a stark bifurcation in how the agent interprets its own instructions. By capturing system prompts from a local mock endpoint, developer fable7 demonstrated that the same binary generates two distinct planning workflows depending solely on whether stdin is attached to a terminal. The non-interactive prompt clocks in at 29,139 characters, while the interactive variant balloons to 30,370 charactersβ€”a 1,231-character delta that fundamentally alters agent behavior.

The TTY-Dependent Prompt Divergence

The core issue, tracked as #28913, manifested as silent exits in scripts where the agent would emit a text-only response and terminate, interpreting the lack of tool calls as completion. The fix, PR #29539, introduces conditional branching in renderPlanningWorkflow() within packages/core/src/prompts/snippets.ts. In non-interactive modes, the system instruction explicitly directs the agent to "proceed autonomously" and removes the blocking requirement to wait for user feedback. Conversely, the interactive prompt retains a critical warning: "You MUST NOT proceed to Step 3 (Draft) or Step 4 (Review & Approval) in the same turn as your initial strategy proposal."

Tool Availability and Workflow Steps

Beyond the textual instructions, the interactive mode exposes three additional tools: activate_skill, ask_user, and web_fetch. The non-interactive prompt omits ask_user entirely, reflecting its denial in headless sessions. This structural difference explains why the bug occurred: in the old workflow, the agent attempted to wait for approval in a mode where a text-only response was a termination signal. The new non-interactive prompt replaces the "Consult" step with "Determine Strategy" and modifies Step 4 to immediately trigger implementation via exit_plan_mode without awaiting formal agreement.

Implications for CI and Headless Runners

For teams automating Gemini CLI in CI pipelines, this update is a double-edged sword. While it prevents silent hangs, it introduces a sharp edge for wrappers that inadvertently allocate a PTY. Tools like script, pty.fork(), or docker run -it will trigger the interactive prompt, reintroducing the "wait for user" instruction. If a headless runner hangs on planning tasks, developers must first verify if a TTY is being attached, as the agent will politely block for a human that never exists.

Key Takeaways

  • Gemini CLI 0.63 branches system instructions based on TTY detection, creating two distinct planning workflows.
  • The non-interactive prompt removes blocking language and reduces tool count to prevent silent exits in scripts.
  • CI wrappers using PTY allocators (e.g., script, expect) may inadvertently trigger the interactive, blocking prompt.
  • The fix is verified in the shipped npm bundle @google/gemini-cli@0.63.0, not just the default branch.

The Bottom Line

This is a classic case of environment-dependent behavior masquerading as a model failure; always check your stdin configuration before blaming the LLM.