fix(restart): preserve displayName across respawn - #61
Merged
Conversation
pty restart / attach-restart / interactive doRestart re-spawned the daemon from stored metadata but dropped displayName, so a restarted session read as its raw id (e.g. claude-203827) instead of its name — breaking naming and the TUI peek. Forward meta.displayName at all three restart call sites, matching the existing `run -a` re-create path. Tags were already carried. Adds a driven regression test that fails without the fix.
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.
Problem
pty restart(and the other restart paths) re-spawned the session daemon from stored metadata but droppeddisplayName. A restarted session came back reading as its raw id (e.g.claude-203827) instead of its name — breaking session naming and the TUI peek. Tags were already preserved; only the display name was lost.Fix
Forward
meta.displayNameat all three restart call sites, matching the existingrun -are-create path (cli.ts~L1048):cmdRestart—pty restart <ref>handleDeadSession—pty attach -r/ restart-on-dead promptdoRestart— Enter on a dead session in the pickerEach uses the same guarded spread:
...(meta.displayName ? { displayName: meta.displayName } : {}).Test
Adds a driven regression test in
tests/display-name.test.tsthat creates a session with--name "My Service" --tag role=web, restarts it, and asserts bothdisplayNameand tags survive. Verified it fails without the fix (expected undefined to be 'My Service') and passes with it.display-namesuite: 27/27 greentuisuite: 29/29 greenrestartofid=web1 name='Web Frontend' tag role=webkeeps both name and tags, status back to running.Notes
Independent bugfix targeting
main(the bug is present on bothmainand the held reboot#60branch). Can be cherry-picked into the reboot cutover as needed.