Chief chat (Mac Home): bound the loaded window as replies arrive
Summary
The Mac Chief chat (Home: HomeStore โ TranscriptWindow โ MessagesLabHomeView) loaded every message that arrived while it was open and never dropped one. TranscriptWindow.apply only appends. Each change rebuilds the conversation's timeline from the whole window, so a Chief chat left open for days gets slower with every reply.
Now, when the reader rests on the newest message (pinnedToBottom && atNewest) and the window holds more than 1,500 messages, HomeProjection schedules HomeStore.trimIfResting for the next display frame. It keeps the newest 1,000. The cut moves up to keep:
- every message a kept message answers (
replyTo) or threads under (threadRoot) - the open thread, its drill path and the composer's reply target
Nothing is trimmed while an older page loads. The dropped history pages back in when the reader scrolls up (reachedStart goes false).
This is the real Mac half of the Chief chat window bound. #34493 changed MacConversationViewController, which only the conversation lab app uses, not the cmux-next Mac app. The iOS half is on feat-cmux-next (de82e16..7927578).
It also carries a one-word base fix: SidebarListStillTests used AvatarMotion.working, renamed to .thinking in #34416. That left the MessagesLab test package not compiling.
Changelog
Fixed: A Chief chat left open on the Mac no longer slows down as replies keep arriving.
Tests
HomeWindowBoundTests drives the real MessagesLabHomeView over a real HomeStore on the mock owner (HomeChatRig). It posts 1,600 Chief replies to an open chat resting at the newest message, in 32 batches with a display frame after each.
- Red, test only, 9ab0b59707e08a5e42aa4bbebc5a46ff88bcdee7 (fleet step 72bfc7b9442f49ace2bc2801): fails,
loaded โ 1640 <= 1500. - Green, head 4f678809c6e84b0ff17c0c7efba11453bee47df7 (step 04a66d08d5e7db9e5a68700f): passes, along with DragWhileStreamingTests, HomeChiefRetryTests and HomeComposerSendButtonTests.
TranscriptWindowTrimTests(keeps the newest, keeps answered, threaded and held messages, pages back in), HomeTranscriptPagerTests and StoreKeptTranscriptTests: pass.- Mac app fleet build e00d0dce1e20c5062a1b8e1a: passed, tag
chief-window-home.
Capture
recordsTheLoadedWindowAsRepliesArrive renders the real view after each batch: before the fix the count climbs to 1,640; after it, it trims to 1,050 at batch 31 and ends at 1,100, still pinned at reply 1,600. The video and stills are in the report.
Observed / Not run
Observed: the runs above. Not run: a Chief chat left open for days in the real app against a live Chief.
HOLD: user dogfoods before merge.
๐ค Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith ยท Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
The Mac Chief chat left open at the newest message no longer grows without bound: the loaded window is trimmed while replies keep arriving, so each arrival stops rebuilding the whole timeline.
- Above 1,500 loaded messages, the next display frame trims the window to the newest 1,000.
- The cut keeps messages a kept one answers or threads under, plus the open thread's path and the composer's reply target, but never holds the window above 1,500, and re-reads agent runs for the window left.
- Dropped history pages back in when the reader scrolls up; nothing is trimmed while an older page is loading.
- Also fixes
SidebarListStillTeststo use the renamedAvatarMotion.thinking, which had left the MessagesLab test package uncompilable.