You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
secrets: a cancelled ChatGPT plan token answers 400, so the vault never refreshes it #4
When the ChatGPT plan sign-in is cancelled on OpenAI's side, the vault never refreshes /secrets/chatgpt, and nothing says the sign-in has stopped working.
What happened (2026-11-24 to 2026-11-26). The secret's log on /secrets/chatgpt:
Time (UTC)
Event
11-24 21:27
secret/refreshed ok, the last of about hourly refreshes
11-24 22:09
secret/used 101: the Responses WebSocket opened
11-24 22:38 onwards
every secret/used is 400, for POST /v1/responses, the socket upgrade, and GET /v1/models
11-24 22:38 to 11-26 09:13
no secret/refreshed at all, ok or failed
OpenAI's 400 body is just {"error":{"message":"Bad Request","type":null,"code":null,"param":null},"status":400}. A request with no token gets 401, so the 400 is the token's. Running iterate chatgpt connect again fixed it at once.
Cause. In core/secrets-worker/src/secret/durable-object.ts, a request refreshes the secret only when its material says the access token has ended (accessTokenEnded), or when the pinned host answers 401 (if (response.status !== 401 || last || (await refreshed()))). A plan token that OpenAI has cancelled before its own expiry is answered with 400, so neither condition holds. The vault sends the dead token on every request, and no fact records a failed refresh.
Possible fixes:
For api.openai.com with a ChatGPT plan secret, treat a 400 like a 401: refresh once, then retry.
Or let the secret's refresh kind name the statuses that start a refresh.
Either way, record secret/refresh-failed when the refresh token itself is refused, so a mind can tell its owner to connect again.
On the mind's side, we added a hook. When a request fails with 400 or 401, it checks the token with GET /v1/models (200 for a live token, 400 for this dead one). If the check fails, it posts one note in the chat and mails the member once per incident. That is a workaround; the vault is the right place for the refresh.
Update: this is the token's normal expiry, not only a cancelled sign-in.
After iterate chatgpt connect on 2026-11-26 at 09:13, the new token worked until at least 09:24. By 11:34 every request answered 400 again, with no refresh attempted. A GET https://api.openai.com/v1/me with the same placeholder then answered 401. The vault refreshed the secret (secret/refreshed{"kind":"worker","ok":true} at 11:36:35), and GET /v1/models answered 200 again.
So /secrets/chatgpt keeps no accessTokenExpiresAt, OpenAI answers an expired plan token with 400 on /v1/responses, /v1/models and the socket upgrade, and only a 401 starts the refresh. Our mind now calls GET /v1/me to force a refresh when a check of the token fails. Recording the access token's expiry when the worker refresh stores it, or refreshing on that 400, would fix it in the vault.
Activity
eastlondoner commentedon Nov 26, 2026
Update: this is the token's normal expiry, not only a cancelled sign-in.
After
iterate chatgpt connecton 2026-11-26 at 09:13, the new token worked until at least 09:24. By 11:34 every request answered 400 again, with no refresh attempted. AGET https://api.openai.com/v1/mewith the same placeholder then answered 401. The vault refreshed the secret (secret/refreshed{"kind":"worker","ok":true}at 11:36:35), andGET /v1/modelsanswered 200 again.So
/secrets/chatgptkeeps noaccessTokenExpiresAt, OpenAI answers an expired plan token with 400 on/v1/responses,/v1/modelsand the socket upgrade, and only a 401 starts the refresh. Our mind now callsGET /v1/meto force a refresh when a check of the token fails. Recording the access token's expiry when the worker refresh stores it, or refreshing on that 400, would fix it in the vault.Generated by Claude Code
A secret's refresh names more statuses that start it: a cancelled Cha…