Skip to content

[1/3] core: add remote environment connection lifecycle#28674

Merged
sayan-oai merged 6 commits into
mainfrom
codex/remote-environment-connection-lifecycle
Jun 19, 2026
Merged

[1/3] core: add remote environment connection lifecycle#28674
sayan-oai merged 6 commits into
mainfrom
codex/remote-environment-connection-lifecycle

Conversation

@sayan-oai

@sayan-oai sayan-oai commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Why

Remote environments can be registered before their exec-server is first used. Starting the connection at registration time uses that startup window, while sharing one startup result prevents background work and capability calls from opening competing connections.

Keep initial startup simple: each environment makes one connection attempt using its configured transport timeout. A failed initial attempt is final for that environment, while an environment that disconnects after connecting can still recover on a later operation.

What changed

  • Start URL and Noise environments in the background when they are added to EnvironmentManager. Provider snapshots are fully validated before connection work begins.
  • Share one initial connection attempt and its saved result across metadata, process, filesystem, and HTTP callers.
  • Keep configured stdio environments lazy until first use so registration does not launch a process.
  • Tie background startup work to the environment lifetime so replacing or dropping an environment cancels unfinished work.
  • After an established client disconnects, share one fresh connection attempt across concurrent callers. A failed attempt fails the current operation without permanently preventing a later attempt.
  • Store the shared lazy client directly on Environment and expose small methods for starting, observing, and awaiting startup.

Test plan

  • just test -p codex-exec-server
  • just test -p codex-app-server turn_start_resolves_sticky_thread_local_environment_and_turn_overrides

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70317a41ac

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/client.rs Outdated
@sayan-oai

Copy link
Copy Markdown
Collaborator Author

@codex review this

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: ff3f3a668d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sayan-oai sayan-oai changed the title [codex] Add remote environment connection lifecycle [1/2] core: add remote environment connection lifecycle Jun 17, 2026
@sayan-oai sayan-oai force-pushed the codex/remote-environment-connection-lifecycle branch from ff3f3a6 to f4f57bb Compare June 18, 2026 01:06
Comment thread codex-rs/exec-server/src/environment.rs
Comment thread codex-rs/exec-server/src/client.rs Outdated
Comment thread codex-rs/exec-server/src/client.rs
Comment thread codex-rs/exec-server/src/environment.rs
Comment thread codex-rs/exec-server/src/client.rs Outdated
Comment thread codex-rs/exec-server/src/environment.rs
@sayan-oai sayan-oai force-pushed the codex/remote-environment-connection-lifecycle branch from f4f57bb to 918b9bc Compare June 18, 2026 20:46
@sayan-oai

Copy link
Copy Markdown
Collaborator Author

@codex review this

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 918b9bcbb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/environment.rs
@sayan-oai

Copy link
Copy Markdown
Collaborator Author

@codex review this

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 116f0a66c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sayan-oai sayan-oai changed the title [1/2] core: add remote environment connection lifecycle [1/3] core: add remote environment connection lifecycle Jun 19, 2026
@sayan-oai sayan-oai merged commit 41988e6 into main Jun 19, 2026
31 checks passed
@sayan-oai sayan-oai deleted the codex/remote-environment-connection-lifecycle branch June 19, 2026 04:50
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2026
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.

3 participants