Claude Code writes live per-PID status to ~/.claude/sessions/<pid>.json
(status idle|working, cwd). Three fixes hang off it:
- Dispatch verify: isPtyBusy was fooled by boot-screen redraw — on a
fresh clone the trust-folder dialog ate the injected paste and six
agents were acked 'launched + injected' while idle at an empty
composer. waitForAgentGenerating() now polls the CLI's own status
(fallback to isPtyBusy for agents without live status files) and
re-injects once when verifiably idle.
- Pusher lifecycle: readFastState synthesizes the direct_terminal
observation from live status, so headless PTY agents mid-task read
as Working instead of 'process detected, no lifecycle signal'
(the producer the presenter test always described but nothing built).
- Deploy hardening: the restart ssh runs under timeout 180 +
keep-alives after hanging 47 minutes post-restart and freezing the
deploy before verification and the runner sync.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>