Skip to content

fix(band): show the level again after /clear and /resume - #1161

Merged
DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
timofeevAV:fix/band-level-after-clear
Oct 17, 2026
Merged

DietrichGebert merged 2 commits into
DietrichGebert:mainfrom
timofeevAV:fix/band-level-after-clear

Conversation

@timofeevAV

@timofeevAV timofeevAV commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1160

Cause: /clear and /resume inside a session end it (session.end with reason clear or resume) and go on under another session id, with an empty band state and no session.start. So the band showed off until the first turn ended. Details in #1160.

Fix: the setup in the session.start hook moves into start($). A command.run hook runs it again after any command that left the session on another id, so there is no list of commands to keep up to date.

Tests

  • New: after /clear … and after /resume … in tests/band.test.tsx. Each runs /help first, which must not set the band up. Mutations: with the hook removed both fail; with the session-id check removed both fail on /help; a clear-only hook fails the /resume one.
  • claude plugin test .: 27/27. npm test: 144 + 30 pass (with pandas installed, as in CI). check-rule-copies and check-versions pass.
  • Real sessions (Claude Code 2.1.302, this branch via --plugin-dir, the installed plugin disabled, driven by expect), checked against what the band draws and its state:
    • /clear: off for one frame, then full. Unpatched 5.3.2 stays on off.
    • /resume <id> and /resume from the picker: the band is set up under the resumed id and shows full. Unpatched it showed off. With the picker, command.run settles only after the pick.
    • /compact keeps the session id and the band state (level, turns, cost); no change needed.
    • claude --resume <id> raises session.start; no change needed.

Known limit: on clear, ponytail-activate.js resets the flag to the default level, and it can finish after this hook. If the level was switched before /clear, the band can show the old level until the first turn ends. The one later point, classic.SessionStart, is skipped for plugins in a real session (see #1160). It is marked as a shortcut: in the code. On /resume the SessionStart hooks finish before the command does, so there is no such race.

/clear ends the session and goes on under a new session id with an empty
band state, and raises no session.start, so the band showed "off" (and lost
the project, the cost baseline and the task row) until the first turn ended.

Run the session setup again from a command.run hook on /clear, once the
command has run and the new session is in place.
/resume inside a session ends it with reason resume and goes on under the
resumed session's id, again with an empty band state and no session.start.
Run the setup after any command that moved the session to another id, so
/clear, /resume (by id or from the picker) and a cancelled resume are all
handled without a list of commands.
@timofeevAV timofeevAV changed the title fix(band): show the level again after /clear fix(band): show the level again after /clear and /resume Oct 17, 2026
@DietrichGebert

Copy link
Copy Markdown
Owner

Thanks! Tested it, works great. Merged, will be in the next release.

@DietrichGebert
DietrichGebert merged commit f6f6ab3 into DietrichGebert:main Oct 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Band shows off after /clear or /resume while ponytail is on

2 participants