[claude] Fix cycle-metrics pipeline: seed issue= from queue so retro is never null (#1250) #1253

Merged
claude merged 1 commits from claude/issue-1250 into main 2026-03-23 23:42:25 +00:00

1 Commits

Author SHA1 Message Date
Alexander Whitestone
8e6dbfe948 fix: seed cycle_result.json from queue so issue= is never null in retro
Some checks failed
Tests / lint (pull_request) Failing after 21s
Tests / test (pull_request) Has been skipped
loop_guard.py picks the top-priority ready item from queue.json but
previously only signalled readiness (exit 0) without recording which
issue it selected.  When claude-loop / gemini-loop dispatchers don't
write cycle_result.json themselves, cycle_retro.py had no source for
the issue number and logged issue=null for every cycle, causing the
0% meaningful-success rate in summary.json.

Fix: add seed_cycle_result() that pre-seeds cycle_result.json with the
top queue item (issue + type) when loop_guard finds work, but only if
the file doesn't already exist — so agent-written results always win.
Also add --pick flag: prints the selected issue number to stdout for
shell scripts that need to pass --issue N downstream.

Tests: 9 new unit tests in tests/loop/test_loop_guard_seed.py covering
seed behaviour, no-overwrite invariant, graceful OSError, and --pick
mode in both work-found and empty-queue cases.

Fixes #1250

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 19:41:40 -04:00