diff --git a/docker/scripts/stop-hook.sh b/docker/scripts/stop-hook.sh index 86520cd4..ad603136 100644 --- a/docker/scripts/stop-hook.sh +++ b/docker/scripts/stop-hook.sh @@ -1,12 +1,10 @@ #!/usr/bin/env bash # Stop hook — prevent silent exits without a terminal transition. # -# An agent should never "just stop" mid-task. They must call one of the -# terminal MCP tools first (roboco_agent_idle, roboco_task_substitute, -# roboco_task_escalate, roboco_task_pause, roboco_task_block, submit_qa, -# qa_pass/fail, docs_complete, task_complete, task_cancel). Otherwise the -# task stays in `claimed` / `in_progress` forever and the PM has to hand- -# unstick it. +# An agent should never "just stop" mid-task. They must call a terminal +# gateway verb first (i_am_idle, i_am_done, i_am_blocked, pass, fail, +# i_documented, complete, escalate_up, unclaim) so the task is not left +# stuck in `claimed` / `in_progress` for the PM to hand-unstick. # # This hook blocks the Stop on the first ungraceful attempt (exit 2 with a # reminder). If the agent tries to Stop again anyway, SDK state shows @@ -46,18 +44,27 @@ if (( attempts > allowance )); then fi # First ungraceful attempt: nudge the agent to call a terminal tool. -cat >&2 <&2 exit 2 diff --git a/tests/integration/test_stop_hook_verb_names.sh b/tests/integration/test_stop_hook_verb_names.sh new file mode 100755 index 00000000..4b1c5b32 --- /dev/null +++ b/tests/integration/test_stop_hook_verb_names.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Smoke: stop-hook + bash-guard-hook list current gateway verbs only. +set -e + +cd "$(dirname "$0")/../.." + +HOOKS=(docker/scripts/stop-hook.sh docker/scripts/bash-guard-hook.sh) + +OLD_VERBS=( + roboco_agent_idle + roboco_task_substitute + roboco_task_pause + roboco_task_submit_qa + roboco_task_escalate + qa_pass + qa_fail + docs_complete + task_complete +) + +for hook in "${HOOKS[@]}"; do + for old in "${OLD_VERBS[@]}"; do + if grep -q "$old" "$hook"; then + echo "FAIL: $hook still references pre-gateway verb: $old" + exit 1 + fi + done +done + +# stop-hook must mention at least one current terminal verb +grep -qE "i_am_idle|unclaim|i_am_blocked|i_am_done|complete|escalate_up" docker/scripts/stop-hook.sh || { + echo "FAIL: stop-hook.sh lists no current gateway terminal verb" + exit 1 +} + +echo "PASS"