Repository navigation
fix(runtime): honor endpoint-reported context windows - #2484
Merged
Merged
Conversation
A saved relay can report a different context window from its catalog binding. The inspector sees the endpoint limit, but session launch uses the catalog window when deciding whether to compact. Keep the reported limit separate from enriched display values and reuse it at session launch for catalog-owned bindings. Older cache rows keep their display data and fall back until the next successful discovery.
Owner
|
Thanks — the root cause and the v33→v34 migration look right, but this cannot land yet:
|
The v29 upgrade also runs the migrations added after v33. Keep the assertion against SCHEMA_VERSION so the fixture verifies the full upgrade and continues checking the restored data.
The discovery handler now adds endpoint provenance before it writes the cache. Keep the existing checks for the live result and saved-endpoint guard without pinning the old argument expression.
The RPC fixtures upgrade through the current host schema. Compare with SCHEMA_VERSION so the existing data-preservation and constraint assertions continue to run after v34.
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.
Problem
A saved Responses relay can report a 500,000-token context window while its catalog-owned binding resolves to 1,050,000. The composer used the endpoint value, but the launched session received the larger catalog value. With a 128,000-token output limit, the two windows yield automatic-compaction thresholds of 337,500 and 829,800 tokens. Regular follow-up requests can continue after the composer indicates the context is full.
The launch regression on
48a655826received1050000where it expected500000. The production-sidecar fixture also exercises both thresholds with the same consistent 400,000-token usage report. With the smaller window it writes one checkpoint before the follow-up request. With the larger window it sends the follow-up without a checkpoint.Refs #1760. This reproduction exercises the window passed to the runtime. #1994 covers cached input omitted from the provider usage total. The original environment reported in #1760 has yet to be verified against this patch.
Fix
Verification
Windows x64, Node 22.19.0, pnpm 12.8.1. Tested candidate
5145ff846fba15f8ef360d80782d50ee4a7928a0on48a65582678ec04e018f90f8bc075253bad27085.node scripts/e2e-context-usage-compaction.mjsafter bundling the runtime.pnpm check:pr-basepassed.The full workspace test command stopped at a Windows path-separator assertion that also fails on the base. Separate local full Desktop and agent-runtime runs also had failures, including Electron-dependent failures and timeouts. Those broader failures were not all classified. The focused checks above ran against this change.