Chief chat (Mac Home): bound the loaded window as replies arrive

AZ
1d ago
+195-1

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.

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
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 SidebarListStillTests to use the renamed AvatarMotion.thinking, which had left the MessagesLab test package uncompilable.