grok-build-upstream-mirror/crates/codegen/xai-grok-hooks/examples/hooks/bin/stop-verify.sh
grokkybara[bot] ba76b0a683 Synced from monorepo
Changes:
- Stop hooks for session lifecycle
- Add x.ai/session/state and x.ai/session/import ACP methods
- Deny-and-continue for auto-mode classifier blocks with denial limits
- Drop codebase-upload from dhat soak test
- scheduler_create upsert via task_id; retire one-shot tasks
- Clipboard: copy file fallback + honest toasts for SSH/Apple Terminal
- Polarity-safe syntax colors in minimal mode
- Auto mode classifies unvetted env prefixes instead of hard-prompting
- Add GROK_CLIPBOARD_NO_OSC52 kill switch to force OSC 52 off
2026-07-19 18:42:24 +01:00

24 lines
882 B
Shell
Executable file

#!/bin/sh
# stop-verify.sh — keep the agent working until the build passes.
#
# A Stop hook runs when the agent is about to finish its turn. Emitting a
# block decision feeds the reason back to the model and runs another round;
# the built-in cap ends the turn after 8 continuations. Set a generous
# timeout on the hook (see stop-verify.json), since a timed-out hook fails
# open and lets the agent stop.
INPUT=$(cat)
# Gate only genuine turn ends, not the observe-only session-end fire.
REASON=$(echo "$INPUT" | grep -o '"reason":"[^"]*"' | sed 's/"reason":"//;s/"$//')
if [ "$REASON" != "end_turn" ]; then
exit 0
fi
if cargo build --quiet >/dev/null 2>&1; then
# Build is green: allow the stop.
exit 0
fi
# Build is red: keep the agent working, with the failure as feedback.
echo '{"decision":"block","reason":"cargo build failed; fix the errors before finishing."}'