Skip to content

fix: restart after correction context overflow - #1115

Draft
andreatnvidia wants to merge 1 commit into
mainfrom
andreatnvidia/fix/correction-context-restart
Draft

andreatnvidia wants to merge 1 commit into
mainfrom
andreatnvidia/fix/correction-context-restart

Conversation

@andreatnvidia

Copy link
Copy Markdown
Contributor

Summary

A parser failure appends the invalid response and correction instructions to the conversation. If the next request exceeds the provider's context window, generate and agenerate currently exit even when conversation restarts remain. Restart from the latest checkpoint when only added history overflows, consuming the existing restart budget.

Related Issue

N/A. The regression tests provide a synthetic reproduction without external services or datasets.

Changes

  • Handle context-window provider errors only when the conversation extends beyond its restart checkpoint.
  • Preserve completed tool calls, reset correction state, and share the existing bounded restart counter with parser failures.
  • Keep original-prompt/checkpoint overflow and unrelated provider errors unchanged; log overflow restarts at debug level.

Testing

Synthetic MRE: return an invalid response, raise ProviderError(CONTEXT_WINDOW_EXCEEDED) on its correction request, then return a valid response. With two correction steps and one restart, the expected request message counts are [1, 3, 1]. Before this fix, both sync and async stop at [1, 3] without using the restart.

  • Regression coverage for recovery, exhausted/shared budgets, oversized original prompts, unrelated errors, and tool checkpoints in both paths.
  • Full engine suite: 2,880 passed using the isolated source on PYTHONPATH with the existing development interpreter.
  • Direct Ruff lint/format checks passed.
  • Full workspace suite and live-provider validation not run. make install-dev requires uv >=0.13.4; the available uv is 0.12.9.

Checklist

  • Follows commit message conventions
  • Commit is signed off (DCO)
  • Maintainer contribution; external-contributor issue prerequisite is not applicable
  • No architecture change

Signed-off-by: Andre Manoel <amanoel@nvidia.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant