Skip to content

Keep MCP policy evaluation consistent with turn environments - #46335

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/cc2744b5137be69f000d70b0c7009b14079f39ae
Sep 18, 2026
Merged

copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/cc2744b5137be69f000d70b0c7009b14079f39ae

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Keep MCP policy evaluation consistent with turn environments

Why

Environment settings saved for the next turn must not change MCP tool availability during the active turn.

What changed

  • Use one captured environment snapshot for MCP policy evaluation and runtime publication, including selections that are still starting or have failed.
  • Compare both captured selections and ready environment handles when deciding whether to refresh the runtime, and rebuild the startup configuration when resolved selections change.
  • Preserve the configuration origin of failed selections so MCP authority evaluation retains whether configuration comes from the thread.
  • Box the MCP refresh future to keep it off the sampling request's stack.

Testing

Add a regression test that updates the environment MCP policy while a turn waits for user input, verifies the tool remains visible when that turn resumes, and verifies it disappears on the next turn. Extend snapshot tests to cover starting and failed selections.

## Why

Environment settings saved for the next turn must not change MCP tool availability during the active turn.

## What changed

- Use one captured environment snapshot for MCP policy evaluation and runtime publication, including selections that are still starting or have failed.
- Compare both captured selections and ready environment handles when deciding whether to refresh the runtime, and rebuild the startup configuration when resolved selections change.
- Preserve the configuration origin of failed selections so MCP authority evaluation retains whether configuration comes from the thread.
- Box the MCP refresh future to keep it off the sampling request's stack.

## Testing

Add a regression test that updates the environment MCP policy while a turn waits for user input, verifies the tool remains visible when that turn resumes, and verifies it disappears on the next turn. Extend snapshot tests to cover starting and failed selections.

GitOrigin-RevId: cc2744b5137be69f000d70b0c7009b14079f39ae
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/cc2744b5137be69f000d70b0c7009b14079f39ae branch from 2cdecfd to 7498521 Compare September 18, 2026 00:59
@copyberry
copyberry Bot merged commit 7498521 into main Sep 18, 2026
1 check passed
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/cc2744b5137be69f000d70b0c7009b14079f39ae branch September 18, 2026 00:59
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 18, 2026

This branch was previously deployed

2 inactive deployments
pypi — 7498521d Deployed Sep 20, 2026 by celia-oai via publish-python-sdk #62
issue-triage — 7498521d Deployed Sep 18, 2026 by huskercane via Translate non-English issue #13991
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.