Rename stopped sessions with the agent-name record too, so resume draws it - #56
Merged
Conversation
…ws it Claude keeps a session's name in two transcript records and a runtime rename writes them as a pair: custom-title is the session title (the resume picker, hook-input session_title), agent-name is what the badge in the prompt box draws. Renaming a stopped session appended only custom-title, so a resumed session showed its old name — and the sync plugin could not heal it, because the title it compares against the window was already the new name, so it never pushed the runtime rename that rewrites the agent name. Only renaming the tab a second time broke the tie. Append the same pair Claude writes and the resumed badge is right from the first frame, verified live under tu.
Appending straight onto an unterminated last line would fuse the custom-title record into it — both stop parsing — while the agent-name record still lands, recreating the title/badge disagreement the pair exists to prevent. Lead with a newline when the file does not end in one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Rename a stopped Claude session in forestui, resume it: the tmux tab carries the new name, but the Claude prompt-box badge keeps the old one — and no amount of chatting realigns them. Only renaming the tab a second time fixed it.
Root cause
Claude Code keeps a session's name in two transcript records, written as a pair by every runtime rename (
/rename, or the sync plugin'ssessionTitlepush):custom-title— the session title: the resume picker, hook-inputsession_titleagent-name— what the badge in the prompt box drawsforestui's stopped-session rename appended only
custom-title. On resume the title was right everywhere except the visible badge — and the sync plugin could not heal it, because the title it compares against the window name was already the new name, so all three strings it can see agreed and it never pushed the runtime rename that rewrites the agent name. A second tab rename broke the tie (window != @claude_synced_name), which is why that worked.Diagnosed from a real repro transcript: forestui's appended record is identifiable by serde_json's alphabetical key order, and the working second rename is the only one followed by an
agent-namerecord.The fix
rename_transcriptnow appends the samecustom-title+agent-namepair Claude writes, so a resumed session draws the new name from its first frame.Testing
make checkandmake check-shippedgreen.claude:demo→ stop → rename in forestui toclaude:demoRENAMED→ resume: badge and tab both show the new name immediately, stable across turns; a subsequent tab rename still syncs to the session on the next turn, so the normal two-way path is unregressed.Sessions renamed-while-stopped before this fix heal on their next tab rename, as before; nothing to migrate.