Improve error recovery guidance in framework prompts#1502
Open
bluesky050 wants to merge 1 commit intoagent0ai:developmentfrom
Open
Improve error recovery guidance in framework prompts#1502bluesky050 wants to merge 1 commit intoagent0ai:developmentfrom
bluesky050 wants to merge 1 commit intoagent0ai:developmentfrom
Conversation
fw.msg_misformat.md: Replace generic "misformatted" message with 6 specific JSON formatting rules. This directly addresses the most common misformat patterns (missing tool_args, string booleans, extra text outside JSON) instead of leaving the agent to re-read the system prompt and guess which rule it violated. fw.error.md: Add a 4-category error diagnosis checklist after the existing error payload. Without guidance, agents tend to retry the exact same action on error. The checklist prompts classification (parameter/environment/logic/timeout) and a strategy switch per category, reducing stuck-in-retry loops.
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
fw.msg_misformat.md: Replace the generic "You have misformatted your message. Follow system prompt instructions…" with 6 specific JSON formatting rules. This directly tells the agent which rule it likely violated (missingtool_args, string booleans, extra text outside JSON, wrong tool name) instead of pointing it back to re-read the entire system prompt.fw.error.md: Add a 4-category error diagnosis checklist after the existing{{{error}}}payload. Without guidance, agents tend to retry the exact same action on error. The checklist prompts the agent to classify the error (parameter / environment / logic / timeout) and pick a category-appropriate recovery strategy, reducing stuck-in-retry loops.Why these changes help
Both prompts are "second-chance" messages — the agent sees them only after something went wrong. The current prompts are minimally informative ("misformatted" / implicit "try again"), which gives the LLM little signal on what to change. Providing a short, structured checklist at the point of failure is cheaper and more reliable than hoping the agent re-derives the fix from the system prompt.
Test plan
tool_argsas a string instead of an object) and verify the agent corrects the format on the next attempt