fix(kanban): sync terminal-knowledge copies that kanban_request_review callers hit

agent/kanban_stop.py now treats kanban_request_review as a terminal board
call, but two sibling copies of the same terminal-knowledge were not
updated and still steer workers/runs toward kanban_complete only, which
deterministically fails after request_review already ended the run:

- hermes_cli/kanban_db_dispatch.py: _PROTOCOL_VIOLATION_ERROR (the
  corrective sentence surfaced to retry workers) now names all three
  terminal calls and points at kanban_request_review for review-ready work.
- agent/turn_iteration_prep.py: the kanban-worker budget-warning tail no
  longer nudges a near-budget worker exclusively toward kanban_complete.

Co-authored-by: ximontk-review <8566250+crazyief@users.noreply.github.com>

Tests: tests/agent/test_kanban_stop.py 3 passed (main, without #105645).
This commit is contained in:
crazyief
2026-09-08 17:30:03 +08:00
committed by Teknium
parent 42500bf0cb
commit edd14100f9
2 changed files with 7 additions and 5 deletions

View File

@@ -62,7 +62,8 @@ def _maybe_inject_iteration_budget_warning(agent: Any, messages: Any) -> bool:
if kanban_worker:
notice += (
" While tools are still available, call kanban_complete only if all task "
"requirements are verified; otherwise persist a kanban_comment handoff and "
"requirements are verified, or kanban_request_review if it is ready for "
"review; otherwise persist a kanban_comment handoff and "
"continue. A diff or commit alone is not completion evidence."
)
# Only the current tool-result tail is mutable; an older turn may already be cached.

View File

@@ -896,13 +896,14 @@ def _protocol_violation_streak(conn: sqlite3.Connection, task_id: str) -> int:
_PROTOCOL_VIOLATION_ERROR = (
# Worker subprocess returned 0 but its task is still ``running`` in the DB — it exited without calling
# ``kanban_complete`` / ``kanban_block``. Overwhelmingly the work itself succeeded and only the
# ``kanban_complete`` / ``kanban_block`` / ``kanban_request_review``. Overwhelmingly the work itself succeeded and only the
# paperwork was skipped, so a retry usually completes; the corrective sentence below is surfaced to the
# retry worker via the prior-attempt error in ``build_worker_context`` (guidance approach from #61817).
"worker exited cleanly (rc=0) without calling "
"kanban_complete or kanban_block — protocol violation. "
"worker exited cleanly (rc=0) without a terminal kanban call "
"(kanban_complete, kanban_block or kanban_request_review) — protocol violation. "
"If the prior run already did the work, verify it and "
"report the result via kanban_complete; a run that ends "
"report the result via kanban_complete, or call "
"kanban_request_review if it is ready for review; a run that ends "
"without a terminal kanban call counts as failed no "
"matter what it did."
)