claude-code - 💡(How to fix) Fix [BUG] /btw question re-executes after exiting debug view (Ctrl+O) during subagent task [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#45460Fetched 2026-04-09 08:04:55
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Error Message

Error Messages/Logs

No explicit error message

Root Cause

This should not happen because /btw is designed to be ephemeral and not part of the main conversation state.

Code Example

No explicit error message
Behavior issue (unexpected duplicate execution)
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?

When using /btw during an active task with subagents, the question is unexpectedly re-executed after toggling debug view with Ctrl+O.

Specifically:

/btw works correctly at first (returns an overlay answer) After opening debug view (Ctrl+O) and returning Claude re-runs the /btw query automatically and answers it again

This should not happen because /btw is designed to be ephemeral and not part of the main conversation state.

What Should Happen?

/btw should execute only once It should not persist in conversation history Toggling debug view (Ctrl+O) should not cause it to re-run

Error Messages/Logs

No explicit error message
Behavior issue (unexpected duplicate execution)

Steps to Reproduce

Start a Claude Code session Run a task that triggers a subagent (e.g., code analysis or multi-step task)

While the task is running, execute:

/btw <any question> Observe Claude answers correctly Press Ctrl+O to open debug/verbose view Exit debug view Result:

Claude automatically answers the same /btw question again

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.97

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

This issue seems related to:

/btw being incorrectly restored into active state or debug mode (Ctrl+O) replaying interaction context

It may be caused by:

improper separation between ephemeral /btw context and main agent state or UI/debug layer re-triggering last command

extent analysis

TL;DR

The issue can be potentially fixed by modifying the code to properly separate ephemeral /btw context from the main agent state, preventing it from being restored or re-triggered after toggling debug view.

Guidance

  • Investigate the code handling the /btw command and debug view toggle to identify where the ephemeral context is being improperly restored or re-triggered.
  • Verify that the main agent state is not inadvertently storing or replaying the /btw query after debug view is toggled.
  • Check the UI/debug layer for any potential issues that might cause the last command (/btw query) to be re-triggered after exiting debug view.
  • Consider adding a flag or mechanism to explicitly mark /btw queries as ephemeral and prevent them from being stored in conversation history or re-run after debug view is toggled.

Example

No specific code snippet can be provided without access to the actual codebase, but the fix might involve modifying the handling of /btw queries to include a flag or attribute that prevents them from being stored or re-run, e.g., isEphemeral: true.

Notes

The exact cause of the issue is uncertain without further investigation, and the provided information suggests that it might be related to either the improper separation of ephemeral context and main agent state or the UI/debug layer re-triggering the last command.

Recommendation

Apply a workaround by modifying the code to properly handle ephemeral /btw context, as upgrading to a fixed version is not implied in the issue. This is because the issue seems to be related to the specific implementation of the /btw command and debug view toggle, rather than a known bug in a specific version.

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