Skip to content

fix(api): only clear session on 401 for token-bearing requests, not background calls (#10750 A12) - #10794

Merged
mrveiss merged 1 commit into
Dev_new_guifrom
fix-apiclient-401-session
Jul 1, 2026
Merged

mrveiss merged 1 commit into
Dev_new_guifrom
fix-apiclient-401-session

Conversation

@mrveiss

@mrveiss mrveiss commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Thinking Path

The user-frontend ApiClient logged the user out + redirected to /login on any 401 (except /auth/ endpoints). Load-time optional probes — the telemetry-consent check (/api/settings/telemetry) and version poll (/api/services/version) — fire before/without a valid session context and can 401. Those 401s are not a rejection of the user's session (no token was sent), yet they triggered the destructive clear+redirect, spuriously nuking a valid session (session-stability bug, umbrella A12).

Root cause: rawRequest() attaches the bearer token conditionally (_getAuthToken() → only sets Authorization when a non-expired token exists), but the 401 branch ignored whether a token was actually attached. A token-less request that 401s has no session to invalidate.

What Changed

autobot-frontend/src/utils/ApiClient.ts:

No allowlist was added — the token-attached gate alone fully covers the background/optional-probe case, so an endpoint allowlist would be redundant surface area.

Verification

Model Used

Opus 4.8 (1M context)

Part of #10750 (A12)

…ackground calls (#10750 A12)

Part of #10750 (A12)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

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