fix: replace fragile pane grep with Stop hook for idle detection (#272)
## Summary - Claude Code v2.1.79 permanently shows `❯` in the input area even while actively thinking, causing `monitor_phase_loop` to false-positive on idle detection and kill working sessions after 90 seconds - Replace `tmux capture-pane | grep ❯` with a Claude Code Stop hook (`lib/hooks/on-idle-stop.sh`) that writes a marker file only when Claude actually finishes responding - Hook is installed per-worktree in `.claude/settings.json` by `create_agent_session`; marker cleaned up on inject/kill ## Test plan - [x] Verified hook installs correctly in fresh worktree - [x] Verified marker file appears only after Claude finishes responding (not during active thinking) - [x] Verified live dev-agent session picks up fix and Claude works without being killed - [x] Verified `agent_inject_into_session` clears marker before new work 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/disinto/pulls/272
This commit is contained in:
parent
8c9d93b043
commit
ab3efa2402
2 changed files with 60 additions and 14 deletions
14
lib/hooks/on-idle-stop.sh
Executable file
14
lib/hooks/on-idle-stop.sh
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
# on-idle-stop.sh — Stop hook for dark-factory agent sessions.
|
||||
#
|
||||
# Called by Claude Code when it finishes a response. Writes a timestamp
|
||||
# to a marker file so monitor_phase_loop can detect idle sessions
|
||||
# without fragile tmux pane scraping.
|
||||
#
|
||||
# Usage (in .claude/settings.json):
|
||||
# {"type": "command", "command": "this-script /tmp/claude-idle-SESSION.ts"}
|
||||
#
|
||||
# Args: $1 = marker file path
|
||||
|
||||
cat > /dev/null # consume hook JSON from stdin
|
||||
[ -n "${1:-}" ] && date +%s > "$1"
|
||||
Loading…
Add table
Add a link
Reference in a new issue