fix openai oauth to work with workspace/team plans #1422
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Openai OAuth didnt use the workspace/team usage when you select workspace, it would always use your personal usage/plan. this fixes that
Problem
When authenticating with OpenAI Codex and selecting a workspace, Clawdbot ignores the
account_idfield stored in~/.codex/auth.json. This causes API calls to be attributed to the user's personal ChatGPT account instead of the selected workspace.Solution
This PR updates the Codex CLI credential reading to:
Add
accountIdfield toCodexCliCredentialtype - Now includes optionalaccountIdfor ChatGPT account/workspace IDRead
account_idfrom~/.codex/auth.json- ThereadCodexCliCredentialsfunction now extractstokens.account_idfrom the Codex CLI auth fileRead
account_idfrom macOS Keychain - ThereadCodexKeychainCredentialsfunction also extracts theaccount_idwhen reading from keychainThe
accountIdautomatically flows through to the auth profile store sinceOAuthCredentialsfrom pi-ai already includes this field.Testing
pnpm build)pnpm test)How to verify
~/.codex/auth.jsonhas the correcttokens.account_id)clawdbot onboard --auth-choice codex-cli(reuse existing Codex CLI login)clawdbot models status(triggers sync)clawdbot doctorto verify the codex-cli profile is synced~/.clawdbot/agents/main/agent/auth-profiles.jsonnow containsaccountIdfor theopenai-codex:codex-cliprofile