Repository navigation
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused client-side bug fix that restores queued-run visibility across live, cached, and retained synchronization paths. The production logic is small, cache invalidation is explicit, and regression tests cover the affected scenarios without introducing new APIs, infrastructure, or sensitive behavior. You can add or adjust custom eligibility rules. Learn more. |
|
Note Grok responding on behalf of Julius. Thanks for working on this, and for the careful write-up. #16987 is now fixed on main by #17764, which keeps a queued run's items when they arrive after a newer turn, so I'm closing this one as superseded. If you still see queued turns going missing on a build that includes #17764, please open a new issue with the details and we'll take another look. |
Problem
Queued runs receive their ordinal when queued. When a newer direct turn runs first, the bounded client timeline drops the queued run's later user message and reply as unloaded history. Persisting that incomplete projection also makes the omission survive reloads.
Closes #16987.
Change
Track runs that were pending at hydration or became live afterwards, and exempt their items from the partial-history ordinal guard. Keep that eligibility through completion and retained-thread resume so final replies still arrive. Replacement snapshots establish a fresh boundary. Unloaded historical runs keep the existing filtering behavior, and visible rows retain authoritative ordinal order.
Bump the shared orchestration cache version so previously incomplete snapshots are fetched again. Both changes live in
packages/client-runtime, covering web, Electron desktop, and React Native mobile across providers and local/remote connections. The cache refresh causes a one-time snapshot fetch after upgrading.Scope and approval
Maintainer triage establishes the client-side failure and intended visibility. This PR addresses that failure and its persisted caches. Queue ordering remains the separate design question described in that comment. Related #16437 addresses late siblings of already-loaded runs; this fix also handles queued runs with no loaded rows.
Verification
On unmodified
b707eeb05, the new shared-runtime stream regression failed for HTTP, socket, and warm-cache snapshots: only the newer turn's items remained, with both queued message IDs absent. After the fix, it passes for those paths and retained-thread resume. It checks a newer item raising the watermark, the queued user message, a reply arriving after run completion, ordinal insertion, exclusion of an unloaded historical run, and the saved projection/resume sequence. A cache regression confirms that schema-version-3 snapshots are discarded for a fresh fetch.All 103 tests passed with:
vp test run packages/client-runtime/src/state/threads-sync.test.ts packages/client-runtime/src/state/orchestrationV2Projection.test.ts packages/client-runtime/src/state/threadHistoryMerge.test.ts packages/client-runtime/src/state/threadHistoryController.test.ts packages/client-runtime/src/platform/orchestrationCache.test.ts apps/web/src/connection/storage.test.ts apps/mobile/src/connection/environment-cache-store.test.tsvp run --filter @t3tools/client-runtime typecheckpassed. Targetedvp lint --report-unused-disable-directivesandvp fmt --checkpassed for all five changed files.git diff --checkpassed.Verification uses the actual shared thread subscription/reducer/persistence paths with controlled stream events. A live provider session, browser, and native mobile UI were not exercised. No UI components or layouts change.
Implemented with gpt-6.1-sol in the Codex harness.