Skip to content

[Proposal] Unify one-shot SDKs on typed requests - #1137

Open
Branden Bonaby (bbonaby) wants to merge 12 commits into
mainfrom
design/json-first-sdk-apis
Open

Branden Bonaby (bbonaby) wants to merge 12 commits into
mainfrom
design/json-first-sdk-apis

Conversation

@bbonaby

@bbonaby Branden Bonaby (bbonaby) commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

📖 Description

Proposes a shared, strongly typed one-shot SDK contract for Rust, C#, and Node. The design introduces versioned request and run/spawn option types, carries them through a typed mxc_ffi boundary, and moves Node in-process through a thin Koffi adapter.

The existing versioned JSON path remains supported for executor binaries. This PR is a design proposal only; implementation will follow in reviewable stages.

Read the rendered proposal

🔗 References

None.

🔍 Validation

Documentation-only proposal; no runtime behavior changed.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 3d099f8c-cad4-478a-a713-f56391d1d5c3
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Copilot AI balanced review requested due to automatic review settings September 11, 2026 17:11
@bbonaby
Branden Bonaby (bbonaby) requested a review from a team as a code owner September 11, 2026 17:11
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c

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.

Copilot review overview

🟡 Changes recommended

The proposal misstates the parser path, omits an authorization option, and has contradictory Node threading semantics.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Preserve the testing-feature authorization flag View comment
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Resolve the synchronous spawn threading contradiction View comment
Low severity docs/​design/​json-first-one-shot-sandbox-apis.md — Describe the actual one-shot parser path View comment
What changed in this PR

Proposes JSON-first one-shot APIs across Rust, C#, and Node while preserving existing APIs.

Changes:

  • Defines cross-language run and spawn APIs.
  • Proposes C ABI reuse through Koffi for Node.
  • Outlines migration and parity criteria.
File Description
docs/​design/​json-first-one-shot-sandbox-apis.md Documents the proposed architecture, APIs, and migration.

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

Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated
Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated
Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated

@MGudgin Gudge (MGudgin) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't agree with this approach. The SDK APIs don't go through JSON at all with the new parser/versioning stack and should not need to.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Copilot AI review requested due to automatic review settings September 11, 2026 17:27

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.

Copilot review overview

🟡 Changes recommended

Timeout preservation, asynchronous spawning, native packaging, dry-run semantics, and ABI option rules need clarification.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 2 Medium severity

New issues introduced by this change (3)
Severity Finding
High severity docs/​design/​json-first-one-shot-sandbox-apis.md — Include the native runtime unit in Node migration View comment
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Define the optional-options ABI contract View comment
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Make the Koffi spawn API asynchronous View comment
Issues resolved since last review (3)
Severity Finding
Low severity docs/​design/​json-first-one-shot-sandbox-apis.md — Describe the actual one-shot parser path View resolved comment
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Resolve the synchronous spawn threading contradiction View resolved comment
Medium severity docs/​design/​json-first-one-shot-sandbox-apis.md — Preserve the testing-feature authorization flag View resolved comment
Previously missed findings (2)

In code that hasn't changed since last review

docs/design/json-first-one-shot-sandbox-apis.md:98

  • RunOptions advertises dryRun, but run_config returns a process Output even though no process or WaitOutcome exists in a dry run; the current streaming SDK run path also rejects requests marked dry-run. Specify whether this uses the engine's validation-only path and what Output/MxcRunResult contains, or use a dedicated validation result/remove this option, so each language does not invent different semantics.
    docs/design/json-first-one-shot-sandbox-apis.md:132
  • A thin wrapper cannot inspect process.timeout, but the current C# streaming wrapper reads SandboxPolicy.TimeoutMs and enforces an absolute deadline because mxc_sandbox_try_wait does not enforce it and a later blocking wait starts a fresh timeout budget. Require the returned native handle to retain and enforce the parsed deadline from spawn time, or expose that deadline to wrappers; otherwise SpawnConfig can silently run longer than the same config through current APIs/CLI.

Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated
Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated
Comment thread docs/design/json-first-one-shot-sandbox-apis.md Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Copilot AI review requested due to automatic review settings September 14, 2026 19:10

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.

Copilot review overview

🟡 Changes recommended

The PR metadata contradicts the proposal, and ABI evolution and cancellable-wait handling need clarification.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open findings (3)
Resolved findings (3)

Comment on lines +102 to +103
- Compatible changes append optional fields to the V1 types.
- Removing a field or changing its meaning requires a new V2 type.
Comment on lines +271 to +274
The adapter must preserve the C ABI's ownership and concurrency rules: calls
on a sandbox handle are serialized, separate stdin/stdout/stderr handles may
operate concurrently, and no handle is freed while an asynchronous call is
active.
Comment thread docs/design/typed-one-shot-sandbox-apis.md
@bbonaby Branden Bonaby (bbonaby) changed the title [Proposal] Make one-shot SDK APIs JSON-first [Proposal] Unify one-shot SDKs on typed requests Sep 14, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: bbe1ffbf-7cf8-48a0-8e3b-956f1d634e6c
Copilot AI review requested due to automatic review settings September 14, 2026 23:02

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.

Copilot review overview

🟡 Changes recommended

C ABI extensibility, V1 normalization semantics, and Node PTY compatibility remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review tier: Balanced
Findings: 2 High severity · 1 Medium severity

Open (3)
Resolved since last review (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Define V1's normalization version

docs/​design/​typed-one-shot-sandbox-apis.md:130

Removing the runtime version leaves normalization underspecified. The current Rust builder requires SandboxPolicy.version, copies it into ExecutionRequest.schema_version (src/core/mxc_engine/src/policy.rs:767-785,820-824), and backends branch on that value for different enforcement contracts (for example src/backends/bubblewrap/common/src/bwrap_command.rs:133-150). Without a fixed mapping, the same SandboxRequestV1 could receive 0.7 or 0.9 behavior depending on implementation/release, and the “equivalent executor JSON” criterion is ambiguous. Bind V1 to explicit, stable normalization semantics (and a schema version for JSON conversion), with semantic changes requiring V2.

Comment on lines +278 to +280
off the JavaScript event-loop thread. TypeScript marshals its V1 request into
the matching C request and option representations and adapts results and
handles to promises and Node streams.
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