Repository navigation
Route Codex standalone search through the Account Pooler - #3541
Merged
Merged
Conversation
Codex web search posts to ${CODEX_OPENAI_BASE_URL}/alpha/search. The pool
registered no route for /v1/alpha/search, so every search from a pooled
Codex thread failed with a router-level 404 before reaching the hub.
Fixes #3528
Co-Authored-By: Claude Code <[email protected]>
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.
Human comments
What was wrong
Codex web search (the
web.runtool) sends a standalone request to${CODEX_OPENAI_BASE_URL}/alpha/search. The Account Pooler contributesCODEX_OPENAI_BASE_URLas/api/v1/plugins/account-pool/http/v1, so the request reaches the plugin asPOST /v1/alpha/search. Plugin HTTP routes match exactly, and the pool registered only/v1/responses, the two image routes, andGET /v1/modelsfor Codex. Every search from a pooled Codex thread stopped at the plugin router withplugin "account-pool" has no POST route for "/v1/alpha/search"and never reached the hub. Codex logs on bee show this 404 in production threads on 2026-09-08, 09-09 and 09-10. See #3528 and the reproduction report.What changed
plugins/account-pool/src/server.ts: registersPOST /v1/alpha/searchnext to the other Codex routes and sends it tohub.handle(..., "codex"). The hub already forwards by path (mountedUpstreamUrl(..., "v1/")), so the request reaches<codexUpstreamBaseUrl>/alpha/searchwith the usual pool token check, account selection, credential replacement, failover and quota accounting. This is the fix proposed in the issue.plugins/account-pool/src/server.test.ts: the native Codex route test now coversalpha/searchas well as the image routes. It checks that a request without the pool token gets 401, and that an authenticated request reaches the upstream path with account credentials, no pool token header, an unchanged body, and the upstream response passed through.No wire, CLI, or configuration changes.
How you verified
pnpm exec turbo run test typecheck --filter=bb-plugin-account-pool: 281 tests pass and typecheck is clean.Fail-before: with the old
server.ts, the newalpha/searchcase fails withno http route POST /v1/alpha/search is registered.End to end with real Codex CLI 0.154.0 against a dev bb app from this branch. The Account Pooler routed a real Codex account (production access token with a fake refresh token, removed afterwards), and each thread was asked to find the latest Node.js LTS version with web search. Codex's own request log (
~/.codex/logs_2.sqlite) recorded:POST …/account-pool/http/v1/alpha/search200 OK(Cloudflare headers from the ChatGPT upstream)404 Not Found:plugin "account-pool" has no POST route for "/v1/alpha/search"200 OKFixes #3528
🤖 Generated with Claude Code