[Bug]: Delivery gate over-triggers on investigative tasks — verification commands and advisory queries should not require acceptance criteria
Summary
In Delivery mode, investigative/advisory tasks such as "检查这个问题" (check this problem) or "看看怎么回事" (look into this) are misclassified as mutation-requiring work. The model's first tool call (even read-only bash like grep or go test) is immediately blocked with:
blocked: delivery-first mode requires acceptance criteria before state-changing work. Call todo_write with a concrete, verifiable task list, then retry this tool call.
This forces a todo_write ceremony before any investigation can begin, adding overhead disproportionate to the task complexity. In one observed session, investigating this gate itself required 298 tool calls over 18 minutes — under delivery mode, each bash call would have been blocked until a todo list was established.
Root Cause Analysis
The trigger chain in internal/agent/execute_one.go:298:
if a.deliveryProfile && evidence.ToolCallRequiresDeliveryCriteria(plan.evidenceName, plan.evidenceArgs, plan.readOnly) && !a.deliveryCriteriaEstablished {
// blocked
}
Three conditions converge to over-trigger:
1. Task classification is too aggressive (internal/agent/task_heuristic.go)
heuristicInputIsTask("检查这个问题...") returns true because "检查" is in actionNeedles. Then deliveryTaskIsAdvisory() returns false because deliveryTaskClauseHasObservableWork() treats "检查" as observable work — but investigating a problem is fundamentally advisory, not a state change.
2. Verification commands require criteria (internal/evidence/evidence.go:1491)
ToolCallRequiresDeliveryCriteria returns true for verification commands (go test, npm run test, git diff --check, node --check) even though they are read-only and cannot mutate state. The comment says "verification commands also qualify even though they are intentionally not mutations" — but requiring acceptance criteria before running a read-only test is unnecessary ceremony.
3. No read-only grace period
The gate fires on the very first tool call. There is no allowance for "look before you leap" — the model cannot grep, read files, or run tests to understand the problem before being forced to commit to a todo list.
Impact
- Investigative tasks ("check this", "look into this", "why is X happening") are treated as mutation tasks
- Models waste turns on blocked calls before they can even read the relevant code
- The delivery ceremony (todo_write → work → verify → complete_step → review) is enforced for tasks that may conclude with "here's what I found, no code change needed"
- Related to #7146 (verification recovery guidance) and #4507 (empty final answer blocked frequency)
Suggested Fix Direction
Phase 1: Relax verification criteria gate (minimal, safe)
In ToolCallRequiresDeliveryCriteria, do not require criteria for commands that are both bashCommandIsVerification() AND !ToolCallMutates(). Mutations keep the existing gate.
func ToolCallRequiresDeliveryCriteria(toolName string, args json.RawMessage, readOnly bool) bool {
if ToolCallMutates(toolName, args, readOnly) {
return true
}
if toolName != "bash" {
return false
}
// Read-only verification does not need acceptance criteria.
// The mutation gate above already covers state-changing commands.
return false
}
Phase 2: Expand advisory classification
Add investigative phrases to deliveryAdvisoryPhrases in internal/agent/agent.go:
"检查这个问题", "看看怎么回事", "排查一下", "调查一下",
"investigate this", "look into this", "check this", "diagnose this",
And distinguish "检查 (investigate)" from "检查 (verify a change)" in deliveryTaskClauseHasObservableWork — the former should not arm mutation expectations.
Phase 3 (optional): Read-only grace period
Allow the first N read-only/verification tool calls in a turn to proceed without criteria. Only enforce the gate at the first actual mutation. This matches the natural workflow: read → understand → plan → mutate.
Related
- #7146 — verification recovery guidance (open PR, addresses "model doesn't know which commands pass")
- #7133 — complete_step persistence deadlock (open bug, delivery todo state divergence)
- #6073 — readiness permission loops (merged, same gate family)
- #4507 — empty final answer blocked frequency (open, early over-trigger report)
- #3469 — finalReadinessCheck strict ordering (closed, same gate family)
Environment
- Observed on
main-v2/dev/clearnature-fixesbranches --profile deliveryor Desktop Delivery Worktree- Models: qwen3.7-plus, deepseek-v4-flash (both affected)