GeezerVison is showing github.com — fix(server): preserve cancelled-run history when switching providers by Solly922 · Pull Request #34045 · pingdotgg/t3code
Conversation
Summary
Provider switches discard visible prompts and responses when their run ended as cancelled. Include cancelled runs that actually started as handoff sources, while keeping never-started queued requests excluded.
handoff sources: completed, failed, interrupted
+ cancelled when startedAt is non-null
Fixes #34009. This is a focused fix for existing conversation history being lost, with no new setting or workflow.
Evidence
- Before: the two added cancelled-source cases fail on main because no handoff is recorded.
- After: 57 tests pass across ProviderSwitch.integration.test.ts and ContextHandoffService.test.ts. The existing table covers immediate and queued switching, new and returning providers, inline and native history delivery, cancellation-status annotations, and no duplicate replay. It also checks that a separate queued request cancelled before starting is absent from delivered history.
From apps/server:
vp test run src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts src/orchestration-v2/ContextHandoffService.test.ts --silent
vp run typecheck
Both commands pass. Typechecking emits existing Effect schema-brand suggestions.
Formatting, lint, Knip's file/dependency pass, and generated GraphQL checks pass. The full check:changed run did not finish: Knip's export pass and the affected-package typecheck batch exceeded their 900-second budgets, including a serial attempt. The server-only typecheck above passed separately. The commit hook was bypassed because it repeats that Knip scan. These checks are not claimed as passing.
Verification uses the real orchestrator and temporary SQLite with test provider adapters; no live provider or production state was used.
Merge Danger
Door: two-way.
Blast Radius: orchestration. The shared source predicate serves immediate switching, queued promotion, and the returning-provider cursor. Rolled-back runs remain excluded.
Created with gpt-6.1-sol in the Codex harness through T3 Code.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at 0bc4f8f
Macroscope's review found this PR approvable — Preserves history from started, cancelled runs when switching providers, while excluding runs cancelled before starting. Existing thread boundaries and provider-handoff policy checks remain unchanged.
You can add or adjust custom eligibility rules. Learn more.
|
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
-
Started cancelled runs now qualify as provider handoff sources when they have a start timestamp. Integration tests cover immediate and queued handoffs, and verify that a request cancelled before starting is excluded from delivered history.
Changes: Cancelled-run handoff history
| Layer / File(s) |
Summary |
Handoff eligibility and integration coverage apps/server/src/orchestration-v2/Orchestrator.ts, apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts |
The handoff predicate accepts cancelled runs with a start timestamp. Integration tests cover immediate and queued handoffs and check that a queued request cancelled before starting is absent from delivered history. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- pingdotgg/t3code#34016: Both PRs change
isHandoffSourceRun for started cancelled runs and test handoff history.
Suggested labels: bugfix, size:S
Suggested reviewers: juliusmarminge
Merge Risk: Minimal · up to 0bc4f
-
No material merge-blocking risk was identified. Targeted tests were reported passing, but the full changed-check run remains incomplete.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly summarizes the main change: preserving cancelled-run history when switching providers. |
| Description check |
 |
The description explains the problem and change, links the issue, states why the fix is focused, and gives detailed verification results and limitations. It uses “Summary” and “Evidence” instead of th… |
| Linked Issues check |
 |
Issue #34009 is closed and completed, so it supplies historical context only. No active directly linked issue imposes coding requirements on this pull request. |
| Out of Scope Changes check |
 |
The change is limited to provider-handoff eligibility for cancelled runs and regression tests for that behavior. The implementation includes cancelled runs only when startedAt is non-null, and the tes… |
Full details: Description check
-
Explanation
The description explains the problem and change, links the issue, states why the fix is focused, and gives detailed verification results and limitations. It uses “Summary” and “Evidence” instead of the template’s section headings, but the required information is mostly present.
Full details: Out of Scope Changes check
-
Explanation
The change is limited to provider-handoff eligibility for cancelled runs and regression tests for that behavior. The implementation includes cancelled runs only when startedAt is non-null, and the tests cover exclusion of a queued request cancelled before starting. These changes support the pull request's stated history-preservation intent; no unrelated changes are identified.
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 d756fed and 0bc4f8f.
Files selected for processing: 2
-
apps/server/src/orchestration-v2/Orchestrator.ts
apps/server/src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for this. Main has the change since https://git.cafe/pingdotgg/t3code/pulls/34016: Compared the complete diff of #34045 with merged main: its only production change is the identical isHandoffSourceRun condition accepting cancelled runs when startedAt is non-null, covering immediate switches, queued promotion and returning-provider delivery tracking; remaining differences add regression coverage rather than behavior.
Closing as superseded.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for this. Main already has the change, as of d756fed: Main already contains this fix in d756fed7aa, landed through #34016. The complete diff's only production change is the identical condition accepting cancelled runs when startedAt is non-null. That shared predicate covers immediate switches, queued promotion, and returning-provider delivery tracking. Remaining differences extend tests rather than behavior. This is the only mainline landing touching the two changed files since the comparison base; there are no merge commits in that range. The linked #34009 is already completed, and the PR is already closed as superseded. All 37 pages of open PRs were scanned.
Closing as superseded.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
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.
|