Skip to content

test(server): make the provider-switch resume-failure test reach the fallback - #13494

Merged
juliusmarminge merged 1 commit into
t3code/codex-turn-mappingfrom
v2/provider-switch-resume-fallback
Sep 24, 2026
Merged

juliusmarminge merged 1 commit into
t3code/codex-turn-mappingfrom
v2/provider-switch-resume-fallback

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

"uses portable fallback when native resume fails after a provider switch" never reached the fallback. The shared Codex session kept its native thread loaded while the Claude turn ran, so returning to Codex reused it warm and never called resumeThread. Flipping failResume: true to false still passed.

What changed

  • Before returning to Codex, the test stops the Codex provider session with provider-session.detach, the same command the client's stop-session action sends, and drains the effect worker. The return now has to resume the native thread, the fake fails that resume, and ProviderTurnStartService takes the portable fallback.
  • The assertions now check what the fallback actually produces, instead of warm reuse:
    • a fresh native Codex thread (codex:<thread>:1) bound to the same provider-thread row, with the fake's native-thread generation counter at 2;
    • a third handoff (full_thread_summary, runs 1-2) delivered inline to that fresh native thread, next to the Claude delta;
    • a third provider_handoff transfer with status resolved_portable and strategy portable_context;
    • a return prompt that re-sends the earlier Codex turn ("codex before switch"). The old assertion that it was absent was the warm-reuse expectation, so it is replaced.

With the path actually exercised, the fallback behaves correctly. No production code changed.

Verification

  • vp test run src/orchestration-v2/testkit/ProviderSwitch.integration.test.ts: 65/65 pass.
  • Mutation checks on the rewritten test (each fails, then passes again after reverting):
    • failResume: false: fails with expected 1 to equal 2 (native thread generation). With that assertion removed it still fails on expected 'codex:thread:provider-switch:0' to equal 'codex:thread:provider-switch:1'.
    • Fallback removed in ProviderTurnStartService (propagate the resume failure instead of replacing the native thread): fails. The run retries the resume and the test times out waiting for idle.
    • Fallback handoff dropped (effectiveHandoffs = [handoff, ...] skipped): fails on the handoff list assertion.
    • Detach step removed (the old warm-reuse setup): fails with expected 1 to equal 2.
  • vp lint and vp fmt on the changed file: clean. vp exec tsc --noEmit -p . in apps/server: no error TS.
  • Not run: repo-wide checks.

Model: Claude Opus 5.5 (Claude Code)

🤖 Generated with Claude Code


Devin Review

…fallback

"uses portable fallback when native resume fails after a provider switch"
never called resumeThread: the shared Codex session kept its native thread
loaded across the Claude turn, so returning to Codex reused it warm and
failResume had no effect. Stop the Codex session before returning, as the
client's stop-session action does, so the return must resume, fail, and take
the portable fallback. Assert the fallback's effects: a fresh native thread on
the same provider-thread row, a resolved portable transfer, and a
full_thread_summary handoff that re-sends the earlier Codex turn.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 24, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 7cbad6d

Macroscope's review found this PR approvable — This PR is limited to an ignored integration-test file and refines the test setup and assertions for an existing provider-switch fallback scenario. It introduces no production runtime, product-default, schema, infrastructure, security, billing, or static-analysis changes.

Notes:

  • No code objects were reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 4.9 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.1 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.4 KiB — 29.3 KiB ✅
Codex Live turn messages — 1 — 8 ✅
Claude Total thread wire — 4.9 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 20.8 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: 7cbad6d · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@juliusmarminge
juliusmarminge merged commit 9fc8676 into t3code/codex-turn-mapping Sep 24, 2026
23 of 24 checks passed
@juliusmarminge
juliusmarminge deleted the v2/provider-switch-resume-fallback branch September 24, 2026 21:05
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
…fallback (#13494)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 24, 2026
…fallback (#13494)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
juliusmarminge added a commit that referenced this pull request Sep 25, 2026
…fallback (#13494)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant