gemini-cli - ✅(Solved) Fix Gemini CLI sometimes reports [active topic] in its output [1 pull requests, 4 comments, 2 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#26237Fetched 2026-04-30 06:44:16
View on GitHub
Comments
4
Participants
2
Timeline
15
Reactions
0
Timeline (top)
commented ×4labeled ×2mentioned ×2subscribed ×2

Fix Action

Fixed

PR fix notes

PR #26238: # Fix topic marker leakage in CLI output

Description (problem / solution / changelog)

Fix topic marker leakage in CLI output

Description

This PR addresses issue #26237 where the text [active topic] (or similar) would sometimes appear in the Gemini CLI output when topic narration was enabled.

The investigation revealed that PromptProvider.ts was appending [Active Topic: ${topic}] to the very end of the system prompt as a "context reinjection" mechanism. Without explicit labelling or instructions, some models (especially smaller or older ones) misinterpreted this bracketed text as a status line that should be included or maintained in their chat responses.

Changes

  • Refactored Reinjection Format: Changed the active topic reinjection in PromptProvider.ts to use XML tags (<active_topic>...</active_topic>`), which are more clearly structural metadata and less likely to be repeated as conversational text.
  • Added Explicit Instructions: Updated mandateTopicUpdateModel in both snippets.ts and snippets.legacy.ts to include a clear negative constraint: "Never include topic markers, title text, or the active topic marker (e.g. [active topic] or <active_topic>) in your chat responses."
  • Updated Tests: Adjusted promptProvider.test.ts to verify the new XML tag format.

Impact

  • Productivity: Reduces noise in the CLI output and prevents "hallucinated" status lines.
  • UX: Ensures topic updates are only provided via the dedicated "Topic UX" (tool results) and not leaked into the chat history.

Verification

  • Ran npm test -w @google/gemini-cli-core -- src/prompts/promptProvider.test.ts and verified all 16 tests pass, including the new topic narration checks.

Changed files

  • packages/core/src/prompts/promptProvider.test.ts (modified, +2/-2)
  • packages/core/src/prompts/promptProvider.ts (modified, +2/-2)
  • packages/core/src/prompts/snippets.legacy.ts (modified, +1/-0)
  • packages/core/src/prompts/snippets.ts (modified, +1/-0)

Code Example

> /about
# paste output here
RAW_BUFFERClick to expand / collapse

What happened?

Output sometimes has the text [active topic] when update_topic and topic narration are enabled.

What did you expect to happen?

Topic updates should only really be provided via the update topics ux and not via [active topic] text.

Client information

<details> <summary>Client Information</summary>

Run gemini to enter the interactive CLI, then run the /about command.

> /about
# paste output here
</details>

Login information

No response

Anything else we need to know?

No response

extent analysis

TL;DR

Disable the topic narration feature to prevent the "[active topic]" text from appearing in the output.

Guidance

  • Investigate the update_topic and topic narration settings to understand how they interact with the output.
  • Check the documentation for the gemini CLI to see if there are any configuration options or commands that can help manage topic updates and narration.
  • Run the /about command in the gemini CLI to gather more information about the client and its configuration.
  • Review the output of the /about command to look for any clues about how to disable or customize the topic narration feature.

Notes

The exact steps to disable the topic narration feature are unclear without more information about the gemini CLI and its configuration options.

Recommendation

Apply workaround: Disable the topic narration feature to prevent the "[active topic]" text from appearing in the output, as this seems to be the most direct way to address the issue based on the provided information.

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 Gemini CLI sometimes reports [active topic] in its output [1 pull requests, 4 comments, 2 participants]