Skip to content

Defer environment selection changes until the next turn - #46310

Merged
copyberry[bot] merged 1 commit into
mainfrom
copyberry/codex-internal-to-codex-oss/09a6b90131d2ab2441ce2fe9b0368a3668889f31
Sep 17, 2026
Merged

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

Conversation

@copyberry

@copyberry copyberry Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Defer environment selection changes until the next turn

Why

Updating environment selections while a turn is running must not redirect its tools or prevent its pending environment setup from completing.

What changed

  • Store future environment selections separately from active environments, and activate them when preparing new work with no task running.
  • Keep turn contexts and MCP workspace roots tied to the active environment snapshot. Report saved selections through thread settings and environment_selections().
  • Route environment configuration and failure callbacks to matching active or future selections so each can finish setup independently.
  • Stop the running task before manual compaction adopts the saved environments.

Testing

Add regression tests that preserve a running task's working directory and workspace roots, then adopt the saved selection for the next task. Add remote environment coverage showing that future setup can complete while the active turn waits, with each turn receiving its own capability roots.

## Why

Updating environment selections while a turn is running must not redirect its tools or prevent its pending environment setup from completing.

## What changed

- Store future environment selections separately from active environments, and activate them when preparing new work with no task running.
- Keep turn contexts and MCP workspace roots tied to the active environment snapshot. Report saved selections through thread settings and `environment_selections()`.
- Route environment configuration and failure callbacks to matching active or future selections so each can finish setup independently.
- Stop the running task before manual compaction adopts the saved environments.

## Testing

Add regression tests that preserve a running task's working directory and workspace roots, then adopt the saved selection for the next task. Add remote environment coverage showing that future setup can complete while the active turn waits, with each turn receiving its own capability roots.

GitOrigin-RevId: 09a6b90131d2ab2441ce2fe9b0368a3668889f31
@copyberry
copyberry Bot force-pushed the copyberry/codex-internal-to-codex-oss/09a6b90131d2ab2441ce2fe9b0368a3668889f31 branch from f9f1372 to c775dd3 Compare September 17, 2026 21:47
@copyberry
copyberry Bot merged commit c775dd3 into main Sep 17, 2026
@copyberry
copyberry Bot deleted the copyberry/codex-internal-to-codex-oss/09a6b90131d2ab2441ce2fe9b0368a3668889f31 branch September 17, 2026 21:47
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 17, 2026
@SergAHell
SergAHell deployed to issue-triage September 17, 2026 22:22 — with GitHub Actions Active
@SergAHell
SergAHell deployed to issue-triage September 17, 2026 22:22 — with GitHub Actions Active
@SergAHell
SergAHell deployed to issue-triage September 17, 2026 22:22 — with GitHub Actions Active
@SergAHell
SergAHell deployed to issue-triage September 17, 2026 22:23 — with GitHub Actions Active
@lairdrt
lairdrt deployed to issue-triage September 17, 2026 22:49 — with GitHub Actions Active
@lairdrt
lairdrt deployed to issue-triage September 17, 2026 22:49 — with GitHub Actions Active
@lairdrt
lairdrt deployed to issue-triage September 17, 2026 22:49 — with GitHub Actions Active

This branch had an error being deployed

1 failed and 1 active deployments
pypi — c775dd3c Deployed Sep 17, 2026 by imac-oai via publish-python-runtime #57
issue-triage — c775dd3c Deployed Sep 17, 2026 by jiadizhunine via Generate label suggestions #46416
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.

9 participants