Repository navigation
fix(codex): forward auth environment for user MCP registrations - #1788
Open
andy-xu-db wants to merge 1 commit into
Open
andy-xu-db wants to merge 1 commit into
andy-xu-db wants to merge 1 commit into
Conversation
Use the existing Codex config writer and auth-name allowlist for stdio registration. Preserve unrelated config and avoid persisting credential values.
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.
🥞 Stacked PR
Use this link to review incremental changes.
Summary
BEFORE:
ug mcp add --agents codexregistered stdio servers throughcodex mcp addwithout the authentication environment allowlist already used by managed Codex registration. Codex filters subprocess environments, so an MCP proxy depending on an exported bearer, bearer command or custom Databricks config path can lose its authentication context.AFTER: reuse
managed_mcp_entryandwrite_user_mcp_serversfor per-server stdio registration. ForwardDATABRICKS_BEARER,DATABRICKS_BEARER_COMMANDandDATABRICKS_CONFIG_FILEby name without saving their values. Preserve unrelated settings and servers, replace stale same-name transport fields, and retain removal reporting.This fixes environment propagation for callers using exported authentication settings. #1757 now targets
mainindependently and requires real Databricks CLI OAuth login before MCP registration; it no longer contains or depends on this fix. This change has not been established as necessary for an ordinary already-logged-in user.Coverage
CODEX_HOME, malformed-config fallback, native HTTP OAuth registration, managed registration and removal.Validation
tests/test_mcp.pyandtests/test_agent_codex.pyon isolated base commit0eed62e32d83e3d87dbaa91b9a45ad84c4cad4b5.git diff --check: passed.e6152036, where both macOS desktop cases, both Windows desktop cases and the full Linux/Windows unit suites passed (run). Those historical results are from the combined bearer-authenticated change, not a standalone native run of this base PR or the new OAuth-login tests.Limitations
The native desktop evidence uses an injected CI bearer, not an already-logged-in CLI user. The OAuth-login version of #1757 was tested without this change. Both native inference cases passed; both skill/MCP cases timed out in
databricks auth loginbefore MCP registration (run). MCP execution through an existing user login remains unverified. Results from the earlier bearer-authenticated runs do not establish logged-in-user coverage.This replaces the installed Codex CLI registration subprocess with UG's existing config writer. Component tests reduce compatibility risk but do not establish compatibility with every historical Codex version or concurrent external config writers. An exported bearer now reaches manually registered servers and takes precedence over profile authentication, matching UG's existing token resolver; a stale or incorrect bearer must be cleared to use the profile. Existing entries require re-registration to gain the allowlist. Malformed TOML retains the existing CLI fallback and its limitations. No credential values or dependency changes are introduced.