Repository navigation
fix(chat): keep the Claude model and effort set before the newest page (#2303) - #2319
Conversation
#2303) When the newest transcript page starts past the 64 KiB metadata head, the head is rebuilt from the setting records the history scan kept, and the scan kept none for Claude: an answer's model and effort, or /model and /effort output, that was neither in the head nor on the page was lost and the pill went back to the head's older model. The scan now keeps, per field, each value the Claude records took since the last clear (one run per value), and the head replays the latest one before the page that a /rewind fork has not left off the branch, as a small synthesized line. claudeSetting() is shared with parseConversationMetadata so both read the same records. Closes #2303
…nd a long answer's Review of #2303's fix: merging records of the same value into one run let a value every rewind left off the branch come back when a visible record lay between them; each setting record now counts by its own bytes. A record too long for the branch to follow (over 1 MiB without its pictures) still names its model and effort.
…etting Review of #2303's fix: the head walked back one setting record at a time and sorted the hidden ranges again for each, so a newest-page read after many rewound answers blocked the event loop for up to 1.5 s. The ranges are merged once per read and a hidden range is skipped with a binary search.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 31 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merging 26f0918 (closes #2303). The chat's model and effort pill could show the wrong values once a long Claude transcript paged past its setting records, or after a |
Summary
In a Claude Code pane, the composer's model pill and effort went back to an older model once the record that set the current one was neither in the transcript's first 64 KiB nor on the newest page: for example after a run of bash-mode commands, or a long tool output, with no answer after the change. This happened both for the model an answer names and for the
/model//effortoutput read since #2305.Closes #2303.
Cause
When the newest page starts past
METADATA_HEAD_BYTES,metadataHead()rebuilds the metadata from the head plus the setting records the history scan kept.applyHistoryBoundarySteps()keptmodel_change/thinking_level_changeand Copilot's settings but no Claude record, so a Claude setting between the head and the page was lost.Fix
claudeSetting(entry)(server/conversation-metadata.ts) is what one Claude record sets: an answer'smessage.modelandeffort(an explicitnulltoo), or a/model//effortanswer.parseConversationMetadatanow uses it, so the scan and the page read the same records the same way.followClaudeBranchreturns the record it parsed, and the history scan keeps every Claude record that set the model or effort since the last clear, with where it lies and a small line that sets the value again.metadataHead()replays each field's latest record before the page that a/rewindfork (stream.hidden, including a slash-command echo fork) has not left off the branch, when the head does not hold it whole. A clear resets what is kept.Tests
server/chat-history.test.ts: the model and effort an answer set, and those/model+/effortset, past the head stay when 130 answerless prompts follow, on warm, cold and incremental reads; a later answer wins until a rewind leaves it off the branch; a clear forgets them. A second test covers a value whose every record two rewinds left off the branch (with a visible record between them) and an answer over 1 MiB. All of these fail on main 010a44d; removing the fork check or the replay fails them too.transcriptPage("claude-transcript", …): main printsclaude-opus-5-5/mediumon the warm and cold read, this branchclaude-sonnet-5-5/xhigh(the whole-file parse).bun run check fastgreen on 26f0918 (8428 pass, 0 fail).Reviews
Known limits