fix(agent): make tool error messages ephemeral to prevent HTTP 400 replay loop - #29436
Conversation
0fc18d7 to
f35f133
Compare
When a tool call returns an error (exception, non-zero exit, guardrail block, user interrupt), the error result was persisted verbatim to the session DB and replayed on every subsequent turn. If the error content contained characters that violate the LLM provider's API contract (e.g. oversized JSON, special chars), every follow-up message triggered HTTP 400 — an unrecoverable loop requiring /new. Fix: tag error tool messages with _is_error: True at the source (tool_executor.py), skip them at flush time (run_agent._flush_messages_to_session_db), and provide backwards-compatible load-time filters for pre-fix sessions (gateway + CLI resume paths). Fixes NousResearch#27033
f35f133 to
29843d7
Compare
|
Complementary to #18650, not competing. #18650 fixes compression-induced |
|
Thanks for the thorough work here, @vynxevainglory-ai — the serialization audit across all three API paths and the 25 regression tests are exactly the kind of rigor we want. We're going to pass on this one, though, for two reasons. 1. The loop in #27033 is no longer reproducible on current 2. The fix direction is too broad. Tagging every tool error with The genuinely-live remnant of this family is the stale- Closing #27033 as substantially-addressed alongside this. |
Uh oh!
There was an error while loading. Please reload this page.