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 a serializable ProcessEnvValue reference for sandbox manifests so trusted application code can map the current SDK process environment into sandbox variables without persisting secret values or access authority. The common same-name case defaults to the Environment mapping key, while name=... supports explicit source-to-destination renaming.

Runtime-only exact bindings are granted through Manifest.with_process_environment_access(...), revoked by serialization and pickle round trips, and rebound during resume only from the current trusted manifest. Environment resolution fails before provider side effects, uses one stable snapshot per backend operation, and sanitizes downstream errors across the built-in sandbox backends.

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
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
@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
Co-authored-by: maplexu <maplexu2010@gmail.com>
@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".

if manifest is not None:
_validate_docker_path_grants(manifest)
if manifest is not None and environment is None:
environment = await manifest.resolve_environment()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Surface Docker cleanup failures after protected creation

When ordinary create() successfully starts a container with a ProcessEnvValue and a later step such as resolve_snapshot() or session-state construction fails, _cleanup_failed_create_resources() suppresses any failure from container.remove(force=True). The caller receives only the original exception and no session or container ID, so a running orphan can retain the protected host credential indefinitely. Retry cleanup or surface a cleanup error that retains enough resource identity for deletion.

AGENTS.md reference: AGENTS.md:L169-L169

Useful? React with 👍 / 👎.

)

async def start_replacement() -> None:
resolved_environment = await state.manifest.resolve_environment()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject NoopSnapshot before resolving environment values

When a resumed Docker state has a NoopSnapshot, this calls every custom EnvValue resolver before the immediately following branch rejects the resume. A secret-store or network resolver can therefore perform unnecessary side effects, add latency, or fail with a different error even though this snapshot shape is unconditionally unsupported. Check NoopSnapshot before resolving the environment.

AGENTS.md reference: AGENTS.md:L98-L98

Useful? React with 👍 / 👎.

"Process environment access can only be granted for references in this "
f"manifest; no destination uses: {formatted}"
)
trusted = self.model_copy(deep=True)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid deep-copying unrelated environment resolvers

When a manifest combines ProcessEnvValue with a custom EnvValue backed by a non-copyable client or synchronization primitive, granting process access fails here with that object's __deepcopy__ error before the manifest can be used. EnvValue is an extension point and resolving it does not require it to be copyable, so granting authority for one process binding should copy only the manifest state needed to isolate the grant rather than deep-copying unrelated resolver internals.

Useful? React with 👍 / 👎.

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.

1 participant