Repository navigation
fix(server): turn starts skip a timing-out folder's baseline without waiting on its lock - #47138
Conversation
…waiting on its lock Once a folder's checkpoint captures had timed out repeatedly, a new turn in another thread still queued behind that thread's post-turn capture (up to its 30 s timeout) only to learn it should skip its baseline. Check the timeout streak before taking the folder lock when there is no earlier ref to copy; the check inside the lock stays for streaks that grow while waiting. Fixes #47116 Co-Authored-By: Claude Opus 5.5 <[email protected]>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Turn starts can skip an already timeout-prone folder’s baseline without waiting for its lock. The existing timeout threshold, checkpoint-copy path, and recovery probes remain unchanged. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
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. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…ce-control & server fixes) Ported 15 commits from 772e3d4..1e6e7d7: - ff548ac (pingdotgg#46552), 4025a2f (pingdotgg#46733), abf106f (pingdotgg#46759), c4f3661 (pingdotgg#46960), 5cac91c (pingdotgg#47138) - 7cf7446 (pingdotgg#46736 mobile Usage filter env 'all', Lock pingdotgg#5 icons preserved) - 0a5e0e3 (pingdotgg#46848 Android saved route priority) - b6ac305 (pingdotgg#47096 mobile Git branch grapheme/flag cuts) - 946d88b (pingdotgg#47098 mobile SVG pixel dimensions) - c3faadd (pingdotgg#45111 mobile confirm stop once per run) - a32c694 (pingdotgg#43968 PR Author menu replaces typed author qualifier) - 6baa47d (pingdotgg#46934 preserve repeated JSON keys in tool output) - aef9eb9 (pingdotgg#46497 Forgejo PR org labels) - c57dd42 (pingdotgg#47143 Forgejo issue detail newest comments) - a7256d6 (pingdotgg#46622 GitLab multiline issue titles) (Note: pingdotgg#46702 8184b93 already functionally present via useOpenOrReturnToThread.)
When a folder's checkpoint captures had timed out repeatedly, a new turn in another thread of that folder still waited for that thread's post-turn capture to release the folder lock (up to its 30 s timeout), only to then skip its baseline. The turn start now checks the timeout streak before taking the lock, so it skips at once and starts the agent.
Fixes #47116
Reproduction on main
Commit aa6c98f (origin/main, 2026-12-01). Linux VM, real server from source:
T3CODE_DEV_SEED=0 node apps/server/src/bin.ts serve --base-dir <scratch> --port 41987 --host 127.0.0.1 --dev-url http://127.0.0.1:41988(the dev URL only registers the free Replay (dev) provider), fresh database. Repo: one committed README plus 40 x 100 MB untracked random files (4 GB). On a cold copy,git add -Atook 72 s, well over the 30 s VCS timeout.t3 project add ., then thread A:t3 thread start --provider devReplay --model showcase --wait . "go A". Its baseline timed out at the 5 s budget and its post-turn capture timed out at 30 s, so the folder's timeout streak is 2. Each round:t3 thread send --wait <A> ...; 1 s after A's reply returns (A's post-turn capture now holds the folder lock),t3 thread start --provider devReplay --model showcase --wait . "go B"on a new thread B. Durations are from logs/server.trace.ndjson. Three rounds, CheckpointService.captureBaseline for new thread B: 28.03 s, 27.86 s, 27.65 s (median 27.86 s, spread 0.38 s). ProviderTurnStartService.start: 28.05 / 27.88 / 27.67 s. Each of B's baselines ended at the same moment A's 30 swithCaptureLockspan ended, then logged 'orchestration V2 checkpoint baseline skipped after repeated capture timeouts'. So all of B's wait was spent on the lock, only to skip. Comparison in the same folder and the same rounds: A's own turn-start baseline, with no capture holding the lock, took 0.013 / 0.018 / 0.023 s and gave the same skip. End to end, B'sthread start --waittook about 34 s, against about 6 s for A's turns.Evidence
On each commit, start the real source server on Linux with T3CODE_DEV_SEED=0, a fresh --base-dir, loopback host, and --dev-url to register Replay (dev). Seed one committed README and 40 x 100 MB untracked random files (identical SHA-256 on both sides). Wait 20 s for Replay model discovery; t3 project add the repo; start A with devReplay/showcase --wait. Wait 34 s for its post-turn capture timeout, making the timeout streak 2. Three rounds: send A --wait; 1 s after its reply, start fresh B with devReplay/showcase --wait; wait 65 s before the next round. Measure CLI wall time and CheckpointService.captureBaseline / ProviderTurnStartService.start server spans. Both commits logged six repeated-timeout baseline skips; all six B threads completed with byte-identical replies.
Same Linux x86_64 VM, sequential runs, fresh databases, same driver and file bytes. Three rounds per commit; spread means max minus min. This is server/CLI performance evidence; the scenario runner explicitly excludes timing regressions.
Driver / seed script · Capture renderer and span extraction script
The videos render the actual timestamped driver output at real-time speed. Every B baseline began during another capture on both commits. The baseline median improves by 27.542 s, exceeding both spreads; all B threads still skip the baseline and complete with the identical recorded showcase reply.
Tests
vp test run src/orchestration-v2/CheckpointService.test.ts(apps/server): 10 passed. With the fix stashed, the extended shared-folder test hangs on the lock until the test times out.vp run typecheck(apps/server): exit 0, no errorsvp run check:changed: format, lint, knip, graphql, typecheck and tests all passCheckpointService.captureBaselinetook 27.64 / 28.34 / 27.83 s on main and 11.2 / 18.4 / 8.7 ms with the fixNot in this change
sourceOrdinalWithinScopeset) still waits for the folder lock before copying and before seeing the streak; bounding that wait would change the ordering fix(server): a slow baseline checkpoint no longer holds every prompt for 30 seconds #34849 chose.t3 thread startcan race provider registration right after the server starts ("Model showcase is not advertised by provider devReplay"); the CLI does not wait for providers to finish registering.Who did the work
Run by the t3code factory in T3 Code.