Repository navigation
Description
Summary
When Stage-2 retrieval surfaces only skills that cannot write, and the request needs a write, the local agent reads until the iteration cap and then gives up in prose. It never says why and never asks. A prompt instruction does not fix this on the locked model (measured below). This issue proposes a deterministic backstop in code instead.
Evidence
Measured during #2912 on gemma-4-e4b, with Stage 2 given the real Conflict Resolution / Relationship Management / Node Merge candidates for "The incident Rowan was on call for — mark it resolved" (no update_node on the surface):
- A closing instruction to judge each procedure by what it does and call
route_clarifywhen none fits: 0/15 clarified, identical to the old "answer the user normally" wording. - That held at every step: the first action, after a successful
get_related_nodes, after a successfulsearch_nodes, and after both had returned the incident. The model always made another read (search_nodes→get_related_nodes→get_node).
The model does not notice that no offered tool can write, so any fix that relies on its judgment (clarify, or a model-invoked re-route) hits the same weak point.
#2912 fixed the specific case at retrieval (Graph Editing's description), and route_clarify now stays on every Stage-2 surface. Neither helps the next request that retrieves the wrong skills.
Proposed shape
A system-side check at the end of a Stage-2 turn, like the existing duplicate-entity backstop in agent_loop.rs, which turns a refused create the model left unresolved into a clarification:
- Condition: the turn made no successful write, and the Stage-2 surface had no write tool (
is_write_tool), and the turn ended in prose (not aroute_clarifycall), and the intent has not already clarified. - Action: replace the prose reply with a clarification that says the matched capabilities could only look things up, names what was found (ids from the turn's successful read results), and asks the user to confirm the change they want. Their reply re-enters Stage 1 with more explicit wording.
Open questions:
- Is "no write tool on the surface" the right trigger, or is it too broad (for example, a genuine read-only question answered in prose)? It may also need a signal that the request asked for a change, and that signal must not come from the model.
- Should it fire only after at least one successful read, so that a read-only question answered directly is left alone?
Acceptance criteria
- Backstop implemented with the trigger conditions decided above
- Unit test: a mismatched-skill turn that ends in prose is converted to a clarification
- Unit test: a read-only question answered in prose is left untouched
- Unit test: nothing fires once the intent has already clarified
🤖 Generated with Claude Code
Activity
Route completion-state updates to Graph Editing; keep route_clarify o…
malibio commentedon Sep 28, 2026
Frontend baseline: 280 files / 5225 tests passed
Clarify when a Stage-2 turn is cut off having only read (closes #3047)