Repository navigation
fix(server): continue a provider session that already holds its history - #506
Merged
Merged
Conversation
A follow-up after /compact replayed the pre-compact transcript and counted every stored byte as a token, so a Grok session the CLI still had room for failed before the prompt was sent. Skip history already delivered into the native session, including a completed compact, and stop estimating occupancy from runs that compact folded away. Model: grok-4.7-build-fast Harness: grok
…andoff-context-limit
Dropping every handoff aimed at a run before /compact also dropped the transcript a provider switch deferred for the next turn. Only skip a handoff when an earlier delivery of the same history is already in this native session. Model: grok-4.7-build-fast Harness: grok
patroza
marked this pull request as ready for review
October 6, 2026 08:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
A follow-up on a long Grok thread failed before the prompt was sent:
ContextHandoffBudgetError("Insufficient context allowance for the provider handoff"). T3 replayed the pre-compact transcript as amanual_contexthandoff and counted every stored byte as a token against the 128k fallback, so the budget was 0. The same native session still had room in the Grok CLI (about 59k of 256k after compact)./compact.A new native session (resume fallback, provider switch) still gets the full handoff and the hard budget check. The next message on an existing session is sent to the provider.
Upstream #15495 only stops preparing another legacy handoff. It does not drop handoffs already stored, and it does not change the occupancy estimate. It is still open.
Test plan
vp test runonContextHandoffBudget.test.tsandOrchestrator.migration.test.ts(25 tests)pnpm pr:readyModel: grok-4.7-build-fast
Harness: grok