Skip to content

feat(sandboxes): add Python session and execution facade - #372

Merged
shawnwu-kong merged 10 commits into
mainfrom
codex/sandbox-hosting-p7
Oct 5, 2026
Merged

shawnwu-kong merged 10 commits into
mainfrom
codex/sandbox-hosting-p7

Conversation

@shawnwu-kong

@shawnwu-kong shawnwu-kong commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add the Python Sandbox facade for one-shot commands, sessions, lifecycle operations, binary files, scoped HTTP access, and backend-managed user grants. Preserve caller request IDs, nonzero command results, credential scope, refresh identity, and body exceptions during cleanup.

Synced with current main. The vendored contract preserves existing operations and adds canonical Hosting Sandbox operations; generated implementation stays internal.

One-shot execution options now exclude session-only lifecycle fields, with native typing regressions. Public preset discovery works for anonymous, signed-in, and service clients without sending Authorization; management and granted-session credential rules remain scoped.

Ordinary requests retain the configured client timeout. Only command execution adds an explicit command budget, while preserving longer client timeouts. Removed an immediately overwritten public-client timeout setting and verified the final HTTP endpoint and timeout behavior.

Created handles retain service credentials for their lifetime, while get() continues to use refreshable user credentials. Context cleanup skips terminating/terminated sessions, accepts an already-removed 404, and preserves body exceptions. Session metadata is read-only; expiry values and grant arguments use aware datetime values and state uses SandboxState.

Synced the three public preset request properties with Hosting's catalog-owned string contract and regenerated the internal models. Documentation distinguishes session timeout results from one-shot 504 errors and same-key 409 unknown-outcome retries.

Sandbox generation now runs a scoped native Ruff post-hook to remove trailing whitespace and extra EOF lines. Fresh generation is deterministic and git diff --check origin/main...HEAD passes; generated runtime syntax and values are unchanged.

The binary file example uses /workspace/input.bin for write, read, and command access, matching the guest file API's workspace boundary.

Validation

  • 2,336 unit tests passed; 100% statement and branch coverage.
  • Ruff lint/format, mypy, and basedpyright passed.
  • Deterministic OpenAPI generation passed.
  • Wheel/sdist build, isolated installation, documented quickstart, and installed-package typing checks passed.
  • Native mutation checks for _transport_base and _transport_sandbox passed: 18 killed and 29 type-checked mutants, zero surviving mutants or failures.
  • Native mutation checks for _sandbox, sandbox_session, sandboxes, and client passed after the latest review fixes: 484 killed and 478 type-checked mutants; zero survivors or gate failures.
  • All 77 remote checks passed on 156bbcb. Generator whitespace fix 74c7a7a passed the full 2,336-test suite, deterministic generation, whole-repository format/lint/policy checks, and branch diff integrity; its remote CI is pending.
  • Workspace-path documentation fix 6417239 passed the native whole-repository format check and branch diff integrity; current remote CI is pending.
  • Hosting now includes shared Sandbox contract scenarios; Python main 33a44d2 wheel 0.13.5 passed isolated installed-package binding discovery for all 51 scenarios. This was native discovery only, not container or live execution.
  • Live Sandbox VM acceptance remains pending coordinated rollout.

Coordination

Hosting Kong/volcano-hosting#1354; JavaScript Kong/volcano-sdk-js#270; Ruby Kong/volcano-sdk-ruby#316. Hosting staging acceptance uses SDK main, so merge the SDK PRs before final cross-language acceptance. No package publication.

@shawnwu-kong

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-05T16:13:55.618320Z 0cc65f1 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 2ca167225e

ℹ️ 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/volcano_sdk/client.py Outdated

Copy link
Copy Markdown
Contributor Author

@codex review

@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: 0cc65f1855

ℹ️ 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/volcano_sdk/sandbox_models.py Outdated
swkeever
swkeever previously approved these changes Oct 5, 2026

@swkeever swkeever left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. Transport, per-operation credential routing, idempotency headers, binary encoding, and the exec timeout budget all line up with Hosting#1354, and both Codex threads are addressed.

Inline comments are non-blocking, but the public-type ones (timestamps/state as str, public internals) are much cheaper to change before release than after.

Comment thread src/volcano_sdk/sandbox_session.py Outdated
Comment thread src/volcano_sdk/sandbox_session.py Outdated
Comment thread src/volcano_sdk/client.py Outdated
Comment thread docs/sandboxes.md Outdated
Comment thread openapi/openapi.yaml Outdated
Comment thread src/volcano_sdk/sandbox_session.py Outdated
Comment thread src/volcano_sdk/_generated/api/sandboxes/create_sandbox.py Outdated
tkkhq
tkkhq previously approved these changes Oct 5, 2026

@tkkhq tkkhq 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 credential-routing and cleanup findings are resolved: created handles retain service credentials, and cleanup accepts terminating sessions and HTTP 404. The focused Sandbox tests passed; granted-user hosted acceptance must use Hosting with the expired-token HTTP 401 fix.

@shawnwu-kong
shawnwu-kong merged commit 0a41830 into main Oct 5, 2026
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants