Repository navigation
perf(server): runs finish when the provider turn ends, not after checkpoint capture - #41362
Conversation
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosNo All 64 scenario measurements
Baseline: unavailable · PR result: 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. |
|
Rerun of the pipeline A/B on an idle cups (load ~1–2), with the merged noise floors from #41370. Merge base
The +50% GC pause from the first run does not reproduce: −5%, and the A/A runs mark GC pause too noisy to gate on. Turn end (reply's last byte → finished run) is 28% faster with an interval well clear of zero, and time per turn drops 6%. |
…kpoint capture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ttle after capture Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
804a974 to
60dee93
Compare
… run Since #41362 a run settles as completed when its provider turn ends, and commands treat it as waiting until its checkpoint capture commits. A Stop accepted in that window stored only its request, so the run stayed completed. Checkpoint capture now looks for that pending Stop on completed runs too and settles the run as interrupted with its result, as #41685 intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sync 1123c: 54 upstream commits. Two conflicts: DesktopBrowserHost.ts keeps the fork's key routing beside upstream pingdotgg#41611's iframe click routing; upstream's per-tab frameSessions map replaces the fork's trackFrameSessions bookkeeping, which is deleted, and the fork's key routing now reads upstream's map. Orchestrator.ts keeps the fork's settle-cascade wrapper with upstream pingdotgg#41362's capture wait at the top. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0005 machine filter: persisted state follows upstream's removal of the changed-files expansion state (pingdotgg#41317). 0007 project row: uiStateStore follows pingdotgg#41317; Sidebar.tsx keeps upstream's buildSidebarProjectPickerEntries import (pingdotgg#41554). 0008 new threads in the filter: Sidebar browser test imports merged with upstream's environments mocks (pingdotgg#41554). 0015 read/unread: Mark unread also requires a runtime that is not running, upstream's rule from pingdotgg#41365, for card and menus. 0020 ask-only links: link codes require the access they hand out (pingdotgg#41742), with ask needing orchestration:read; a question leaves a send-recreated worktree's setup for the next ordinary turn (pingdotgg#30773); linked-question delivery test waits for completed runs (pingdotgg#41362).
…itch-wait tests Since upstream pingdotgg#41362 a run completes before its checkpoint capture, and dispatch treats it as still running until the capture is done. Three tests sent right after the first run went idle, so their sends queued behind that run instead of reaching the background-work wait they test. They drain the capture first, as upstream's own provider-switch tests now do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iting-selection tests Since upstream pingdotgg#41362 a run completes before its checkpoint capture, and dispatch treats it as still running until the capture is done. Four tests changed the selection right after the first run went idle, so the change met that run instead of the waiting run they set up. They drain the capture first, as upstream's own provider-switch tests now do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
A run counted as finished about 1.5 s after the model's last byte. About 700 ms of that is turn-end checkpoint capture (about 10 sequential git commands, then ref lookups, the diff and the authored paths).
RunExecutionServicewrote a finished turn aswaitingand flipped it tocompletedonly after capture. Clients treatwaitingas active, so the run looked busy throughout capture. With the files-changed card gone (#41317), nothing in the timeline needs the checkpoint when the turn ends.Change
completed, withcompletedAtset to the turn end, in the same commit that enqueues thecheckpoint.captureoutbox effect. Interrupted and cancelled runs already worked this way.checkpointIdon the run. It no longer moves status orcompletedAt, and it no longer touches the root node. Runs stored aswaitingby older servers still use the old flip.main,waitingwas a barrier: steers, queued turns and hand-off checks saw an active run until capture committed, so steer deliveries already queued on the thread's effect lane settled first. To keep that:readCommandProjectionpresents the latest run aswaitingto command decisions while its capture effect is pending or running.requeueUnreadSteersand the run-end reactor wait for the capture commit, which repeats the run update.completed.Checkpoint readers while capture is pending
waitingundermain.getTurnDiff: only receives turn counts that clients read from existing checkpoints.checkpointturn items, so nothing shifts when capture lands.latest_stable: this source needs a run with a checkpoint. The dispatch now waits for the source's pending capture before it takes any thread lock (capture commits under that lock), so a fork right after a turn starts from that turn.Behavior changes
t3_thread_waitanddelegate_tasksettle at turn end, before capture.waiting_for_children(notworking) while its capture runs.waiting.completedwithout a checkpoint and the queue stays held. Undermainthe run stayedwaiting.Scope
Product decision by Julius and Maria: remove the files-changed card and capture turn-end checkpoints asynchronously. Layer 2 of 2, stacked on #41317.
Verification
node scripts/server-metrics.ts ab --only pipeline --rounds 3, harness at feat(scripts): server metrics time the turn pipeline and opening a large thread #41282 head 996169f, A =main65cd644, B = this branch b46422c; the later fork-wait commit does not touch the pipeline path, cups linux-x64):pipeline.turnEndMs.median(API stream end → finished run)pipeline.msPerTurnpipeline.gcPauseMsgcPauseMsis flagged worse with 3 rounds a side. I have not explained it; capture now overlaps the harness's next send. Per-turn time is unchanged.completedAtwas 08:23:25.563. The client dropped "Stop generation" at 25.977 (about 0.4 s of client latency). Capture then ran for about 30 s in the background and hit the existing 30 s VCS timeout (anerrorcheckpoint, old behavior). The client recorded no timeline layout change after the completion frame.RunFinalizationQueue.test.ts. The capture tests now cover a completed run (status andcompletedAtkept, nonode.updated); the legacywaitingcases still cover the flip. Tests and replay-fixture assertions that waited for thewaitingevent now wait forcompleted. The replay scenario harness counts a completed run as busy until its checkpoint lands. 18 affected server files pass in an isolated PID namespace (774 tests).vp run check:changedpasses: format, lint, knip, typecheck (9 packages), tests (26 files) and the react compiler check.docs/internals/overview.md"Turn completion and checkpoints" now describes completion before capture and the command-side hold.Model: Claude Opus 5.5 in Claude Code (T3 Code).
🤖 Generated with Claude Code