claude-code - 💡(How to fix) Fix [BUG] promptSuggestion silently disabled when outputStyle is set, due to strict equality mismatch on querySource [1 comments, 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
anthropics/claude-code#57822Fetched 2026-05-11 03:24:27
View on GitHub
Comments
1
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1

Error Message

The feature is silently disabled with no telemetry: even with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 set as an environment variable, no tengu_prompt_suggestion_init or any related telemetry event is emitted, and no error is logged in --debug mode.

Error Messages/Logs

No error messages or logs are produced — the feature fails silently. Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective. Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective.

Root Cause

Root Cause Analysis (verified against open-source fork)

Fix Action

Fix / Workaround

  1. Launch Claude Code with the env override that the code documents as "overrides everything": CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude
  2. Have at least 2 turns of conversation (to clear the early_conversation suppress reason).
  3. Observe the input box on the 3rd+ prompt no gray ghost text appears, ever, in any subsequent turn.
  4. Confirm the workaround works by overriding outputStyle for one session: CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'
  5. With the same conversation, ghost text appears as expected from turn 3 onward.

Workaround that works (verified):

Workaround that works (verified):

Code Example

{
     "outputStyle": "Explanatory"
   }
   (Any non-default value reproduces — Explanatory, custom styles, etc.)

---

querySource.startsWith('repl_main_thread')

Function body — src/services/PromptSuggestion/promptSuggestion.ts:187 (uses strict equality):
export async function executePromptSuggestion(context: REPLHookContext) {
  if (context.querySource !== 'repl_main_thread') return
  ...
}

---

if (!context.querySource.startsWith('repl_main_thread')) return

---

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

---

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

The "prompt suggestions" feature (gray ghost text in the input box, accepted with Tab/Right arrow) never appears when outputStyle is set to anything other than the default in ~/.claude/settings.json for example "outputStyle": "Explanatory".

The feature is silently disabled with no telemetry: even with CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 set as an environment variable, no tengu_prompt_suggestion_init or any related telemetry event is emitted, and no error is logged in --debug mode.

This affects users who customize outputStyle (a documented and supported setting), making the feature effectively unreachable for them. In my case, I have used Claude Code with outputStyle: "Explanatory" for ~1 year and have never once seen the prompt suggestion ghost text on macOS, while the same Claude Code version (2.1.138) shows it correctly on Windows where I had the default outputStyle.

What Should Happen?

With CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 and at least 2 assistant turns of conversation, the gray ghost text suggestion should appear in the input box regardless of the user's outputStyle setting. outputStyle configures response presentation, not whether speculation/suggestion features run.

Error Messages/Logs

No error messages or logs are produced — the feature fails silently.

Running with claude -d "*" --debug-file /tmp/claude-debug.log over multiple turns produces zero entries matching prompt_suggestion, suggestion_suppressed, speculation, or tengu_prompt_suggestion_init. The function returns before reaching any logging path.

The only relevant trace in debug logs is the API request source field, which shows the querySource has been extended:

source=repl_main_thread:outputStyle:Explanatory

Steps to Reproduce

  1. Set outputStyle in ~/.claude/settings.json:
   {
     "outputStyle": "Explanatory"
   }
   (Any non-default value reproduces — Explanatory, custom styles, etc.)
  1. Launch Claude Code with the env override that the code documents as "overrides everything": CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude
  2. Have at least 2 turns of conversation (to clear the early_conversation suppress reason).
  3. Observe the input box on the 3rd+ prompt no gray ghost text appears, ever, in any subsequent turn.
  4. Confirm the workaround works by overriding outputStyle for one session: CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'
  5. With the same conversation, ghost text appears as expected from turn 3 onward.

Root Cause Analysis (verified against open-source fork)

There is a strict-equality vs prefix-match inconsistency between the call site and the function body for executePromptSuggestion:

Call site — src/query/stopHooks.ts:111 (uses prefix match):

querySource.startsWith('repl_main_thread')

Function body — src/services/PromptSuggestion/promptSuggestion.ts:187 (uses strict equality):
export async function executePromptSuggestion(context: REPLHookContext) {
  if (context.querySource !== 'repl_main_thread') return
  ...
}

When outputStyle is set, the querySource string is extended to "repl_main_thread:outputStyle:Explanatory" (verified in debug logs). The startsWith check at the call site passes, but the strict !== check inside the function body fails, causing it to return immediately before any telemetry, before any of the documented suppress reasons (growthbook, non_interactive, swarm_teammate, setting, etc.) are evaluated.

This is why no tengu_prompt_suggestion_init event is ever logged the function exits at line 1 before the logging paths.

Suggested Fix

Change promptSuggestion.ts:187 to match the call-site semantics:

if (!context.querySource.startsWith('repl_main_thread')) return

Alternatively, strip the suffix before comparison, or normalize querySource at a single source of truth. The current asymmetry between the two sites is the bug.

Claude Model

claude-opus-4-7 (and reproduces with claude-sonnet-4-6)

Is this a regression?

No — this has never worked on this machine for ~1 year of usage with outputStyle="Explanatory". It is not a recent regression; it is a long-standing silent failure tied specifically to having outputStyle set.

Last Working Version

N/A (never worked on macOS with non-default outputStyle)

Claude Code Version

2.1.138 (Claude Code)

Platform

Anthropic API (Claude.ai login)

Operating System

macOS (Darwin 25.3.0, arm64) Reproduces on:

  • macOS default Terminal.app
  • iTerm2
  • cmux (terminal multiplexer) Does NOT reproduce on Windows PowerShell with the same Claude Code version (where users typically have default outputStyle).

Terminal/Shell

zsh / macOS Terminal.app — but reproduces in iTerm2 and cmux.app as well, confirming this is not a terminal-specific issue.

Additional Information

Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective.

Discoverability: Very low — requires reading the open-source fork's source to identify. After 6 wrong hypotheses (vim mode, terminal compatibility, env var propagation, swarm_teammate, early_conversation, etc.), the actual root cause was only found by direct source inspection of promptSuggestion.ts:187.

Workaround that works (verified):

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

Telemetry suggestion: Even if the strict check is intentional, consider emitting a tengu_prompt_suggestion_init event with source: 'unknown_query_source' or similar before returning, so users debugging this don't see zero telemetry and assume the feature is missing entirely.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

N/A (never worked on macOS with non-default outputStyle)

Claude Code Version

2.1.138 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Severity: Low/Medium — feature is fully unreachable for any user with a non-default outputStyle, and the failure is silent (no error, no log), making it indistinguishable from "the feature doesn't exist on macOS" from the user's perspective.

Discoverability: Very low — requires reading the open-source fork's source to identify. After 6 wrong hypotheses (vim mode, terminal compatibility, env var propagation, swarm_teammate, early_conversation, etc.), the actual root cause was only found by direct source inspection of promptSuggestion.ts:187.

Workaround that works (verified):

CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=1 claude --settings '{"outputStyle":"default"}'

Telemetry suggestion: Even if the strict check is intentional, consider emitting a tengu_prompt_suggestion_init event with source: 'unknown_query_source' or similar before returning, so users debugging this don't see zero telemetry and assume the feature is missing entirely.

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

claude-code - 💡(How to fix) Fix [BUG] promptSuggestion silently disabled when outputStyle is set, due to strict equality mismatch on querySource [1 comments, 1 participants]