Skip to content

fix(v2): compact full sessions before provider handoffs - #13123

Open
Bil0000 wants to merge 5 commits into
pingdotgg:t3code/codex-turn-mappingfrom
Bil0000:fix-provider-handoff-context
Open

Bil0000 wants to merge 5 commits into
pingdotgg:t3code/codex-turn-mappingfrom
Bil0000:fix-provider-handoff-context

Conversation

@Bil0000

@Bil0000 Bil0000 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Switching to a smaller model can exhaust the target native session. V2 now compacts that same session, then retries the unchanged request once. Saved chat stays visible; no encrypted provider state is copied.

Verified: 209 focused tests, adapter compaction tests, server typecheck, targeted lint and formatting, and an Opus 5.5 pr-audit. Unknown capacity or unsupported/insufficient compaction can still fail safely.

Built with GPT-6 Astra / Codex; audited with Opus 5.5 / Claude.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Sep 22, 2026
Comment thread apps/server/src/orchestration-v2/ProviderTurnStartService.ts Outdated
Comment thread apps/server/src/orchestration-v2/ProviderTurnStartService.ts Outdated
@macroscopeapp

macroscopeapp Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR changes the default production behavior for exhausted provider contexts by adding native compaction, retry, and new persistent orchestration transitions across several services. The scope and state-machine complexity are substantial enough to require human review.

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

@Bil0000 Bil0000 changed the title fix(v2): recover handoffs from full native sessions fix(v2): compact full sessions before provider handoffs Sep 22, 2026
Comment thread apps/server/src/orchestration-v2/RestartContinuation.ts
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from a419382 to f2bdd9f Compare September 23, 2026 00:50
@Bil0000
Bil0000 force-pushed the fix-provider-handoff-context branch from d746793 to d6fcc0d Compare September 23, 2026 04:08
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from 060756d to d6dcd10 Compare September 23, 2026 04:10
Comment thread apps/server/src/orchestration-v2/ProviderTurnStartService.ts Outdated
@Bil0000
Bil0000 force-pushed the fix-provider-handoff-context branch from d6fcc0d to 660852f Compare September 23, 2026 04:16
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from d2675dc to 9cbaf77 Compare September 23, 2026 07:35
@Bil0000
Bil0000 force-pushed the fix-provider-handoff-context branch from 28bab89 to ecf7d81 Compare September 23, 2026 18:26
@macroscopeapp

This comment has been minimized.

1 similar comment
@macroscopeapp

This comment has been minimized.

@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from 6ca6a24 to 3e4ca4c Compare September 23, 2026 23:24
@Bil0000
Bil0000 force-pushed the fix-provider-handoff-context branch from ecf7d81 to 2028b74 Compare September 24, 2026 01:44
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from 1bd44f2 to 3b9c885 Compare September 24, 2026 04:06
@juliusmarminge
juliusmarminge force-pushed the fix-provider-handoff-context branch from f37e16b to 2bdd29b Compare September 24, 2026 07:37
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch 2 times, most recently from 6448cfe to 1563a64 Compare September 24, 2026 23:21
@Bil0000
Bil0000 force-pushed the fix-provider-handoff-context branch from c933cdc to eba76ef Compare September 25, 2026 00:46
@juliusmarminge
juliusmarminge force-pushed the t3code/codex-turn-mapping branch from fe4f6ad to 87c67bd Compare September 25, 2026 05:55
Bil0000 and others added 4 commits September 25, 2026 13:10
The selection-change preflight treated every model or option change with a
known window as a potential overflow. Switching only reasoning effort on a
large Claude session therefore compacted the native session before the turn,
even though the window was unchanged.

Only run the selection-change exhaustion check when the new window is smaller
than the previous selection's window.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A provider can finish an automatic /compact after the user presses Stop
(the interrupt races the native compaction). The compaction attempt then
reported completed, so RunExecutionService created the retry attempt and
sent the user's original request despite the Stop.

Skip the retry when the run has an unpaired interrupt request, so the run
settles normally without sending the request.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the fix-provider-handoff-context branch from eba76ef to a78d56c Compare September 25, 2026 20:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 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.

2 participants