-
Notifications
You must be signed in to change notification settings - Fork 526
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
When using Ralph with Claude Code authenticated via OAuth (e.g., Claude Max subscription), the OAuth access token expires after ~10-15 minutes. Claude Code fails to refresh the token when invoked non-interactively via -p with --output-format stream-json, causing a 401 error that kills the loop.
Ralph treats this as a successful completion (the process exits cleanly with error text in the output), so the loop either stops or moves on without realizing auth failed.
Reproduction
- Authenticate Claude Code with
claude /login(OAuth) - Start a Ralph loop
- After 2-3 loops (~15-20 min), Claude Code returns:
authentication_error: OAuth token has expired. Please obtain a new token or refresh your existing token. - Ralph logs show successful completion, but no actual work was done
Expected behavior
- Ralph should detect auth failures and either retry after prompting for re-auth, or clearly surface the error as a loop halt reason (not "completed successfully")
- Ideally, Ralph could detect the
authentication_failederror in the stream output and set an appropriate exit reason
Actual behavior
- The loop appears to complete normally from Ralph's perspective
status.jsonshows"status": "running"/"last_action": "executing"with no indication of auth failure.exit_signalsshows no done signals- The auth error is only visible buried in the raw stream log
Relevant log output
{"type":"result","subtype":"success","is_error":true,...,"error":"authentication_failed"}Note "subtype":"success" combined with "is_error":true — Ralph may be keying on subtype and missing the error.
Upstream issue
This is partially a Claude Code bug — the CLI should refresh OAuth tokens in non-interactive mode. Filed upstream: anthropics/claude-code#28827
Environment
- Ralph version: latest (from
~/.ralph/ralph_loop.sh) - Claude Code version: 2.1.59
- macOS (Darwin 25.2.0)
- Auth: OAuth (Claude Max subscription)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working