fix(agent): retry oversized resume on a fresh session with summarized history#3334
Merged
Merged
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
2 tasks
Contributor
|
Reviews (1): Last reviewed commit: "refactor(agent): simplify oversized-resu..." | Re-trigger Greptile |
dbe76da to
df83f0d
Compare
There was a problem hiding this comment.
No showstoppers. The retry mechanism is well-guarded with a one-shot flag, state is cleaned up in a finally block on both success and failure paths, and the previously raised concern about stale resume state on failed retries is demonstrably fixed in the current diff.
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
When a resumed session's transcript no longer fits the model's context window, the API rejects every request — including the SDK's own auto-compaction — so the resume continuation fails with
Internal error: Prompt is too long. That is classified as a non-recoverableagent_error, the run dies before doing any work, and every subsequent resume of the task hits the same wall: the task is permanently stuck.Follow-up to #3331 (which makes hydration unlikely to produce an oversized transcript in the first place); this adds the safety net for any remaining path to an oversized resume.
Changes
handleTurnFailurebehavior.isPromptTooLongErrorpredicate inerror-classification.ts.