Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Streamed updates avoid rescanning thread history for Stop state when only a non-interrupt item changes. Relevant changes still trigger full derivation, keeping this a bounded client-side performance optimization. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Made with GPT-6.1 Sol via Codex in T3 Code.
93bc8a5 to
f629240
Compare
Problem
While a thread is open, every text or tool update in a running thread rescans its turn items to work out Stop state. Those updates almost never affect Stop, so the scan repeats and returns the same value.
Change
runStopAtomreranpresentRunStopwhenever theturnItemsarray changed.presentRunStoponly reads runs and interrupt items. The atom now skips it when runs are unchanged and the reducer's replacement hint shows one replaced item, with neither the old nor the new item an interrupt type. A skip still advances the stored input. Inserts, skipped or batched updates, snapshots, and run changes carry no usable hint, so they derive in full. The change is inclient-runtime, so web and mobile share it. Providers are untouched. I added no interrupt index and no timers, and run selection is unchanged.Scope and approval
This qualifies for the small, focused fix exception in CONTRIBUTING.md. There is no feature, product default, or contract change.
Verification
vp test runonthreadDetail.test.tsandthreadExecution.test.ts: 43 passed after rebasing onto upstream/main61c3794c32.vp run check:changedpassed.does not rescan history for consecutive replacements unrelated to Stopfails without the fix. With 99 history items and two text updates,runIdreads went from 198 to 0.A second test compares the atom with a full derivation across 15 transitions. Removing either the old-type or new-type check makes a test fail.
Benchmark freshness: These timing numbers predate the rebase onto upstream/main
61c3794c32(including #29105); the original benchmark harness was not available to rerun. The count test was rerun on the rebased code: temporarily replacingthreadDetail.tswith upstream/main makes it fail with 198runIdreads instead of 0.Benchmark: Node, mounted
runStopAtom, fed by real reducer output. It timesregistry.setplusregistry.getper update. Runs alternated in separate processes with identical input. Each row is 21 runs per side, on a machine running other work. Each value is the median with p25–p75 in parentheses, in µs per update.Ten items and both no-skip cases tie. This measures the atom only, not app latency. I did not run this in a real client.
Related
#29105 is merged and its question-history reuse is preserved. #28991 remains open as of this rebase; it changes this atom's input in
threadDetail.tsand conflicts; whichever lands second needs a small rebase. It stops streamed assistant text reaching this atom, so this change would then mainly help tool and other replacements.Adversarial review by GPT-6.1 Terra via Codex in T3 Code.
Made with Claude Opus 5.5 via Claude Code in T3 Code.
Rebased and verified with GPT-6.1 Sol via Codex in T3 Code.
🤖 Generated with Claude Code