Fix the auth bug in auth.ts
Debug and resolve authentication failures in auth.ts until the issue is resolved.
Use this when
You have a reproducible authentication failure isolated to one file and a test or manual check that proves when it is fixed. Best for a known-bad symptom (a failing login, a rejected token) rather than open-ended "make auth better" work.
Done when
✓ Exit on the specific auth test or reproduction case passing, not on the agent asserting the fix. Re-run the full suite before merging — auth changes routinely break session and middleware tests that the loop never looked at. If the cap is hit, treat the run as a failed diagnosis and read the diff before rerunning.
Why it works
A ralph-style loop re-reads the file and its failure output on every pass, so each attempt starts from the current state rather than a stale plan. The --max-iterations 10 cap is what makes it safe to leave running: a bug that resists ten passes is a design problem, not a typo, and it should surface to you instead of burning more turns.
More debugging loops
Memory leak hunt
Drive a suspected memory leak to ground: reproduce growth under a repeated workload, capture heap snapshots, and fix the retention until memory stays flat.
Take a ticket to reviewer-ready
Turn a ticket or bug report into a proven root cause, a minimal patch, and a clean handoff a reviewer can trust.
Ralph the bug backlog
Work a triaged bug list one fix per fresh-context iteration: reproduce first, fix minimally, prove it with a regression test, and log root-cause patterns to guardrails.