Commit 58b3079
committed
fix(claude-local): classify an unrefreshable OAuth session as auth required
The Claude CLI reports a dead OAuth session as
Failed to authenticate: OAuth session expired and could not be refreshed
which matches none of the branches in `CLAUDE_AUTH_REQUIRED_RE` — not
`unauthorized`, not `authentication required` (the CLI says "Failed to
authenticate"), and it is an OAuth session rather than an API key. With
`detectClaudeLoginRequired` returning false and neither the transient-upstream
nor the provider-quota pattern matching either, the run ends up unclassified
and fails hard instead of surfacing `claude_auth_required` and its login path.
On one host's run-log corpus this was the single largest error bucket: 2811 of
8179 failed runs, spread over every one of the 11 agents in a continuous ~79h
window — a shared host credential expiring, not a per-agent problem. Because
nothing classified it, all 11 agents kept being woken and kept burning runs for
the entire window.
Match the CLI's whole failure sentence rather than `OAuth session expired`
alone. `detectClaudeLoginRequired` reads the run's own `result` text, and agents
that *report on* an outage quote that phrase back; counter-checking both forms
over the same corpus, the short form newly matched 5 successful runs while the
anchored form matched none.1 parent d1b9448 commit 58b3079
2 files changed
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
36 | 66 | | |
37 | 67 | | |
38 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
0 commit comments