Clear stale API-key credentials when a password session begins #55

Merged
weichen merged 2 commits from feature/login-clear-stale-key into main 2026-10-11 14:04:59 +00:00
Owner

Why: the auth middleware prefers Bearer keys over the session cookie, so a stale key left in localStorage shadows valid cookie sessions - every request after password login returns 401 and refreshes bounce back to the login gate (observed 2026-10-11). Evidence: vitest 19 files / 88 tests green (auth.test.ts covers beginSession clearing the stored Bearer); CI on PR head 09310cb is the authoritative gate. Impact: password logins switch cleanly to the HttpOnly cookie session; API-key login unchanged. Refs: task card feature/login-clear-stale-key in Agent-System-Dev.

Why: the auth middleware prefers Bearer keys over the session cookie, so a stale key left in localStorage shadows valid cookie sessions - every request after password login returns 401 and refreshes bounce back to the login gate (observed 2026-10-11). Evidence: vitest 19 files / 88 tests green (auth.test.ts covers beginSession clearing the stored Bearer); CI on PR head 09310cb is the authoritative gate. Impact: password logins switch cleanly to the HttpOnly cookie session; API-key login unchanged. Refs: task card feature/login-clear-stale-key in Agent-System-Dev.
weichen added 1 commit 2026-10-11 13:58:58 +00:00
Why: the auth middleware prefers Bearer keys over the session cookie, so a stale key left in localStorage shadows valid cookie sessions and every request after password login returns 401 (observed at http://192.168.3.2:8788 on 2026-10-11).
Evidence: modules/frontend vitest 19 files / 88 tests green; auth.test.ts covers beginSession clearing the stored Bearer before any fetch.
Impact: password logins switch to the HttpOnly cookie session cleanly; API-key logins unchanged.
Refs: task card feature-login-clear-stale-key in Agent-System-Dev.
weichen added 1 commit 2026-10-11 14:04:29 +00:00
weichen merged commit 39dc8c456c into main 2026-10-11 14:04:59 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Frontend#55