[Bug] /clear command processes asynchronously, accepting input before completion

Status Fixed / completed
Reported on v2.1.112
Maintainer reply None cached
Activity 4 comments · opened Apr 19, 2026 · closed Apr 20, 2026

Bug Description
I did /clear then pasted some work. I got a note:
Session cleared. What would you like to work on?

It is as if the /clear had not worked until after I had pasted the text even though I see clearly the note for the initial clear
/clear
⎿  (no content)

Environment Info

  • Platform: linux
  • Terminal: kitty
  • Version: 2.1.112
  • Feedback ID: 8c955e27-a8b5-41e4-a5ab-51834ab03fe6

Errors

[{"error":"MaxFileReadTokenExceededError: File content (25575 tokens) exceeds maximum allowed tokens (25000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at fM7 (/$bunfs/root/src/entrypoints/cli.js:4720:12550)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-17T03:45:50.195Z"},{"error":"Error: EISDIR: illegal operation on a directory, read '/francisco-home/srht/pureawesome'\n    at X_H (/$bunfs/root/src/entrypoints/cli.js:1564:144)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-18T03:58:26.340Z"},{"error":"Error: File does not exist. Note: your current working directory is /francisco-home/srht/pureawesome.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4729:7630)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-19T03:38:42.399Z"}]

View original on GitHub ↗

4 Comments

github-actions[bot] · 5 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/32871

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

0xbrainkid · 5 months ago

This is a boundary-race bug in the /clear lifecycle: the UI emits the semantic completion message ("Session cleared. What would you like to work on?") before the state transition has fully completed, so the user can paste input into what looks like a fresh session while stale context is still being cleared asynchronously.

That is the worst possible order for a destructive/reset operation:

  • user sees completion signal
  • user reasonably trusts it and pastes new work
  • old state cleanup finishes later
  • new input is now entangled with a half-cleared session

In other words, /clear currently behaves more like "clear requested" than "clear completed," but the UI text promises the latter.

This is the same family as several other timing/continuity issues we have seen: visible state advances before hidden state has actually caught up.

The invariant should be simple: /clear must be blocking from the user's perspective. No new input should be accepted until the clear operation has actually committed and the session is truly empty.

If the implementation needs to remain async internally, then the UI should expose that honestly:

  • "Clearing session..." while the transition is in progress
  • input disabled or queued until completion
  • only then show "Session cleared"

Right now the product is violating its own completion signal, which is why the user experience feels like the clear did not really happen when promised.

francisco1844 · 5 months ago

This seems to be duplicate of issues/32871. Closing this one.

github-actions[bot] · 5 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.