Repository navigation
fix(agent): catch a tool plan written in place of doing the work - #6847
Conversation
Asked for net revenue by region, Gemma 4 E4B on the NPU ran one analyze_data_file call, then answered with "Here is the plan: 1. I will use the `run_python` tool to load the CSV… 5. I will print the final results" and "This should give you the exact breakdown". No tool ran, and the plan was handed over as the answer. An answer that ends on a list of two or more "I will" steps, one naming a tool, with at most a short closing line and no figures after it, now counts as an announced step. The re-prompt quotes its first tool step. Tutorials that name no tool, a plan followed by its results, drafted emails and quoted plans still pass through.
|
Checked against the real answers from the integration build. Gemma's saved revenue answer (a numbered plan, "1. I will use the |
|
Verdict: Request changes This catches the real failure: an answer that lays out a tool plan ("1. I will use the
Real-world evidenceN/A: no evidence bundle was produced for this run. The verdict rests on reading the code and tracing the new check by hand against the cases above, because this runner has no Python environment that can import 🔍 Technical detailsRubric and missed-bug-classes files were both read. 🟡 Important1. A plan that asks for the go-ahead is flagged as narration (
Before this PR, a plan with two or more future steps passed on purpose ( Add a 2. A stronger fix is to check the name against 🟢 Minor3. Curly apostrophes lose the quoted step ( Strengths
|
A plan the user asked for ("1. I'll use the `list_files` tool… 2. I'll
move them to Archive. Want me to go ahead?") was overruled with "do it
now", and a code plan ("I will rename `load_config`… Let me know if that
works.") counted as a tool plan because any snake_case name did.
The plan check now skips a closing line that asks a question or for the
go-ahead, and counts a step only when it uses, calls or runs a tool. It
also matches curly apostrophes while still quoting the step as written.
|
Both false positives are fixed. A plan that ends by asking for the go-ahead ("Want me to go ahead?", "Let me know and I'll start.") now passes as the answer. A code plan that only names identifiers ("I will rename 🔍 Technical details
|
|
Checked b8a758f against the real answers from testing, plus the review's look-alikes. Still caught: Gemma's numbered plan ("1. I will use the |
|
Verdict: Request changes 🟡 Both earlier findings are fixed when there's a blank line before the closing question. Without one, a plan that waits for the go-ahead is still treated as unfinished work. Take "Here's the plan:\n1. I'll use the 🔍 Technical details
One fix: treat the non-item lines after the last list item as closing text. lines = paragraphs[plan_at].splitlines()
last_item = max((i for i, l in enumerate(lines) if _PLAN_ITEM_PATTERN.match(l)), default=-1)
tail = "\n".join(lines[last_item + 1 :]).strip()
closing = [c for c in [tail, *paragraphs[plan_at + 1 :]] if c]Then run the existing length, digit and go-ahead checks against Test case to add to |
A plan ending in "Once you confirm, I'll start.", "Reply 'go' to
proceed." or "Nothing has been changed yet." is the answer the user
asked for, but the tool-plan check read it as unfinished work and
re-prompted. The go-ahead check now also covers confirm, proceed,
approve, "once you", "reply ... to" and "nothing has been changed yet".
Closing lines that only look similar ("Once it runs...", "Nothing else
is needed", "...to reply to first") are still caught.
Asked for net revenue by region, Gemma 4 E4B on the NPU ran one data-file analysis, then answered with a five-step plan ("1. I will use the
run_pythontool to load the CSV… 5. I will print the final results") and "This should give you the exact breakdown you asked for." Nothing ran after that, and the plan was handed over as the answer. #6787's guard only reads the last sentence, and this answer ends on a closing line. Now an answer that ends on a plan of "I will" steps naming a tool, with no results after it, is sent back to do the work. If the model still only plans, the turn ends with "I didn't finish".Follow-up to #6787. Refs #6753
Evals to watch on the next RC:
gaia_data,gaia_rag,gaia_honesty,tool_selection,error_recovery.Test plan
pytest tests/unit/agents/test_announced_action_guard.py: the saved answer (verbatim fixture) is caught, the re-prompt quotes itsrun_pythonstep, and the turn ends honestly at the cap. Both tests failed before the fix. Look-alikes still pass through: a tutorial that names no tool, a plan followed by its results, a drafted email with a plan, and a quoted plan.pytest tests/unit/agents/ tests/unit/test_agent*.py: no new failures (the 16 sidecar-manager failures also fail onmainon this Windows box).python util/lint.py --black --isort --flake8