fix(core): switch OpenAI credential routes atomically - #45336
Open
major wants to merge 2 commits into
Open
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
- Snapshot the active OpenAI credential with its transport\n- Route ChatGPT OAuth and OpenAI API keys to their respective endpoints Signed-off-by: Major Hayden <major@mhtx.net>
- Persist non-secret route provenance with assistant messages\n- Omit incompatible Codex state from OpenAI API requests Signed-off-by: Major Hayden <major@mhtx.net>
major
force-pushed
the
openai-route-switch
branch
from
August 26, 2026 17:27
8fe33da to
3bea171
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Issue for this PR
Closes #45334
Type of change
What does this PR do?
Resolve the active OpenAI credential and transport together for each model request instead of relying on asynchronously refreshed provider state. ChatGPT OAuth requests always use the Codex endpoint and headers, while OpenAI API-key requests use the normal configured API endpoint without Codex headers.
Persist non-secret route provenance with assistant messages so OpenAI item IDs and encrypted reasoning from ChatGPT Codex are not replayed to the OpenAI API after an account switch. Visible reasoning and tool content remain available.
How did you verify your code works?
bun test test/plugin/provider-openai.test.ts test/session-runner-message.test.ts test/session-message-update.test.tsfrompackages/core: 34 passed.bun typecheckfrompackages/core,packages/schema,packages/protocol, andpackages/client: passed.bun run buildfrompackages/core: passed.bun run generatefrompackages/client: passed.git diff --check: passed.v2.Screenshots / recordings
Not applicable.
Checklist