Skip to content

Fix 1 problem from a runner's log (runner) - #215

Merged
danielehrhardt merged 1 commit into
mainfrom
godmode/61-fix-1-problem-from-a-runner-s-log-runner
Oct 20, 2026
Merged

danielehrhardt merged 1 commit into
mainfrom
godmode/61-fix-1-problem-from-a-runner-s-log-runner

Conversation

@danielehrhardt

Copy link
Copy Markdown
Contributor

When Claude's sign-in expires, the chat now tells the human to sign Claude in again instead of only offering "Try again". The fix is committed as a13cbd0 on the task branch, which already has the latest origin/main (no conflicts).

What happened

On 2026-10-19 between 12:28Z and 12:32Z, three chat runs on a runner failed with Claude Code's error "Failed to authenticate: OAuth session expired and could not be refreshed". All three were in the same chat, and each failed in about 120 ms without using any tokens. The run at 12:43Z worked again once Claude was signed in again.

The expired sign-in is not a code bug. Claude's login on that computer ran out and only signing in again fixes it, so that part needs no change.

Godmode's handling of it was a bug. Claude Code worded this error in a new way, and Godmode's sign-in check only knew the older wording "OAuth token has expired":

  • AUTH_PROBLEM in packages/core/src/runner/runner.ts didn't treat it as a sign-in problem, so the run kept Claude's raw error instead of "Claude Code is not signed in … log in".
  • runEndOf in packages/shared/src/retry.ts didn't classify it as auth either. So the chat showed a plain "Try again" instead of "Sign Claude in again" with the "Open System" button.
  • The two retries at 12:31Z and 12:32Z then failed the same way.

Changes

  • packages/core/src/runner/runner.ts
    • AUTH_PROBLEM now matches oauth (token|session) (has )?expired.
    • The check that keeps Claude's own error text out of the missing-login detection now accepts both Failed to authenticate. and Failed to authenticate:.
  • packages/shared/src/retry.ts: runEndOf reads a raw "Failed to authenticate: OAuth session expired …" as auth as well. This covers runs already saved with the raw error and runners that haven't updated yet.
  • The 403 case is unchanged. "Failed to authenticate. API Error: 403" is a short refusal from Claude's servers, so it still matches neither pattern and the automatic retry in services/resume.ts still handles it.
  • Tests
    • New fake-Claude mode AUTH_EXPIRED in test/fixtures/fake-claude.ts.
    • New runner test: the run fails with the sign-in message and no missing website login is recorded. It fails without the fix and passes with it.
    • frame.test.ts: the raw expired-session text maps to auth, and the 403 text stays unclassified.

Checks

  • pnpm -r typecheck reported no errors.
  • bun test test/runner.test.ts test/frame.test.ts test/resume.test.ts in packages/core: 59 pass, 0 fail.

One thing this doesn't fix: the "Claude login" health check uses claude auth status, which may still say "logged in" while the session can't be refreshed. A failed run is still where an expired session first shows up.

Nothing for Daniel to do: the runner was signed in again on 2026-10-19 and its later runs worked.


Task #61 · done by Self-Healer with Godmode Bot

Claude Code now ends a run whose sign-in ran out with "Failed to
authenticate: OAuth session expired and could not be refreshed". The
sign-in check only knew "OAuth token has expired", so the chat offered
a plain retry that fails the same way. Both the runner and the chat's
turn end now read it as a sign-in problem; a 403 refusal stays a retry.
@danielehrhardt
danielehrhardt merged commit 0842f56 into main Oct 20, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant