Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped client-runtime optimization that reuses pending-request selector results only for provably unrelated updates, with fallback behavior preserved for request-relevant changes. The accompanying tests cover the selector’s update, reload, reorder, and lifecycle cases, and no product defaults or user-facing capabilities change. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Cache behavior and validation packages/client-runtime/src/state/threadDetail.ts, packages/client-runtime/src/state/threadDetail.test.ts |
The atom reuses its selection when request references are unchanged and items are unchanged or have one replacement between non-request items. Tests cover request and item changes, skipped updates, projection resets, and reloads. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Refactor
Suggested reviewers: juliusmarminge
Merge Risk: 
Minimal · up to 3310b
-
No issue requiring a change before merge is identified; complete normal checks before merging.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description follows the required Problem, Change, Scope and approval, and Verification sections. It explains the issue, implementation, scope, related work, test evidence, measured results, and checks not performed.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
…stream pingdotgg#25473) Cherry-picked from pingdotgg#25473 (test imports merged by hand) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
A selected mobile thread rescans every turn item and pending request when an unrelated assistant item changes. With a pending approval and question, 100 replacements in a 1,000-row fixture perform 199,600 irrelevant item-type reads and 200 request-status reads, even though the selected requests stay unchanged.
Change
Reuse the selection when the raw request array is unchanged and the turn-item array is identical, or the existing exact-pair replacement hint proves that both replaced rows are unrelated to requests. Relevant request changes, snapshots, skipped updates, history changes and reorders keep the existing full-selection fallback. Null clears both caches.
Scope and approval
This is a focused optimization of redundant selector work, with no change to request behavior or product defaults. The direct consumer is mobile; the web request hook derives separately. Audit tracking: #189.
Separate work in #23855 changes settled-question and queue semantics. This PR preserves current main. If those changes land together, retain that PR's expanded question filter and queue regression tests.
Verification
threadDetail.test.tsandthreadRequests.test.ts.CI=true vp run check:changed 071239804e375078dd3fae3b14704b4def57e048: exit 0 (format, lint, knip, seven affected package typechecks and 22 adjacent tests pass).These are deterministic selector-operation counts. No device request-card/pre-send smoke, heap profiling, physical energy or battery-life measurement was run. No UI behavior changes are claimed.
Created with GPT-6.1 Sol/high in the Codex harness through T3 Code; reviewed in a separate GPT-6.1 Sol/high session.