diff options
| author | sfishman <sfishman@anthropic.com> | 2026-03-02 20:39:50 +0000 |
|---|---|---|
| committer | sfishman <sfishman@anthropic.com> | 2026-03-02 20:39:50 +0000 |
| commit | adfc3796639cd0c5d892fb05303b4b2cddfe6e12 (patch) | |
| tree | ab8dd68c213b0d6849ffb0c53e70c10baaca420b /plugins/plugin-dev/agents | |
| parent | 55b58ec6e5649104f926ba7558b567dc8d33c5ff (diff) | |
fix(ralph-loop): stop hook fails when last assistant block is tool_use
Claude Code writes each assistant content block (text/tool_use/thinking)
as its own JSONL line. The hook's `grep role:assistant | tail -1` would
grab whichever block happened to be last — often tool_use — then jq's
text filter returned empty string, triggering the 'no text content' path
which deletes the state file and exits without blocking.
Net effect: the loop silently never fires. In one observed session, 62%
of assistant lines were tool_use-only; the hook deleted state on the
very first Stop event every time.
Fix: slurp all assistant lines with jq -rs, flatten to text blocks only,
take the last. Empty result is now non-fatal — no text means no <promise>
tag, so the loop continues. Also absorbs jq parse errors (control chars
in text) via || fallback instead of aborting under set -e.
Diffstat (limited to 'plugins/plugin-dev/agents')
0 files changed, 0 insertions, 0 deletions
