Rename a loop when its session is renamed (#261) - #263
Open
scgopi wants to merge 1 commit into
Open
Conversation
`/rename` inside a Claude Code session changed the session's name and left the loop's card showing the title it was created with. The title is the one field a loop is expected to outgrow — written before the work exists — so the two disagreed exactly when the human had just said what the loop is. Claude Code writes the answer down: a standalone `custom-title` record, re-emitted at every checkpoint, in the transcript graphcode already knows how to find. Read on the presence poll and applied through the same `renameNode` a human's rename goes through. Three things this is careful about: - **`custom-title` only.** Every session also carries `agent-name`, holding a name the CLI assigned itself (`angleReuse2`), present in sessions nobody renamed. Reading that would retitle most of a graph to strings no human typed. - **Once per change, not once per sight.** `LoopNode.sessionTitle` records the last observed session name, so a card renamed from the sidebar afterwards keeps its name instead of being overwritten fifteen seconds later. It is persisted, so a daemon restart cannot make an applied rename look new. - **Cost.** The summary rail is off by default, so nothing read transcripts on a default install; ungated this would have added a 512KB tail read per loop per poll to every install. Gated on `TranscriptFreshness` — its own instance, since `hasChanged` is consuming — a quiet loop costs one stat. Remote loops are left out deliberately: reading one costs an ssh probe per node per poll, which is worth it for a rail that moves every few seconds and not for a name that changes when somebody types six characters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011hEyiK8W9XW4Tq6je98kTX
Owner
Author
|
Don't merge the PR yet, need to see if it is low risk |
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.
Fixes #261.
Renaming a session from inside it (
/rename hello) left the loop's card showing whatever title it was created with. The title is the one field a loop is expected to outgrow — it is written before the work exists — so the two names disagreed at exactly the moment the human had just said what the loop is.Where the answer comes from
Claude Code writes it down, in the transcript GraphCode already knows how to find:
{"type":"custom-title","customTitle":"hello","sessionId":"a825abc7-…"}It is a standalone record, re-emitted at every checkpoint rather than once at the rename, so a tail read always carries the current one and the last one wins. Read on the existing 15s presence poll, applied through the same
renameNodea human's rename goes through — so a blank title is refused and everything a rename deliberately leaves alone (id, session, edges, layout) stays left alone.Three things this is careful about
custom-titleonly. Every session also carries anagent-namerecord, and it is not the same thing: it holds a name the CLI assigned itself (angleReuse2) and is present in sessions nobody has renamed. Reading it would retitle most of a graph to strings no human ever typed — a far worse bug than the one being fixed.anAgentNameIsNotARenamepins this.Once per change, not once per sight.
LoopNode.sessionTitlerecords what the session was last observed to be called, which is not what the node is called — the two part company the moment somebody renames the card from the sidebar, and that gap is what keeps the card's name theirs instead of having it overwritten on the next tick. It is persisted for the same reason: a daemon restart must not make an applied rename look new again.Cost.
summarisesLoopsis off by default, so on a default install nothing was reading transcripts at all; ungated, this would have added a 512KB tail read per loop every fifteen seconds to every install there is, to re-read a name that changes when a human types six characters. Gated onTranscriptFreshness— its own instance, notshared, becausehasChangedis consuming and the two readers would otherwise take turns to work — a quiet loop costs onestat.Deliberately out of scope
nilrather than a guess.Regression surface
sessionTitlechange-detection —aRenameFromTheSidebarSurvivesTheNextPollagent-nameanAgentNameIsNotARenamethePollMustNotPersistTheGraphstill passesTranscriptFreshnessinstance;SummaryRailTestsunchanged and greendecodeIfPresent, matching every other field onLoopNodeVerification
xcodebuild testgraphcode/graphcoded/graphcode-clibuildsswiftlint lintswift format lint --strict🤖 Generated with Claude Code
https://claude.ai/code/session_011hEyiK8W9XW4Tq6je98kTX