Skip to content

fix: fix stale proxy env restoration after shell snapshots#17271

Merged
viyatb-oai merged 7 commits intomainfrom
codex/viyatb/verify-sandbox-env-refresh
Apr 20, 2026
Merged

fix: fix stale proxy env restoration after shell snapshots#17271
viyatb-oai merged 7 commits intomainfrom
codex/viyatb/verify-sandbox-env-refresh

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Apr 10, 2026

Summary

This fixes a stale-environment path in shell snapshot restoration. A sandboxed command can source a shell snapshot that was captured while an older proxy process was running. If that proxy has died and come back on a different port, the snapshot can otherwise put old proxy values back into the command environment, which is how tools like pip end up talking to a dead proxy.

The wrapper now captures the live process environment before sourcing the snapshot and then restores or clears every proxy env var from the proxy crate's canonical list. That makes proxy state after shell snapshot restoration match the current command environment, rather than whatever proxy values happened to be present in the snapshot. On macOS, the Codex-generated GIT_SSH_COMMAND is refreshed when the SOCKS listener changes, while custom SSH wrappers are still left alone.

@viyatb-oai viyatb-oai changed the title Fix stale proxy env restoration after shell snapshots fix: file stale proxy env restoration after shell snapshots Apr 10, 2026
@viyatb-oai viyatb-oai changed the title fix: file stale proxy env restoration after shell snapshots fix: fix stale proxy env restoration after shell snapshots Apr 10, 2026
@viyatb-oai viyatb-oai marked this pull request as ready for review April 10, 2026 01:27
@viyatb-oai
Copy link
Copy Markdown
Collaborator Author

@codex review

@viyatb-oai viyatb-oai requested a review from jif-oai April 10, 2026 16:10
Copy link
Copy Markdown
Contributor

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

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: d0c7144772

ℹ️ 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/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs
Comment thread codex-rs/network-proxy/src/proxy.rs
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/verify-sandbox-env-refresh branch from 1e72b54 to b22d6e3 Compare April 14, 2026 20:34
@viyatb-oai viyatb-oai requested review from jif-oai and won-openai and removed request for jif-oai April 14, 2026 20:36
@won-openai
Copy link
Copy Markdown
Collaborator

@codex review

Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Ok after my comments

Comment thread codex-rs/core/src/tools/runtimes/mod.rs
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
@jif-oai
Copy link
Copy Markdown
Collaborator

jif-oai commented Apr 17, 2026

@codex review

Copy link
Copy Markdown
Contributor

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

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: 8d63a8085c

ℹ️ 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/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/core/src/tools/runtimes/mod.rs Outdated
Comment thread codex-rs/network-proxy/src/proxy.rs
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/verify-sandbox-env-refresh branch from 01b7be8 to e25d4f4 Compare April 20, 2026 17:00
@viyatb-oai viyatb-oai requested a review from a team as a code owner April 20, 2026 17:00
@viyatb-oai viyatb-oai removed the request for review from won-openai April 20, 2026 17:12
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/verify-sandbox-env-refresh branch from e25d4f4 to aae9238 Compare April 20, 2026 17:24
viyatb-oai and others added 6 commits April 20, 2026 11:10
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/verify-sandbox-env-refresh branch from 21de128 to 4c0dd78 Compare April 20, 2026 18:11
@viyatb-oai viyatb-oai merged commit 33fa952 into main Apr 20, 2026
25 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/verify-sandbox-env-refresh branch April 20, 2026 23:39
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 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.

4 participants