Skip to content

fix(resilience): classify Cline 401 as refreshable OAuth (#12594) - #13060

Merged
diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
HouMinXi:fix/cline-401-oauth-12594
Sep 11, 2026
Merged

diegosouzapw merged 2 commits into
cheaper-inference:release/v3.8.51from
HouMinXi:fix/cline-401-oauth-12594

Conversation

@HouMinXi

@HouMinXi HouMinXi commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Cline returns 401 with "re-authenticate your Cline account" when the access token is stale. That phrasing was not in OAUTH_INVALID_TOKEN_SIGNALS, so classifyProviderError treated it as a generic UNAUTHORIZED and resolveTerminalConnectionStatus marked the connection expired. A token refresh would have recovered it (refreshClineToken already exists). The cooling panel then printed "429 (rate-limit)" for every connection with a future cooldown timestamp, including this auth failure.

Reporter: usable ~15 min after re-auth, then the same 401. Diego already traced both defects on the issue.

Changes

  • Add "re-authenticate your cline account" to OAUTH_INVALID_TOKEN_SIGNALS. A Cline 401 now classifies as oauth_invalid_token (non-terminal) instead of expired.
  • Cooling panel copy no longer assumes 429. Rows show the recorded lastError when present.
  • 42 locale strings for coolingConnectionsDescription updated to match.

Test plan

  • node --import tsx/esm --test tests/unit/cline-401-oauth-12594.test.ts (4/4)
  • Injection: drop the Cline signal → 4/4 red; restore → 4/4 green
  • tests/unit/account-fallback-service.test.ts + tests/unit/auth-terminal-status.test.ts (107/107)
  • vitest CoolingConnectionsPanel 10/10
  • accountFallback.ts stays at frozen 2467 lines

Closes #12594

@HouMinXi
HouMinXi force-pushed the fix/cline-401-oauth-12594 branch 2 times, most recently from 1a88074 to 401ea45 Compare September 10, 2026 12:59
…erence#12594)

Cline stale-token bodies say "re-authenticate your Cline account". That
phrasing missed OAUTH_INVALID_TOKEN_SIGNALS, so classifyProviderError
fell through to UNAUTHORIZED and the connection was marked expired.
The cooling panel also hardcoded every cooldown as a 429.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
Merge-integrity requires changelog.d entries to start with "- ".
The product commit is unchanged.

Signed-off-by: Minxi Hou <houminxi@gmail.com>
@HouMinXi
HouMinXi force-pushed the fix/cline-401-oauth-12594 branch from 401ea45 to c831e23 Compare September 11, 2026 08:22
@HouMinXi

Copy link
Copy Markdown
Contributor Author

CI red on this PR matches current release/v3.8.51, not the unique files in the diff.

Measured on tip af49d4972 (#12925) against the HouMinXi open set:

  • Docs Gates: live provider modules 358 vs docs/SVG still saying 356; cli-tunnel skill dry-run out of date.
  • Fast Quality: open-sse/services/autoCombo/__tests__/autoCombo.test.ts TS2739 vs frozen baseline 0; pack-policy follows that.
  • ESLint: tests/unit/volcengine-plan-binding-upsert.test.ts @typescript-eslint/no-explicit-any (file is on tip).
  • Unit shards: chat-rate-limit-body-lock, antigravity-missing-project-chat, chat-rejects-image-only-model, stream-handler-public-error-boundary (and the glm GLM_STREAM_BUFFER_BYTES assert, which fix(stream): accept the buffer size glm.ts has been passing since #12179 #12925 already landed on tip).

Unique diff does not touch those files. Contributor-only; not merging.

@diegosouzapw
diegosouzapw merged commit 541a648 into cheaper-inference:release/v3.8.51 Sep 11, 2026
8 of 16 checks passed
@HouMinXi
HouMinXi deleted the fix/cline-401-oauth-12594 branch September 16, 2026 14:00
Githab-capibara added a commit to Githab-capibara/OmniRoute that referenced this pull request Sep 17, 2026
…erence#12594) (cheaper-inference#13060)

Two real defects in one report, both correctly separated: the missing phrase in `OAUTH_INVALID_TOKEN_SIGNALS` made a recoverable Cline 401 terminal even though `refreshClineToken` already existed, and the cooling panel printing "429 (rate-limit)" for every future cooldown hid what actually happened.

---

Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the other 19 PRs of this batch. Two in-batch conflicts, both additive and resolved by keeping each side: the `ENVIRONMENT.md` table (cheaper-inference#13035 + cheaper-inference#13011) and the `chatHelpers.ts` import block (cheaper-inference#12975 on the tip + cheaper-inference#13017).

- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK; `check:docs-counts` migrations ✓
- complexity 2816 / baseline 3218 and cognitive-complexity 1271 / baseline 1437 — both under baseline
- 531 of 532 focused assertions green across the batch's 46 test files
- `check-file-size` rebaselined for the batch's real growth (annotation `_rebaseline_2026_09_11_mergebatch_v3851_houminxi`, landed on cheaper-inference#13038), attributed per PR

The single red is **not this batch**: `tests/unit/combo/quota-weighted-strategy.test.ts` → "A/B isolation: 7 hard-empty + 2 at 0.5% + 1 at 40%, floor=1" asserts an order between two connections of identical weight and flakes on the pure tip too — 2 failures in 4 runs at `origin/release/v3.8.51` with nothing from this batch applied.

⚠️ base-red inherited: cheaper-inference#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, untouched here).

Thanks @HouMinXi — the live evidence on these (X500 logs, `storage.sqlite` state, real `/v1/models` probes, the 36-minute outage write-up) is what let a 20-PR batch be reviewed as a unit.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…erence#12594) (cheaper-inference#13060)

Two real defects in one report, both correctly separated: the missing phrase in `OAUTH_INVALID_TOKEN_SIGNALS` made a recoverable Cline 401 terminal even though `refreshClineToken` already existed, and the cooling panel printing "429 (rate-limit)" for every future cooldown hid what actually happened.

---

Validated in one consolidated worktree cut from `release/v3.8.51`, boarded with the other 19 PRs of this batch. Two in-batch conflicts, both additive and resolved by keeping each side: the `ENVIRONMENT.md` table (cheaper-inference#13035 + cheaper-inference#13011) and the `chatHelpers.ts` import block (cheaper-inference#12975 on the tip + cheaper-inference#13017).

- `typecheck:core` clean; `check:dashboard-typecheck` OK (206 pre-existing, within baseline); `check:changelog-integrity` OK; `check:docs-counts` migrations ✓
- complexity 2816 / baseline 3218 and cognitive-complexity 1271 / baseline 1437 — both under baseline
- 531 of 532 focused assertions green across the batch's 46 test files
- `check-file-size` rebaselined for the batch's real growth (annotation `_rebaseline_2026_09_11_mergebatch_v3851_houminxi`, landed on cheaper-inference#13038), attributed per PR

The single red is **not this batch**: `tests/unit/combo/quota-weighted-strategy.test.ts` → "A/B isolation: 7 hard-empty + 2 at 0.5% + 1 at 40%, floor=1" asserts an order between two connections of identical weight and flakes on the pure tip too — 2 failures in 4 runs at `origin/release/v3.8.51` with nothing from this batch applied.

⚠️ base-red inherited: cheaper-inference#12732 — `Docs Gates`, `Merge integrity`, `No new ESLint warnings`, `Unit Tests fast-path` and `Fast Quality Gates` reproduce on the pure tip (provider count 356 vs the 358 the modules define, SKILL.md drift, and `open-sse/utils/stream.ts` at 3115 > frozen 3098, untouched here).

Thanks @HouMinXi — the live evidence on these (X500 logs, `storage.sqlite` state, real `/v1/models` probes, the 36-minute outage write-up) is what let a 20-PR batch be reviewed as a unit.
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.

fix(providers): Cline 401 classified terminal and reported as a 429 cooldown

2 participants