Repository navigation
perf(mobile): omit duplicated turn items from bounded thread snapshots - #15385
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
3295b30 to
918cf5f
Compare
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused, backward-compatible snapshot transport optimization: opted-in clients receive a smaller payload and restore the unchanged projection before application state uses it. Legacy clients and servers retain the existing representation, with coverage for HTTP, WebSocket, forked histories, and cache/reducer restoration. You can add or adjust custom eligibility rules. Learn more. |
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds compact bounded snapshots that omit eligible local visible turn items and mark the omission. HTTP and WebSocket paths support opt-in negotiation. Client code restores omitted items before using the projection. ChangesCompact bounded snapshots
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant Client as fetchEnvironmentBoundedThreadSnapshot
participant Endpoint as threadBoundedSnapshot
participant Builder as boundedSnapshotResponseFields
participant Restorer as boundedSnapshotProjection
Client->>Endpoint: Request compactTurnItems=1
Endpoint->>Builder: Build compact bounded response
Builder-->>Endpoint: Projection and omission marker
Endpoint-->>Client: Bounded snapshot response
Client->>Restorer: Restore marked projection
Restorer-->>Client: Projection with local visible items
Merge Risk: ⚪ Minimal · up to The compact snapshot path is connected end to end, with no identified issue requiring a fix before merge. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, change, compatibility behavior, measurements, and verification. It does not include the required Scope and approval information, such as a triaged issue or maintainer approval, or an explanation of why the change qualifies for an exception. Full details: Docstring CoverageExplanation Docstring coverage is 47.06% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 14 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
b46d7c5 to
2d10c37
Compare
Bounded thread snapshots sent every local visible row's item twice: once in visibleTurnItems and again in projection.turnItems. Clients can now opt in (compactTurnItems=1 over HTTP, acceptCompactTurnItems on the socket) to a snapshot marked turnItemsOmitLocalVisible that drops those leading entries. The client restores them with boundedSnapshotProjection right after decode, so reducers, caches and live events still see the full list. Older clients and servers keep the unchanged representation. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2d10c37 to
38b945b
Compare
## What's Changed * chore(review): remove the custom Approvability check by @esthor in pingdotgg/t3code#17018 * perf(mobile): show the cached thread list sooner and stop the freeze after it by @juliusmarminge in pingdotgg/t3code#16713 * fix(server): replaying a command no longer freezes the server by @SunkenInTime in pingdotgg/t3code#17041 * fix(server): opening a long thread no longer blocks the server for a second by @SunkenInTime in pingdotgg/t3code#17029 * fix(server,web,mobile): thread links reference the thread id, not a baked title by @juliusmarminge in pingdotgg/t3code#17017 * fix(web): messages with quotes or links no longer collapse when short by @flamboh in pingdotgg/t3code#16624 * refactor(web): PR loading skeleton shares the detail panel's layout by @flamboh in pingdotgg/t3code#15583 * fix(web): PR file headers keep the file name in narrow panels by @flamboh in pingdotgg/t3code#15562 * fix(web): PR timeline no longer shifts when its scrollbar appears by @flamboh in pingdotgg/t3code#15588 * fix(server): held queued wakes no longer keep delegated tasks running by @juliusmarminge in pingdotgg/t3code#17028 * fix(server): a message sent during a rollback no longer undoes it by @t3dotgg in pingdotgg/t3code#17079 * fix(web): PR file stats ignore the hide-whitespace toggle by @flamboh in pingdotgg/t3code#16162 * perf(mobile): omit duplicated turn items from bounded thread snapshots by @juliusmarminge in pingdotgg/t3code#15385 * perf(mobile): pause elapsed-time timers on hidden thread screens by @juliusmarminge in pingdotgg/t3code#15397 * fix(mobile): pause hidden home thread list updates by @juliusmarminge in pingdotgg/t3code#15705 * fix(mobile): restore file viewer insets and glass header by @juliusmarminge in pingdotgg/t3code#17073 * fix(web): PR code toolbar no longer overlaps in narrow panels by @flamboh in pingdotgg/t3code#15561 * fix(web): PR commit menu no longer stretches across the window by @flamboh in pingdotgg/t3code#15560 * fix(web): command palette scrollbar no longer clipped at the top by @flamboh in pingdotgg/t3code#17035 * fix(web): Usage breadcrumb stays centered on small viewports by @flamboh in pingdotgg/t3code#15552 * fix(mobile): stop refreshing Git status on streamed thread updates by @juliusmarminge in pingdotgg/t3code#15893 * fix(mobile): skip move indexes for empty and single-thread sections by @juliusmarminge in pingdotgg/t3code#16115 * perf(mobile): reuse encoded rows in shell cache saves by @juliusmarminge in pingdotgg/t3code#16129 * perf(mobile): skip showcase subscriptions in normal builds by @juliusmarminge in pingdotgg/t3code#16131 * perf(mobile): remove unused Home project sorting by @juliusmarminge in pingdotgg/t3code#16177 * perf(mobile): reduce move-menu index allocations by @juliusmarminge in pingdotgg/t3code#16256 * perf(mobile): skip impossible thread-key lookups by @juliusmarminge in pingdotgg/t3code#16263 * fix(mobile): collect UI runtime garbage on iOS memory warnings by @juliusmarminge in pingdotgg/t3code#16296 * fix(mobile): stop Git sheet refresh loop by @juliusmarminge in pingdotgg/t3code#16305 * fix(mobile): refresh Git status after reconnect by @juliusmarminge in pingdotgg/t3code#16329 * fix(mobile): update the iOS Git header menu when status changes by @juliusmarminge in pingdotgg/t3code#16330 * perf(mobile): reuse the settled sort when settled rows are unchanged by @juliusmarminge in pingdotgg/t3code#16369 * perf(mobile): highlight source files in small batches that keep grammar state by @juliusmarminge in pingdotgg/t3code#16729 * feat(web): quote chips show what you said about the quote by @flamboh in pingdotgg/t3code#15703 * feat(web): projectless threads show their machine in the sidebar by @flamboh in pingdotgg/t3code#17022 * fix(lineage): keep agent effort and speed after completion by @Bil0000 in pingdotgg/t3code#16925 * fix(mobile): align diff scrolling with glass headers by @juliusmarminge in pingdotgg/t3code#17085 * fix(web): workspace page headers can no longer grow past the top-bar height by @maria-rcks in pingdotgg/t3code#17086 * feat(mobile): redesign the Add environment sheet by @juliusmarminge in pingdotgg/t3code#17092 **Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261008.2801...v0.0.46-nightly.20261008.2813 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261008.2813
## What's Changed * chore(review): remove the custom Approvability check by @esthor in pingdotgg/t3code#17018 * perf(mobile): show the cached thread list sooner and stop the freeze after it by @juliusmarminge in pingdotgg/t3code#16713 * fix(server): replaying a command no longer freezes the server by @SunkenInTime in pingdotgg/t3code#17041 * fix(server): opening a long thread no longer blocks the server for a second by @SunkenInTime in pingdotgg/t3code#17029 * fix(server,web,mobile): thread links reference the thread id, not a baked title by @juliusmarminge in pingdotgg/t3code#17017 * fix(web): messages with quotes or links no longer collapse when short by @flamboh in pingdotgg/t3code#16624 * refactor(web): PR loading skeleton shares the detail panel's layout by @flamboh in pingdotgg/t3code#15583 * fix(web): PR file headers keep the file name in narrow panels by @flamboh in pingdotgg/t3code#15562 * fix(web): PR timeline no longer shifts when its scrollbar appears by @flamboh in pingdotgg/t3code#15588 * fix(server): held queued wakes no longer keep delegated tasks running by @juliusmarminge in pingdotgg/t3code#17028 * fix(server): a message sent during a rollback no longer undoes it by @t3dotgg in pingdotgg/t3code#17079 * fix(web): PR file stats ignore the hide-whitespace toggle by @flamboh in pingdotgg/t3code#16162 * perf(mobile): omit duplicated turn items from bounded thread snapshots by @juliusmarminge in pingdotgg/t3code#15385 * perf(mobile): pause elapsed-time timers on hidden thread screens by @juliusmarminge in pingdotgg/t3code#15397 * fix(mobile): pause hidden home thread list updates by @juliusmarminge in pingdotgg/t3code#15705 * fix(mobile): restore file viewer insets and glass header by @juliusmarminge in pingdotgg/t3code#17073 * fix(web): PR code toolbar no longer overlaps in narrow panels by @flamboh in pingdotgg/t3code#15561 * fix(web): PR commit menu no longer stretches across the window by @flamboh in pingdotgg/t3code#15560 * fix(web): command palette scrollbar no longer clipped at the top by @flamboh in pingdotgg/t3code#17035 * fix(web): Usage breadcrumb stays centered on small viewports by @flamboh in pingdotgg/t3code#15552 * fix(mobile): stop refreshing Git status on streamed thread updates by @juliusmarminge in pingdotgg/t3code#15893 * fix(mobile): skip move indexes for empty and single-thread sections by @juliusmarminge in pingdotgg/t3code#16115 * perf(mobile): reuse encoded rows in shell cache saves by @juliusmarminge in pingdotgg/t3code#16129 * perf(mobile): skip showcase subscriptions in normal builds by @juliusmarminge in pingdotgg/t3code#16131 * perf(mobile): remove unused Home project sorting by @juliusmarminge in pingdotgg/t3code#16177 * perf(mobile): reduce move-menu index allocations by @juliusmarminge in pingdotgg/t3code#16256 * perf(mobile): skip impossible thread-key lookups by @juliusmarminge in pingdotgg/t3code#16263 * fix(mobile): collect UI runtime garbage on iOS memory warnings by @juliusmarminge in pingdotgg/t3code#16296 * fix(mobile): stop Git sheet refresh loop by @juliusmarminge in pingdotgg/t3code#16305 * fix(mobile): refresh Git status after reconnect by @juliusmarminge in pingdotgg/t3code#16329 * fix(mobile): update the iOS Git header menu when status changes by @juliusmarminge in pingdotgg/t3code#16330 * perf(mobile): reuse the settled sort when settled rows are unchanged by @juliusmarminge in pingdotgg/t3code#16369 * perf(mobile): highlight source files in small batches that keep grammar state by @juliusmarminge in pingdotgg/t3code#16729 * feat(web): quote chips show what you said about the quote by @flamboh in pingdotgg/t3code#15703 * feat(web): projectless threads show their machine in the sidebar by @flamboh in pingdotgg/t3code#17022 * fix(lineage): keep agent effort and speed after completion by @Bil0000 in pingdotgg/t3code#16925 * fix(mobile): align diff scrolling with glass headers by @juliusmarminge in pingdotgg/t3code#17085 * fix(web): workspace page headers can no longer grow past the top-bar height by @maria-rcks in pingdotgg/t3code#17086 * feat(mobile): redesign the Add environment sheet by @juliusmarminge in pingdotgg/t3code#17092 **Full Changelog**: pingdotgg/t3code@v0.0.46-nightly.20261008.2801...v0.0.46-nightly.20261008.2813 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.46-nightly.20261008.2813
Stacked on #15248.
Problem
A bounded thread snapshot sends each local visible row's item twice: once in
visibleTurnItemsand again inprojection.turnItems. That duplication makes up roughly 30–45% of the raw JSON a phone downloads, parses, and decodes when it opens a thread.Fix
Clients can now opt in to a compact snapshot:
compactTurnItems=1onGET /api/orchestration/threads/:id/bounded, oracceptCompactTurnItemson the thread subscription. The server then drops the leadingturnItemsentries that repeat local visible rows and marks the snapshotturnItemsOmitLocalVisible. The client rebuilds them withboundedSnapshotProjectionright after decode, so reducers, the cache, and live events still see the full list.turnItemsare exactly the local visible rows' items (same object). Otherwise it sends the unchanged snapshot with no marker.Measurements
Synthetic fixtures seeded through the real
EventSinkinto a scratch DB, run against this branch on nucbox-1 (Node 24, x86_64), medians of 25 iterations. "Before" is the opted-out response, which is byte-identical to the base branch. "After" is the opted-in response. Node parse+decode isJSON.parseplus schema decode. Restore addsboundedSnapshotProjection. Every fixture round-trips to the identical projection after restore.Limits:
agent-turns, br output is 6% larger.Evidence (synthetic data only): script, results and log (tgz) · README with reproduction steps · results.json
Verification
Focused tests and typechecks passed for the touched packages: shared (6), client-runtime (49), contracts (34), server (44), projection (5). They cover the omit/restore round-trip, the identity guard, the HTTP and WS opt-in in both directions across versions, and client restore before reducers and the cache.
Implemented by Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code
Native runtime follow-up
Alternating compact off/on in the iOS 27 simulator, using the matching native build and a Hermes debug bundle against the isolated nucbox fixture server over Tailscale. Three samples per mode per fixture, JS reload each time and synthetic-thread cache bypassed.
The endpoint is the populated React feed's layout-effect commit, not a confirmed displayed frame. Small sample sizes and overlapping results make these preliminary; they are not physical-device, release-build, 1.4 comparison, or battery measurements. Separate Hermes captures show substantial React opening work but only 17 ms sampled non-idle JS over 15 seconds on a settled thread with one connected environment.
Native measurements, diagnostic patch, automation, and method. Temporary instrumentation was removed after measurement.