Commit Graph

2 Commits

Author SHA1 Message Date
paulh 82e10ff810 fix(ralph-loop): add session limit detection and auto-recovery
When claude -p hits the Pro subscription usage limit, the old loop had
no detection — it would find no <promise> signal, treat it as a normal
continuation, and immediately retry, burning all --max iterations.

New behaviour:
- check_output() returns status 4 when the log contains any usage/rate
  limit message (case-insensitive, multiple pattern variants)
- wait_for_session_reset() polls via a trivial probe call every
  SESSION_POLL_INTERVAL seconds (default: 600s / 10 min) until claude
  responds cleanly again
- When rate-limited, the same iteration is retried (i is not incremented)
  so no task is skipped or double-counted
- set -e is temporarily suspended around agent calls so a non-zero claude
  exit doesn't kill the bash process

Also updated the master template in docs/agent-harness/ralph-loop.sh.

Agent: human
Tests: N/A
Tests-Added: 0
TypeScript: N/A
2026-04-09 21:39:29 -04:00
paulh b1c199d21d chore: scaffold agent harness for Phase 2 eSignature envelope creation
Adds the ralph loop harness artifacts to drive autonomous implementation
of Phase 2. State lives in IMPLEMENTATION_PLAN.md so work survives
session resets — restart ralph-loop.sh after token refresh and the next
agent reads the plan to pick up where it left off.

Agent: human
Tests: N/A
Tests-Added: 0
TypeScript: N/A
2026-04-09 21:34:11 -04:00