Skip to content

Expose sandbox bypass across SDKs - #2372

Merged
SteveSandersonMS merged 6 commits into
mainfrom
ellismg-expose-sandbox-bypass
Sep 4, 2026
Merged

Expose sandbox bypass across SDKs#2372
SteveSandersonMS merged 6 commits into
mainfrom
ellismg-expose-sandbox-bypass

Conversation

@ellismg

@ellismg ellismg commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • retain focused SandboxConfig.allowBypass camelCase round-trip and omission coverage for Node, .NET, Python, Go, Java, and Rust
  • add a Node E2E test that configures allowBypass through generated session.options.update, observes the runtime bypass permission request, approves it, and verifies the blocked command completes outside the sandbox
  • rely entirely on the authoritative CLI 1.0.83-5 schema now adopted by main; the temporary schema augmentation and generated-output changes are gone

Paired with github/github-app#12088.

Schema handling

Runtime commit 71bd9ecdde840b90118fcb2217c18b7f2147ef09 added SandboxConfig.allowBypass to the authoritative API schema. SDK main now pins CLI 1.0.83-5, which contains that definition and has already regenerated all six bindings with their language-idiomatic optional/default/omission behavior and generated documentation.

This branch is rebased onto that SDK update. The previous addSandboxAllowBypass compatibility augmentation has been removed, and the final diff contains no generated-file changes.

Coverage

  • Node: focused generated-type serialization coverage plus real-runtime E2E on the macOS sandbox backend
  • .NET: focused System.Text.Json round-trip/omission test on net8.0 and net472
  • Python: focused generated-model to_dict/from_dict coverage
  • Go: focused encoding/json round-trip/omission coverage
  • Java: focused Jackson round-trip/omission coverage
  • Rust: focused serde coverage proving Some(true) emits "allowBypass": true, round-trips, and None is omitted

Validation

  • Node focused Vitest coverage, TypeScript typecheck, ESLint, and Prettier
  • .NET focused test on net8.0 and net472 plus format verification
  • Python focused pytest coverage, Ruff, and ty
  • Go focused test and gofmt
  • Java focused Maven test on JDK 25, Checkstyle, and Spotless
  • Rust focused test, pinned nightly rustfmt, and Clippy
  • full required CI previously green at ba963255; refreshed CI is running after the final rebase onto CLI 1.0.83-5

Copilot AI balanced review requested due to automatic review settings August 22, 2026 04:23
@ellismg
ellismg requested a review from a team as a code owner August 22, 2026 04:23

Copilot AI 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.

Pull request overview

Exposes the runtime’s optional sandbox-bypass capability through the Rust SDK.

Changes:

  • Augments the API schema during Rust code generation.
  • Regenerates SandboxConfig with optional camelCase serialization.
  • Tests enabled and omitted serialization behavior.
Show a summary per file
File Description
scripts/codegen/utils.ts Adds the temporary schema augmentation.
scripts/codegen/rust.ts Applies augmentation during Rust generation.
rust/src/generated/api_types.rs Adds allow_bypass to SandboxConfig.
rust/tests/api_types_test.rs Verifies serialization and omission.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/4 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for the Rust implementation of SandboxConfig.allowBypass — the codegen shim and serialization test are clean and correctly scoped to the current temporary need.

