gemini-cli - ✅(Solved) Fix bug : Steering hint cancellation resubmits hint as new turn [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
google-gemini/gemini-cli#26133Fetched 2026-04-29 06:35:34
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
renamed ×2cross-referenced ×1labeled ×1

Fix Action

Fixed

PR fix notes

PR #26134: fix(cli): clear pending steering hints upon cancellation

Description (problem / solution / changelog)

Summary

This PR fixes a bug where cancelling a turn (via ESC or Ctrl+C) would immediately resubmit any pending user steering hints as a new turn.

Details

The AppContainer maintains a buffer of pending steering hints that have not yet been submitted. When a turn is active, these hints are queued. If the turn is cancelled, the state returns to Idle. A useEffect in AppContainer monitors the Idle state and, if it finds pending hints, automatically submits them.

This change updates the cancelOngoingRequest handler in both useGeminiStream and useAgentStream to consume (clear) the pending hint buffer during cancellation, preventing the unwanted automatic resubmission.

Related Issues

Fixes #26133

How to Validate

  1. Run the CLI in a mode where you can trigger a long-running tool (e.g., sleep 10 in a shell).
  2. While the tool is running, type a steering hint and press Enter.
  3. Press ESC or Ctrl+C to cancel the turn.
  4. Expected: The turn cancels, and you are returned to a clean prompt.
  5. Observed (before fix): The turn cancels, but then immediately a new turn starts with your steering hint.

Automated tests: npm test -w @google/gemini-cli -- src/ui/hooks/useGeminiStream.test.tsx src/ui/hooks/useAgentStream.test.tsx

Meme

ZomboMeme 28042026234311.jpg

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • Linux
      • npm run

Changed files

  • packages/cli/src/ui/AppContainer.tsx (modified, +1/-0)
  • packages/cli/src/ui/hooks/useAgentStream.test.tsx (modified, +19/-0)
  • packages/cli/src/ui/hooks/useAgentStream.ts (modified, +4/-1)
  • packages/cli/src/ui/hooks/useGeminiStream.test.tsx (modified, +43/-0)
  • packages/cli/src/ui/hooks/useGeminiStream.ts (modified, +2/-0)

Code Example

OS: Linux
Version: 0.41.0-nightly.20260423.gaa05b4583
RAW_BUFFERClick to expand / collapse

What happened?

When providing a steering hint during an active turn and then cancelling the turn (via Ctrl+C or ESC), the original turn is cancelled but the steering hint remains in the buffer. Once the agent returns to Idle, it immediately submits the steering hint as a new turn.

What did you expect to happen?

Cancelling a turn should also clear any pending steering hints so the CLI remains at the prompt without starting a new unwanted turn.

Client information

<details> <summary>Client Information</summary>
OS: Linux
Version: 0.41.0-nightly.20260423.gaa05b4583
</details>

Login information

N/A

Anything else we need to know?

Fixing this requires clearing the pending steering hint buffer during the cancellation handler.

extent analysis

TL;DR

Clearing the pending steering hint buffer during the cancellation handler is likely the most effective fix.

Guidance

  • Investigate the cancellation handler to ensure it properly clears the steering hint buffer.
  • Verify that the buffer is being populated correctly when a steering hint is provided during an active turn.
  • Check for any edge cases where the cancellation handler might not be triggered correctly (e.g., when using Ctrl+C vs. ESC).
  • Consider adding logging or debugging statements to the cancellation handler to confirm it is being executed as expected.

Example

No code snippet is provided due to lack of specific implementation details.

Notes

The provided information suggests a specific fix, but without access to the codebase, it's difficult to provide a more detailed solution. The cancellation handler's implementation and the steering hint buffer's management are crucial to resolving this issue.

Recommendation

Apply workaround: Implement a check in the cancellation handler to explicitly clear the steering hint buffer, ensuring that any pending hints are removed when a turn is cancelled.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

gemini-cli - ✅(Solved) Fix bug : Steering hint cancellation resubmits hint as new turn [1 pull requests, 1 participants]