Skip to content

feat: add trusted process environment values - #4408

Open
seratch wants to merge 1 commit into
mainfrom
feat/trusted-process-env-values
Open

feat: add trusted process environment values#4408
seratch wants to merge 1 commit into
mainfrom
feat/trusted-process-env-values

Conversation

@seratch

@seratch seratch commented Aug 14, 2026

Copy link
Copy Markdown
Member

This pull request adds ProcessEnvValue as a late-bound sandbox environment reference that can survive manifest serialization without persisting the concrete secret value.

A manifest only declares which sandbox environment key needs a process-environment reference. It does not declare or serialize permission to read worker process environment variables. Trusted runtime configuration is instead passed to DockerSandboxClient or DaytonaSandboxClient:

  • allowed_process_environment_keys={"OPENAI_API_KEY"} grants the common same-name binding.
  • process_environment_bindings={"OPENAI_API_KEY": "PROD_OPENAI_API_KEY"} grants an explicit destination-to-source rename.

The clients normalize these settings into exact destination/source bindings and apply them during sandbox create or resume. Serialized manifests therefore cannot select arbitrary os.environ keys after being loaded by another worker.

Docker and Daytona pass protected values only through provider-native creation environment channels. Unsupported backends and injected sessions reject ProcessEnvValue before provider side effects. Resume with current runtime bindings recreates the backend when needed, preserves resumable workspace state, retires replaced resources, and keeps retryable cleanup identities without exposing protected values through command text or errors.

This supersedes #4399.

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

Copy link
Copy Markdown

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: 96fc41a25d

ℹ️ 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 src/agents/sandbox/runtime_session_manager.py Outdated
Comment thread src/agents/extensions/sandbox/cloudflare/sandbox.py Outdated
Comment thread src/agents/sandbox/sandboxes/unix_local.py Outdated
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 96fc41a to 0a1d754 Compare August 14, 2026 07:31

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

Copy link
Copy Markdown

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: 0a1d75444c

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py
Comment thread src/agents/extensions/sandbox/vercel/sandbox.py Outdated
Comment thread src/agents/extensions/sandbox/daytona/sandbox.py Outdated
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 0a1d754 to bddac27 Compare August 14, 2026 11:39

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from bddac27 to f17057a Compare August 14, 2026 12:09

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/session/base_sandbox_session.py
Comment thread src/agents/extensions/sandbox/daytona/sandbox.py Outdated
@seratch seratch changed the title Add trusted process environment values feat: add trusted process environment values Aug 14, 2026
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from f17057a to c6d4b2b Compare August 14, 2026 12:54

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/extensions/sandbox/daytona/sandbox.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py
Comment thread src/agents/sandbox/session/base_sandbox_session.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from c6d4b2b to 96a0e64 Compare August 14, 2026 13:42

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

Copy link
Copy Markdown

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: 96a0e645b3

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py
Comment thread src/agents/sandbox/sandboxes/docker.py Outdated
Comment thread src/agents/sandbox/manifest.py Outdated
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 96a0e64 to b65136f Compare August 14, 2026 21:10

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/extensions/sandbox/daytona/sandbox.py Outdated

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/_mount_security.py
Comment thread src/agents/sandbox/session/sandbox_session_state.py Outdated
Comment thread src/agents/extensions/sandbox/daytona/sandbox.py Outdated
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 8f69f83 to f531a61 Compare August 16, 2026 04:10

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/extensions/sandbox/daytona/sandbox.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py Outdated
Comment thread src/agents/sandbox/manifest.py Outdated
Comment thread src/agents/extensions/sandbox/daytona/sandbox.py Outdated

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 7d6cf42 to b77639e Compare August 16, 2026 08:50

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/runtime_session_manager.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py
Comment thread src/agents/sandbox/sandboxes/docker.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from b77639e to bd930d8 Compare August 16, 2026 09:13
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from bd930d8 to 3e2596f Compare August 17, 2026 03:21

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

Copy link
Copy Markdown

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: 3e2596f99e

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py Outdated
Comment thread src/agents/sandbox/sandboxes/docker.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 3e2596f to cbf2381 Compare August 17, 2026 04:10

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

Copy link
Copy Markdown

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

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from cbf2381 to 71e7794 Compare August 17, 2026 04:23

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

Copy link
Copy Markdown

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: 71e7794f83

ℹ️ 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 src/agents/sandbox/sandboxes/docker.py Outdated
Co-authored-by: maplexu <maplexu2010@gmail.com>
@seratch
seratch force-pushed the feat/trusted-process-env-values branch from 71e7794 to da6f4a3 Compare August 17, 2026 04:30

@ErenAta16 ErenAta16 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.

The description says Daytona carries protected values, and the code says it does not. The code and its tests agree with each other, so I think the description is the thing that needs the edit, but it is worth confirming which way round it should be.

From the PR body:

Trusted runtime configuration is instead passed to DockerSandboxClient or DaytonaSandboxClient
Docker and Daytona pass protected values only through provider-native creation environment channels.

Three things in the diff point the other way.

DaytonaSandboxClient rejects it on both entry points, with a message naming Docker as the alternative:

# create
manifest._reject_process_environment_values(
    backend_id="daytona",
    supported_alternative=(
        "use DockerSandboxClient for protected process environment transport"
    ),
)

# resume
state.manifest._reject_process_environment_values(
    backend_id="daytona",
    ...
)

That is the same shape as the backends the description calls unsupported. E2BSandboxClient gets supported_alternative="use DockerSandboxClient" in the same position.

The constructor cannot take the trusted configuration. DockerSandboxClient.__init__ has

allowed_process_environment_keys: Iterable[str] = (),
process_environment_bindings: Mapping[str, str] | None = None,

and DaytonaSandboxClient.__init__ has neither, so following the description literally and writing DaytonaSandboxClient(allowed_process_environment_keys={"OPENAI_API_KEY"}) is a TypeError on an unexpected keyword argument rather than a runtime rejection.

The tests pin the rejection, in tests/extensions/sandbox/test_daytona.py:

test_create_rejects_process_environment_before_provider_create
test_resume_rejects_process_environment_before_provider_lookup
    pytest.raises(ValueError, match="daytona does not support ProcessEnvValue")

So the implementation is self-consistent: Docker is the only backend that carries these, and Daytona is one of the eight that refuse them.

Worth fixing before merge rather than after, because a PR body of this size usually becomes the changelog entry, and this is the paragraph a reader goes to when deciding which client to configure. If Daytona support is intended and simply not in this PR, saying "Docker today, Daytona to follow" would read the same way without sending anyone at a constructor that will not accept the argument.

I did not review the whole 3k-line diff, only the process-environment boundary, and everything else I looked at on that boundary lined up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants