fix(reply): stop models answering past an available tool
M0 on Strata caught both v2 models skipping a tool they had been given: the recommended model made up "24 degrees, sunny" instead of calling the weather tool, and the fast model said "timer set" without calling the timer tool (3 of 3 each). qwen2.5:7b does the same through the engine. - Prompt: TOOL_HONESTY_RULES in the persona (live facts only from a tool result this turn, actions only claimed after a tool reports success, no answer text next to a tool call), restated at the end of the system message by tool_honesty_reminder() with the turn's real tool names. - Engine: skipped-tool guard. When a native-tool model answers before any tool has run and the plan names a callable tool as a concrete call, the answer is dropped and the plan steps are direct-executed, then the model answers from the results. Only literal, schema-valid steps run (regex fast path, no LLM repair); otherwise the held-back answer is delivered. - Planner: the AVAILABLE TOOLS lines now carry argument names (planner_tool_catalog), so concrete steps use the tool's real keys. - Eval evals/test_tool_skip_confabulation.py; on qwen2.5:7b, 3 runs each, available-tool cases went from 0/12 to 9/12 calling the tool. - M0 kit: tools_fast / tools_recommended stages (run_m0_tools.bat) rerun tool calling before and after the fix on the real models, loading the production system_prompt.py and planner.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,12 @@ one turn's allow-list.
|
||||
|
||||
### Prompt contract (plan_query)
|
||||
|
||||
The planner's AVAILABLE TOOLS lines come from `planner_tool_catalog(schema)`:
|
||||
the tool's first description line plus its argument names, e.g.
|
||||
`getWeather: Weather only ... (args: location)`. Without the argument names
|
||||
the planner guessed keys (`location=` for a `city` tool, `duration=5minutes`
|
||||
for `minutes`), which made concrete steps unparseable.
|
||||
|
||||
The planner prompt instructs the model to emit:
|
||||
|
||||
- Short imperative sub-tasks, one per line.
|
||||
@@ -157,6 +163,34 @@ The engine consumes the plan in two phases.
|
||||
- The chat model still runs the final synthesis turn so the reply is
|
||||
phrased in the daemon's voice using its own profile and persona.
|
||||
|
||||
**Skipped-tool guard (native tool calling, all model sizes):**
|
||||
|
||||
- Problem: capable native-tool models sometimes answer without calling a
|
||||
tool they were given (M0 on Strata, 2026-11-10: a made-up "24 degrees and
|
||||
sunny" instead of the weather tool, "timer set" without the timer tool;
|
||||
the same on qwen2.5:7b through the engine).
|
||||
- When a native-tool model's turn is natural-language content, no tool has
|
||||
run in this reply yet, and `named_tool_steps(plan, callable_names)` finds
|
||||
plan steps that start with a callable tool name (anything in the allow-list
|
||||
except `stop` and `toolSearchTool`), the engine drops that answer from the
|
||||
messages and direct-executes those steps, then lets the chat model
|
||||
synthesise from the real results. `named_tool_steps` ignores step position,
|
||||
so a lone `logMeal meal='banana'` or `searchMemory ...` + `getWeather` plan
|
||||
still counts (`tool_steps_of` would read both as reply-only).
|
||||
- The guard overrides the model's own decision, so it only runs what the
|
||||
planner literally wrote: `parse_concrete_tool_step` (the resolver's
|
||||
regex fast path, never the LLM resolver) plus a required/unknown-key check
|
||||
against the tool's input schema. An LLM resolver could "repair" a wrong
|
||||
step into a valid but unwanted call (a timer request planned as
|
||||
`setBroadcast duration=5 minutes` was turned into starting the broadcast).
|
||||
- Fail-open: if the first planned step cannot be run as written, the
|
||||
engine delivers the answer it held back, without a second chat call. The
|
||||
guard fires at most once per reply and never in text-tool mode (that mode
|
||||
already direct-executes every plan).
|
||||
- In native mode the direct-exec result is a `role=tool` message answering
|
||||
the synthetic assistant `tool_calls` message, and no progress nudge is
|
||||
appended.
|
||||
|
||||
### resolve_next_tool_call
|
||||
|
||||
- **Fast path**: if the step text is fully concrete (tool name in the
|
||||
|
||||
Reference in New Issue
Block a user