fix(agent): name substitute tools in background review deny message to prevent tool-denial storm (#61521) - #61618
Conversation
Related: this addresses #61521 by rewording the background-review deny/steering text to name the correct substitute tools ( |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the cache-preserving mitigation. Current main still has the mismatch reported in #61521: the fork receives the parent toolset at agent/background_review.py:694-695, while the runtime whitelist is built from skills plus conditional memory at agent/background_review.py:788-800.
Problems
agent/background_review.py:788-790intentionally omitsmemorywhen both memory flags are disabled. The new unconditionalmemory for notesguidance would direct that review fork to an unavailable tool.tests/run_agent/test_background_review_toolset_restriction.py:101-135capturesdeny_msg_fmtbut does not assert its contents, and no test covers the injected steering text.
Suggested changes
- Generate the substitute-tool guidance from the actual whitelist, omitting
memorywhen unavailable. - Add enabled/disabled-memory assertions for both the deny formatter and review prompt.
Automated hermes-sweeper review.
| '"{tool_name}". Review mode only permits memory and ' | ||
| "skill management tools. Use `skill_view` to read a " | ||
| "skill, `skill_manage` to modify one, `skills_list` " | ||
| "to discover skills, and `memory` for notes." |
There was a problem hiding this comment.
memory is absent from the whitelist when both memory flags are disabled (review_toolsets begins as only skills on current main). Please make this guidance conditional on memory being available, and apply the same condition to the injected review prompt.
…o prevent tool-denial storm (cherry picked from commit 81e98b8c6766869489976960711285425619fe70)
81e98b8 to
4c2c742
Compare
Summary
background_review fork advertises the parent's full toolset but only permits skills+memory. The model calls file tools (patch, read_file, write_file) which are denied with a generic message, then tries skill_manage which the read-before-write guard refuses because the model used read_file instead of skill_view. This creates a per-turn tool-denial storm that starves the self-improvement loop.
Change
Updated the deny message in
agent/background_review.pyto name the correct substitute tools when a non-whitelisted tool is denied:Also updated the proactive steering text with the same guidance.
Verification
41 background review tests pass, 0 regressions.