fix(agent): retry 413 after stripping vision payloads (#47339) - #47397
fix(agent): retry 413 after stripping vision payloads (#47339)#47397Tranquil-Flow wants to merge 1 commit into
Conversation
|
Related: #47398, #42509, #37412 (all fix #47339 — context compression not evicting image/vision payloads, leading to HTTP 413). Same goal, different mechanism: this PR strips retained tool-message image payloads at the 413 retry-recovery level (conversation_loop.py / run_agent.py), while #47398 fixes the root cause in |
When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from #47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
|
Merged via #56270 (commit 122e5bc) with your authorship preserved via rebase-merge. Your fix was cherry-picked onto current main — the 413 recovery path had moved to a token-aware compression check since you opened this, so the strip+retry was placed onto that current else branch. Live E2E confirmed the production path: a real 413 mid-loop with a browser_vision screenshot triggers the eviction (remember_model=False, no false poisoning of the list-content set) and recovers. Thanks for the clean, well-reasoned fix! |
|
Superseded by #56293, which carries your commit verbatim (authorship preserved) rebased onto current |
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
…7339) When text compression can't reduce a 413 request further, evict base64 image parts from tool messages and retry once instead of dead-ending with 'Payload too large and cannot compress further.' A 413 is a request-body byte-size limit, not a token limit. browser_vision screenshots (2-5MB base64 each) keep the HTTP body oversized even after aggressive summarization. The strip pass passes remember_model=False so a 413 does not poison _no_list_tool_content_models — that set is for providers that reject list-type tool content, a distinct failure mode. Cherry-picked from NousResearch#47397 by Tranquil-Flow; placed onto main's current token-aware 413 recovery else branch.
Summary
image_url/input_imagebytes from the retry payload.Verification
/Users/evinova-self/.hermes/hermes-agent/venv/bin/python3 -m pytest tests/run_agent/test_413_compression.py -v -o "addopts=" --tb=short— 25 passed, 1 warning.Payload too large and cannot compress furtherbefore the fix.Competitor / duplicate check
fix/47339*PRs.47339,413 vision payload compression browser_vision: no competing open PRs found.Auto-published by Moonsong via Path B automated pipeline.