perf(web): reuse work log rows during streaming - #8006
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
ApprovabilityVerdict: Skipped Macroscope did not run approvability analysis for this PR. Macroscope could not determine whether this PR modifies its approvability configuration, so the PR was not approved automatically. A PR that may change the rules that govern approval is never approved automatically. |
## What's Changed * feat(web): redesign skills in `$` menu and in `/` menu by @extoci in pingdotgg/t3code#8009 * fix(web): restore right panel toggle clicks after closing on desktop by @UtkarshUsername in pingdotgg/t3code#8016 * fix(web): keep server update banners flush with the composer by @t3dotgg in pingdotgg/t3code#8000 * perf(web): reuse work log rows during streaming by @Bil0000 in pingdotgg/t3code#8006 * fix(web): keep provider badge legible in dark themes by @RakshithBhat03 in pingdotgg/t3code#7968 **Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260823.1170...v0.0.34-nightly.20260823.1171 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260823.1171
Long threads rebuild their full work log for every streamed activity update. That reparsed unchanged activity payloads, cloned every output row, and changed row identities even when the source activities had not changed.
This change caches each immutable activity's derived work-log entry in a
WeakMap, keeps collapse metadata private with a symbol, and returns collapsed entries without a second cloning pass. Unchanged activity rows now keep stable identities across append updates.Benchmark
Verification
pnpm --filter @t3tools/web typecheckvp lint apps/web/src/session-logic.ts apps/web/src/session-logic.test.ts --report-unused-disable-directivesvp fmt --check apps/web/src/session-logic.ts apps/web/src/session-logic.test.tsvp test run src/session-logic.test.ts --project unit(77 tests)vp test run src/components/chat/MessagesTimeline.logic.test.ts src/components/chat/MessagesTimeline.test.tsx --project unit(77 tests)Note
Memoize
DerivedWorkLogEntryvia WeakMap to reuse work log rows during streamingtoDerivedWorkLogEntryin a module-levelWeakMapkeyed by activity object, so repeated derivations for the same activity return the same entry instancecollapseKeyto a symbol-keyed property[workLogCollapseKey], eliminating the final mapping step inderiveWorkLogEntriesthat previously stripped internal fieldsactivityKindtosourceActivityKindonDerivedWorkLogEntry; updates all readers intoolLifecycleCollapseMapKey,collapseDerivedWorkLogEntries,shouldCollapseToolLifecycleEntries, andderiveToolLifecycleCollapseKeyDerivedWorkLogEntryno longer exposesactivityKindorcollapseKey; any external reader of these fields must switch tosourceActivityKindand[workLogCollapseKey]Macroscope summarized 647e760.