Description
The Codex VS Code extension requires re-login to OpenAI (ChatGPT Plus) account on every VS Code restart, and even when opening the Codex settings panel. This happens consistently on Windows 11 ARM64.
Root Cause Analysis
After debugging, I found the root cause in the extension source code (extension.js):
The "account-info" handler extracts chatgpt_account_id, chatgpt_user_id, and chatgpt_plan_type from the JWT token's https://api.openai.com/auth claim:
n = r["https://api.openai.com/auth"] ?? {}
i = n?.chatgpt_account_id ?? null // → null
s = n?.chatgpt_user_id ?? null // → null
a = n?.chatgpt_plan_type ?? null // → null
c = o.email ?? null // → "xxx@live.com" ✓
if (i && s && a) return { accountId: i, userId: s, plan: a, email: c }
// Falls through → returns all nulls → triggers re-login
However, the JWT's https://api.openai.com/auth claim only contains:
{
"groups": [],
"organizations": [{ "id": "org-xxx", "is_default": true, "role": "owner", "title": "Personal" }],
"user_id": "user-xxx"
}
The chatgpt_account_id, chatgpt_user_id, and chatgpt_plan_type fields are completely absent from the JWT — both in the initial token and after refresh. This causes the extension to always return {accountId: null, userId: null, plan: null, email: null}, which triggers the account/read error:
error={"code":-32600,"message":"email and plan type are required for chatgpt authentication"}
Expected Behavior
The extension should either:
- Include
chatgpt_plan_type, chatgpt_account_id, chatgpt_user_id in the JWT token returned during authentication/refresh, OR
- Fall back to fetching account info from the OpenAI API when these claims are missing from the JWT, OR
- Use
user_id (which IS present in the JWT) as a fallback for chatgpt_user_id
Workaround
Patching extension.js to use fallback values when the ChatGPT-specific JWT claims are missing:
// Before (original):
i=n?.chatgpt_account_id??null,s=n?.chatgpt_user_id??null,a=n?.chatgpt_plan_type??null,c=o.email??null;
if(i&&s&&a)return{accountId:i,userId:s,plan:a,email:c}
// After (patched):
i=n?.chatgpt_account_id??null,s=n?.chatgpt_user_id??n?.user_id??null,a=n?.chatgpt_plan_type??"plus",c=o.email??null;
if(s&&c)return{accountId:i??s,userId:s,plan:a,email:c}
Environment
- OS: Windows 11 Pro ARM64 (10.0.26200)
- VS Code: Latest
- Codex Extension Version: 0.4.78 (also reproduced on 0.4.76)
- Architecture: ARM64 (aarch64)
- Account type: ChatGPT Plus (password login, not SSO)
- Auth mode:
chatgpt (in ~/.codex/auth.json)
Steps to Reproduce
- Install Codex VS Code extension on Windows 11 ARM64
- Sign in with ChatGPT Plus account
- Close and reopen VS Code
- Codex extension requires re-login
- Check
~/.codex/auth.json — tokens exist, account_id is null
- Decode the JWT
id_token — chatgpt_plan_type, chatgpt_account_id, chatgpt_user_id are all missing from the https://api.openai.com/auth claim
Related Issues
Logs
2026-02-27 19:51:23.301 [error] Request failed conversationId=none durationMs=1800
error={"code":-32600,"message":"email and plan type are required for chatgpt authentication"}
method=account/read pendingCountAfter=2 timeoutMs=0
Description
The Codex VS Code extension requires re-login to OpenAI (ChatGPT Plus) account on every VS Code restart, and even when opening the Codex settings panel. This happens consistently on Windows 11 ARM64.
Root Cause Analysis
After debugging, I found the root cause in the extension source code (
extension.js):The
"account-info"handler extractschatgpt_account_id,chatgpt_user_id, andchatgpt_plan_typefrom the JWT token'shttps://api.openai.com/authclaim:However, the JWT's
https://api.openai.com/authclaim only contains:{ "groups": [], "organizations": [{ "id": "org-xxx", "is_default": true, "role": "owner", "title": "Personal" }], "user_id": "user-xxx" }The
chatgpt_account_id,chatgpt_user_id, andchatgpt_plan_typefields are completely absent from the JWT — both in the initial token and after refresh. This causes the extension to always return{accountId: null, userId: null, plan: null, email: null}, which triggers theaccount/readerror:Expected Behavior
The extension should either:
chatgpt_plan_type,chatgpt_account_id,chatgpt_user_idin the JWT token returned during authentication/refresh, ORuser_id(which IS present in the JWT) as a fallback forchatgpt_user_idWorkaround
Patching
extension.jsto use fallback values when the ChatGPT-specific JWT claims are missing:Environment
chatgpt(in~/.codex/auth.json)Steps to Reproduce
~/.codex/auth.json— tokens exist,account_idis nullid_token—chatgpt_plan_type,chatgpt_account_id,chatgpt_user_idare all missing from thehttps://api.openai.com/authclaimRelated Issues
Logs