Repository navigation
Recover provider request limits and preserve tool history - #1957
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryThe PR adds bounded recovery for Groq request limits and OpenRouter output allowances. It also uses system instructions for Groq and preserves transferred Google tool history.
|
Contributor
Playwright screenshotsNo new feature frames; gallery is suite-vs-main drift. Open screenshot gallery · Dashboard · CI run Updated for commit |
This branch was previously deployed
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.
Groq reasoning models could receive a developer-role instruction that their chat template rejected. Requests could also exceed an account's token allowance or reserve more output than its available OpenRouter credit, even when a smaller request could run. Switching to a Google model after a tool call could also replay history without the signature its API requires.
Use system instructions for Groq. Before any output, recover once from either of two specific provider rejections: rebuild a Groq request within its reported token ceiling using the existing context policy, or reduce an OpenRouter output reservation to its reported positive allowance. Keep adjustments local to the run/model, preserve saved settings and output ceilings, and share the original request deadline. Both primary and helper calls use this path. Empty balances, key limits, unrelated errors, local reservation failures, and partial text/tool output retain their existing behavior.
For transferred tool history, use Google's documented transfer marker only on foreign calls whose signatures Pi discarded. Preserve native signatures, unsigned native parallel parts, original history, and existing payload hooks; keep completed results so tools are not repeated. An offline SDK test checks the literal outgoing wire format for both Google-to-Google and cross-provider transfers.
Recovery emits model.context_limit.reduced or model.output_reservation.reduced with provider/model, run correlation, and numeric limits only. It records no prompts, responses, tool arguments, account identifiers, or credentials. No UI copy or layout changes.
Validation: offline outgoing-wire tests reproduce Groq's previous instruction role. Runtime, limit, protocol, and offline integration tests pass, including actual context reduction, subsequent tool turns, bounded retries, deadlines, local reservations, partial output, and credential isolation. Workspace type checks and lint pass with existing warnings. Independent reuse, quality, and efficiency review completed; shared policy construction was consolidated. All fixtures are synthetic and no paid inference was used.