fix: fix: add idle-after-final-message watchdog around claude -p to mitigate upstream Claude Code hang (#606)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Claude 2026-04-10 17:33:56 +00:00
parent cd9937a4b4
commit ec5eb48224
2 changed files with 90 additions and 5 deletions

View file

@ -28,7 +28,10 @@
# ops_commit_and_push MESSAGE [FILES] — commit/push to ops repo
# cleanup_stale_crashed_worktrees [HOURS] — thin wrapper around worktree_cleanup_stale
#
# Requires: lib/env.sh, lib/worktree.sh sourced first for shared helpers.
# Requires: lib/env.sh, lib/worktree.sh, lib/agent-sdk.sh sourced first for shared helpers.
# Source agent-sdk for claude_run_with_watchdog watchdog helper
source "$(dirname "$0")/agent-sdk.sh"
# ── Run guards ───────────────────────────────────────────────────────────
@ -248,7 +251,7 @@ Write the complete, rewritten lessons-learned.md content below. No preamble, no
# Run claude -p one-shot with same model as agent
local output
output=$(claude -p "$digest_prompt" \
output=$(claude_run_with_watchdog claude -p "$digest_prompt" \
--output-format json \
--dangerously-skip-permissions \
${model:+--model "$model"} \
@ -442,7 +445,7 @@ Write the journal entry below. Use markdown format."
# Run claude -p one-shot with same model as agent
local output
output=$(claude -p "$reflection_prompt" \
output=$(claude_run_with_watchdog claude -p "$reflection_prompt" \
--output-format json \
--dangerously-skip-permissions \
${CLAUDE_MODEL:+--model "$CLAUDE_MODEL"} \