fix: prevent infinite cascade crash by converting fw.warning/fw.error to plain text#1457
Open
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Open
fix: prevent infinite cascade crash by converting fw.warning/fw.error to plain text#1457gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
gdeyoung wants to merge 1 commit intoagent0ai:mainfrom
Conversation
…nt cascade crash The JSON-formatted templates cause the agent to attempt parsing its own warning/error messages as tool calls, creating an infinite cascade that crashes the agent. Converting to plain Markdown text breaks the cycle.
This was referenced Apr 6, 2026
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.
TL;DR — Agent crashes itself in an infinite loop when it generates a warning or error
The
fw.warning.mdandfw.error.mdtemplates are formatted as~~~jsonfenced blocks. When the agent produces a warning (e.g., malformed JSON output), the framework injects the template content back into the conversation. The agent then tries to parse its own warning message as a tool call, fails, generates another warning, and the cycle repeats until the agent crashes.This is a critical stability bug that affects all non-OpenAI models (GLM, MiniMax, Qwen, etc.) which are more likely to produce output that triggers warnings.
Problem
fw.warning.mdcurrent content:fw.error.mdcurrent content:The
extract_tools.pyJSON parser sees the~~~jsonfences and attempts to parse the warning/error as a tool call. This creates an infinite cascade:fw.warning.md(which is itself JSON-wrapped)Solution
Convert both templates to plain Markdown text with no JSON fences:
fw.warning.md:
fw.error.md:
Impact
Changes
| File | Change |
|------|--------||
|
prompts/fw.warning.md| Convert from JSON template to plain Markdown ||
prompts/fw.error.md| Convert from JSON template to plain Markdown |Testing
Related