-
Notifications
You must be signed in to change notification settings - Fork 264
Browser mode: login probe uses /backend-api/me (now Bearer-only) → false 'session not detected' for logged-in users #241
Copy link
Copy link
Closed
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P1Urgent regression or broken agent/channel workflow affecting real users now.Urgent regression or broken agent/channel workflow affecting real users now.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerThis issue is about auth, provider routing, model choice, or SecretRef resolution.This issue is about auth, provider routing, model choice, or SecretRef resolution.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Bug
Browser mode (
--engine browserwith--remote-chrome) fails the login check withERROR: ChatGPT session not detectedon every run, even when the connected Chrome profile is genuinely and fully signed into ChatGPT (chat history, custom GPTs, composer all render).Verified on v0.13.0 (latest), connecting to a remote Chrome (
--remote-chrome 127.0.0.1:<port>) whose profile is logged in.Root cause
ensureLoggedIn(src/browser/actions/navigation.ts,buildLoginProbeExpression) probes login via:ChatGPT migrated
/backend-api/*to Bearer-token auth. A cookie-only fetch to/backend-api/menow returns 401 for every logged-in user (the SPA attaches anAuthorization: Bearer <access_token>it fetches from/api/auth/session; a barecredentials: 'include'fetch has no bearer). It is no longer a cookie-authed endpoint.The 0.13.0 DOM fallback (
appAuthenticated) only rescuescfBlocked || status===429 || status===503 || status===0— plain 401/403 are treated as authoritative "logged out" (comment: "Plain 401/403 remain authoritative because they can mean the ChatGPT session really expired."). That assumption is now wrong: a logged-in user gets 401 unconditionally.Reproduction (run in the logged-in ChatGPT tab's console)
/api/auth/sessionis still cookie-authed and returns{ user, accessToken, ... }when signed in (and{}when not).Suggested fix
Two viable options:
A. Accept 401/403 when the DOM proves an authenticated shell.
appAuthenticatedalready requires a visible composer and (accounts-profile-buttonor ahistory-item), which a logged-out/guest session never has, so this can't false-positive:B. Probe the cookie-authed endpoint instead —
fetch('/api/auth/session')and treat200 + body.useras logged in.Option A is the smaller diff and keeps the existing DOM safety gate.
Environment
--remote-chrome, ChatGPT Plus, profile signed inHappy to send a PR for option A if useful.