GeezerVison is showing github.com — fix(client-runtime): keep the originating run on live background tasks by saphid · Pull Request #44816 · pingdotgg/t3code
Conversation
Problem
Provider adapters resend whole pendingBackgroundTasks rosters on provider-thread.updated without per-task runIds. While the server's ProjectionStore attributes each newly seen task to the event's runId and preserves that owner across subsequent roster refreshes, the client projection reducer (applyOrchestrationV2ProjectionEvent) stored the raw roster, leaving live background tasks without their originating runId until a fresh snapshot reload.
Deterministic repro on origin/main (13cda455bd1606b79aacdc6954090e45962d8a8d):
- Apply
provider-thread.updated on run-a with pendingBackgroundTasks: [{ taskId: "watch", kind: "monitor", awaited: true }] (no task-level runId).
- Apply
provider-thread.updated for the same provider thread on run-b with pendingBackgroundTasks: [{ taskId: "watch", kind: "monitor", awaited: true }, { taskId: "follow-up", kind: "command" }].
- Observed on
origin/main: afterRunA.providerThreads[0].pendingBackgroundTasks[0] had no runId (and still had no runId after run-b).
- Expected:
watch is attributed to run-a on first receipt and keeps run-a after run-b; follow-up is attributed to run-b.
Change
Applied the same attributePendingBackgroundTasks rule used by apps/server/src/orchestration-v2/ProjectionStore.ts inside applyOrchestrationV2ProjectionEvent's provider-thread.updated branch in packages/client-runtime/src/state/orchestrationV2Projection.ts: keep an explicit task runId, otherwise retain the existing task's recorded runId (including undefined if first seen without a run), otherwise attribute a newly seen task to event.runId. Because web, desktop, and mobile all share @t3tools/client-runtime's projection reducer, this keeps live provider-thread projections consistent across every client surface.
Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
- Base failure (
origin/main 13cda455bd1606b79aacdc6954090e45962d8a8d): vp test run packages/client-runtime/src/state/orchestrationV2Projection.test.ts -t "attributes pending background tasks to their originating run across roster refreshes" failed with AssertionError showing "runId": "run-a" missing on watch.
- Head pass (3/3 consecutive runs after rebasing onto
9762a3c2195e04678661fc6a6c73d364e3911d46): vp test run packages/client-runtime/src/state/orchestrationV2Projection.test.ts passed 20/20 on all 3 consecutive runs (covering run-a attribution, run-b roster refresh retention, newly added run-b task attribution, explicit runId preservation, and runless task non-attribution).
- Changed-file checks:
vp run check:changed exited 0 (format, lint, knip, typecheck across 7 packages, and affected tests all green).
- Evidence: before-after-transcript.md
- Not shown: No live browser/desktop/mobile UI session was recorded because this is a pure projection-state reducer fix with no visual layout change.
Authored by Gemini 4 Neon (Antigravity); reviewed by GPT-6.1 Sol (Codex).
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
Provider-thread updates now attribute missing run IDs to pending background tasks. The projection retains matching tasks’ existing run IDs, uses the event run ID for new unowned tasks when available, and preserves explicit assignments.
Changes: Pending task run attribution
| Layer / File(s) |
Summary |
Attribute pending task run IDs packages/client-runtime/src/state/orchestrationV2Projection.ts, packages/client-runtime/src/state/orchestrationV2Projection.test.ts |
The projection reuses a matching task’s existing run ID or falls back to the event run ID. Tests cover existing ownership, explicit assignments, and tasks that remain unowned. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · up to e6a99
-
Provider-thread updates now keep background tasks attributed to their originating run across roster refreshes. The change is localized and tested, and no merge-blocking risk was found.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the fix (keeping the originating run on live background tasks) in the client-runtime package, which matches the changeset: the provider-thread.updated reducer now attributes pending ba… |
| Description check |
 |
The description follows the template's sections (Problem, Change, Scope, Verification) and fills each one with specific content. It gives a deterministic repro with observed and expected behavior, exp… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the fix (keeping the originating run on live background tasks) in the client-runtime package, which matches the changeset: the provider-thread.updated reducer now attributes pending background tasks to their originating runId. The title uses the conventional commit format and is specific enough for a teammate scanning history.
Full details: Description check
-
Explanation
The description follows the template's sections (Problem, Change, Scope, Verification) and fills each one with specific content. It gives a deterministic repro with observed and expected behavior, explains the change and its link to the server's ProjectionStore rule, justifies the lack of an issue, and reports focused test results with a base failure and a head pass. It also states what was not checked (no live UI session). The template's optional agent-model line is present, and the author names the model and reviewer. Minor gap: the Scope section does not link an issue, but it gives the required reason for omitting one.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 96612ae and e6a99f6.
Files selected for processing: 2
-
packages/client-runtime/src/state/orchestrationV2Projection.test.ts
packages/client-runtime/src/state/orchestrationV2Projection.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|