Before this is ready to merge, could you extend the same support to the other five SDKs (Node, C#, Python, Go, and Java)? We want allowBypass to land consistently across all six languages rather than only in Rust, since a Rust-only capability creates an avoidable gap for hosts building on the other SDKs. Please wire the addSandboxAllowBypass schema shim into each language's codegen path (mirroring how addManagedApprovalRequiredToPermissionRequests was rolled out everywhere) and regenerate.

For coverage, please add:

  • E2E coverage where this repo's conventions and runtime availability make it meaningful for a given language
  • Otherwise, focused serialization/wiring tests per language (matching the Rust sandbox_allow_bypass_serializes_as_optional_camel_case test's intent: field round-trips when set, is omitted when absent)

Once all six SDKs have parity and appropriate test coverage, please mark this ready for review again. I'm converting to draft in the meantime.

@SteveSandersonMS
SteveSandersonMS marked this pull request as draft August 25, 2026 15:30
@ellismg
ellismg force-pushed the ellismg-expose-sandbox-bypass branch from 056fc1b to ca26198 Compare September 1, 2026 01:33
@ellismg ellismg changed the title Expose sandbox bypass in Rust API Expose sandbox bypass across SDKs Sep 1, 2026
@ellismg

ellismg commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Implemented the requested six-language parity in ca26198c and rebased the branch onto current origin/main.

The pinned CLI 1.0.83-0 schema still lacks SandboxConfig.allowBypass, so the runtime field is supplied through one temporary shared augmentation used by the Node, .NET, Python, Go, Java, and Rust generators. Each binding now has focused camelCase round-trip/omission coverage. The generated Python and Java APIs also preserve their previous positional/canonical constructor signatures while appending the optional field.

Targeted codegen, typecheck, serialization, formatting, and lint validation is complete across all six bindings. GitHub reports the branch conflict-free, so I am marking the PR ready for review again.

@ellismg
ellismg marked this pull request as ready for review September 1, 2026 01:34
@github-actions github-actions Bot mentioned this pull request Sep 1, 2026
@SteveSandersonMS
SteveSandersonMS marked this pull request as draft September 2, 2026 18:19
@SteveSandersonMS

Copy link
Copy Markdown
Contributor

Thanks for extending the API shape consistently across all six SDKs. The generated bindings are the right eventual direction, and the serialization tests are useful as codegen/regression checks.

I've moved this PR to draft because the feature's value is runtime behavior, while the runtime and authoritative schema do not yet ship SandboxConfig.allowBypass. The current tests only prove that an optional JSON property round-trips; they do not prove that a command can request a bypass, that the permission flow is correct, or that the runtime executes the command outside the sandbox.

Please keep this in draft until the runtime feature and schema land. Then remove the temporary addSandboxAllowBypass schema augmentation, regenerate all six SDKs from the authoritative schema, and add E2E coverage through the real runtime for the bypass behavior. Keep the serialization tests as generated-model regression checks, but they should not be the primary feature validation.

@ellismg
ellismg force-pushed the ellismg-expose-sandbox-bypass branch from ca26198 to ab55453 Compare September 4, 2026 06:18
@ellismg

ellismg commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Final status after rebasing onto current origin/main (09210291, CLI 1.0.83-5):

  • Current HEAD: 8f31a4d6763eb0b8353cb2c4cf91e5cc9760d1c0
  • The pinned authoritative runtime schema now contains sandbox.allowBypass; the temporary compatibility augmentation is removed.
  • Added focused camelCase set/round-trip/omission coverage for Node, .NET, Python, Go, Java, and Rust.
  • Added a macOS behavioral E2E proving an approved sandbox-bypass request executes a denied-path search outside the sandbox and returns the protected result.
  • Codegen checks and the complete SDK matrix are green. One unrelated Rust in-process E2E SIGSEGV passed on rerun.
  • PR is conflict-free and ready for review. No unresolved review threads remain.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@ellismg
ellismg marked this pull request as ready for review September 4, 2026 08:37
@ellismg
ellismg marked this pull request as draft September 4, 2026 08:38
@ellismg
ellismg force-pushed the ellismg-expose-sandbox-bypass branch from ba96325 to 8f31a4d Compare September 4, 2026 08:41
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

SDK Consistency Review

This PR only adds test coverage (no SDK client/source changes) for the existing sandboxConfig.allowBypass field, and it does so consistently across all six SDKs:

  • .NET: SerializationTests.csAllowBypass
  • Go: sandbox_config_test.goAllowBypass *bool
  • Java: SandboxConfigSerializationTest.javaallowBypass()
  • Node.js: sandbox-config.test.ts + new E2E test sandbox_bypass.e2e.test.tsallowBypass
  • Python: test_rpc_generated.pyallow_bypass
  • Rust: api_types_test.rsallow_bypass

Naming follows each language's convention correctly (camelCase for TS/Java, PascalCase for .NET/Go, snake_case for Python/Rust), and all tests assert the same round-trip/omit-when-absent behavior for the allowBypass wire field.

No feature-parity or API-design inconsistencies found — this looks like a good example of coordinated, consistent test coverage across the SDKs. No action needed.

Generated by SDK Consistency Review Agent for #2372 · copilot · sonnet50 · 19.4 AIC · ⌖ 12.7 AIC · ⊞ 9.7K ·

@ellismg
ellismg marked this pull request as ready for review September 4, 2026 09:28
ellismg and others added 5 commits September 4, 2026 11:49
Teach the Rust code generator about the runtime's allowBypass host capability until the pinned CLI schema includes it, then verify camelCase serialization and omission when unset.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Generate SandboxConfig.allowBypass for Node, .NET, Python, Go, Java, and Rust from one temporary schema augmentation. Preserve Python and Java constructor compatibility and cover camelCase round-tripping plus omission in each binding.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove the temporary schema augmentation now that CLI 1.0.83-4 ships allowBypass, update serialization coverage for the current generated shapes, and add a real-runtime bypass E2E test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Register replay snapshot and in-process environment hooks before the test runs while avoiding unsupported Windows sandbox setup.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the macOS sandbox backend available in CI and prove the approved bypass by observing the denied-path result in the successful tool completion.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Track the grep execution start so the E2E can verify its successful denied-path result even when completion events omit the tool name.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS
SteveSandersonMS force-pushed the ellismg-expose-sandbox-bypass branch from 8f31a4d to 5f8f8f1 Compare September 4, 2026 11:49

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

Looks good to merge now. Thanks for landing cross-SDK test parity and the runtime-backed sandbox bypass E2E coverage.

@SteveSandersonMS
SteveSandersonMS added this pull request to the merge queue Sep 4, 2026
Merged via the queue into main with commit 604c716 Sep 4, 2026
163 of 166 checks passed
@SteveSandersonMS
SteveSandersonMS deleted the ellismg-expose-sandbox-bypass branch September 4, 2026 12:30
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.

3 participants