Handle planning response parse errors gracefully with retry logic#1986
Draft
yuyutaotao wants to merge 2 commits intomainfrom
Draft
Handle planning response parse errors gracefully with retry logic#1986yuyutaotao wants to merge 2 commits intomainfrom
yuyutaotao wants to merge 2 commits intomainfrom
Conversation
b0e1049 to
3cf5633
Compare
Deploying midscene with
|
| Latest commit: |
e7c1c84
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://331998e1.midscene.pages.dev |
| Branch Preview URL: | https://claude-fix-planning-error-ha.midscene.pages.dev |
3cf5633 to
3702a9c
Compare
…hrowing When the planning AI response fails to parse (AIResponseParseError), the error is now caught at the planning loop level and treated like action execution errors - incrementing the error counter, setting a feedback message, and continuing to the next planning round. This prevents a single malformed AI response from terminating the entire planning loop. https://claude.ai/code/session_01PPMv2PKGKTzkbW9HscXN51
3702a9c to
4074593
Compare
When the page is still loading (spinner, skeleton screen, progress bar, etc.), the planner now must use a Sleep action (1000ms) to wait for the page to finish loading before continuing with subsequent actions or assertions. If loading persists after 5 consecutive waits, the task is considered failed. https://claude.ai/code/session_013R6UiSRRXHpMaLUccdvxF7 Co-authored-by: Claude <noreply@anthropic.com>
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
Added error handling for planning response parse errors to allow the task executor to retry planning instead of terminating the entire execution loop. This improves robustness when the AI model returns malformed responses.
Key Changes
session.appendAndRun()call in a try-catch block to handle planning-phase errorsAIResponseParseErrorexceptions that occur during planning response parsingmaxErrorCountAllowedInOnePlanningLoopto prevent infinite retry loopsreplanningCycleLimitto prevent excessive replanning cyclesImplementation Details
AIResponseParseErrorappendErrorPlan()is called with a descriptive error messagecontinueto restart the planning loop, allowing the executor to attempt planning again with the same contexthttps://claude.ai/code/session_01PPMv2PKGKTzkbW9HscXN51