Skip to content

[Seatbelt] Remove the spawn-open launch method and replace probe with system-lib function check - #1511

Merged
Elliot (theelliotm) merged 4 commits into
mainfrom
user/emichlin/remove-open-launch-method
Oct 16, 2026
Merged

Elliot (theelliotm) merged 4 commits into
mainfrom
user/emichlin/remove-open-launch-method

Conversation

@theelliotm

@theelliotm Elliot (theelliotm) commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

📖 Description

The spawn-open launch method was removed in schema version 0.9. The code is currently unreachable. In addition, the probe for both spawn-exec and spawn-open checked for a file (/usr/bin/sandbox-exec) that only validates spawn-open would work.

This PR removes all code and documentation mentioning spawn-open, and replaces the probe with a check for the sandbox_init function symbol's existence in shared system libraries. This probe function is referenced by both Rust and Node.

New probe:

pub(crate) fn sandbox_init_available() -> bool {
    // SAFETY: `dlsym` only reads the NUL-terminated symbol name.
    !unsafe { libc::dlsym(libc::RTLD_SELF, c"sandbox_init".as_ptr()) }.is_null()
}

🔗 References

Resolves #1510

🔍 Validation

Lint, clippy, and full validation suite passed locally.

✅ Checklist

📋 Issue Type

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

@theelliotm
Elliot (theelliotm) requested a review from a team as a code owner October 15, 2026 20:56
Copilot AI balanced review requested due to automatic review settings October 15, 2026 20:57
@azure-pipelines

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

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.

🟡 Changes recommended

The symbol lookup can incorrectly report Seatbelt as unavailable when Node loads the native library with local visibility.

1 open finding
What changed in this PR

Removes the retired Seatbelt launch path and updates macOS availability detection to check sandbox_init, addressing #1510.

Changes:

  • Removes spawn_open, its configuration fields, helpers, and obsolete tests.
  • Shares native Seatbelt discovery with the Node SDK.
  • Updates documentation and adds macOS platform-support tests.
File Description
src/​mxc-sdk/​tests/​wxc_e2e_tests_e2e_seatbelt_characterization.rs Updates test commentary.
src/​mxc-sdk/​src/​core/​mxc_engine/​probe.rs Uses symbol-based detection.
src/​mxc-sdk/​src/​core/​mxc_engine/​platform.rs Updates availability check and diagnostic.
src/​mxc-sdk/​src/​core/​mxc_common/​wire.rs Removes launch-method field and enum.
src/​mxc-sdk/​src/​core/​mxc_common/​models.rs Removes legacy launch configuration.
src/​mxc-sdk/​src/​core/​mxc_common/​config_parser.rs Removes launch-method mapping.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​v1_0/​one_shot.rs Removes obsolete field initialization.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​v1_0/​one_shot_tests/​stable_candidate.rs Removes obsolete assertions.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​v0_9/​one_shot.rs Removes obsolete field initialization.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​v0_9/​one_shot_tests/​stable_candidate.rs Removes obsolete assertions.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​dev/​one_shot.rs Removes obsolete field initialization.
src/​mxc-sdk/​src/​core/​mxc_common/​config_contract_adapters/​dev/​one_shot_tests/​stable_candidate.rs Removes obsolete assertions.
src/​mxc-sdk/​src/​backends/​seatbelt/​common/​seatbelt_runner.rs Deletes LaunchServices execution; adds symbol probe.
src/​mxc-sdk/​src/​backends/​seatbelt/​common/​profile_builder.rs Clarifies profile documentation.
src/​mxc-sdk/​src/​backends/​seatbelt/​common/​mod.rs Corrects backend documentation.
src/​mxc-sdk/​README.md Removes legacy PTY restriction text.
sdk/​node/​tests/​unit/​platform.test.ts Adds macOS discovery projection tests.
sdk/​node/​src/​v1/​platform.ts Uses native discovery on macOS.
sdk/​node/​src/​v1/​container.ts Corrects profile application commentary.
sdk/​node/​README.md Removes legacy PTY restriction text.
sdk/​dotnet/​README.md Removes legacy PTY restriction text.
docs/​development/​plans/​backend-support-probe-api.md Documents revised macOS discovery.
docs/​backends/​seatbelt/​seatbelt-backend.md Removes retired launch-path documentation.
docs/​api-reference/​rust/​v1/​api.md Updates PTY restrictions.
docs/​api-reference/​node/​v1/​api.md Updates PTY restrictions.
docs/​api-reference/​dotnet/​v1/​api.md Updates PTY restrictions.
.github/​workflows/​Build.MacOS.Job.yml Updates test prerequisite commentary.

🧠 Review effort: Balanced


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

Comment thread src/mxc-sdk/src/backends/seatbelt/common/seatbelt_runner.rs Outdated
Copilot AI balanced review requested due to automatic review settings October 15, 2026 21:50

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.

🟡 Changes recommended

The new integration test uses a URL-escaped working directory, causing failures in checkout paths containing spaces or non-ASCII characters.

1 open finding
1 resolved since last review

🧠 Review effort: Balanced

Comment thread sdk/node/tests/integration/macos-seatbelt.test.ts Outdated
Copilot AI balanced review requested due to automatic review settings October 15, 2026 22: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.

🟢 Approval recommended

The scoped cleanup preserves supported execution behavior, and the revised discovery includes success and failure coverage with no blocking issues identified.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

PlatformSupport {
reason: Some(
"/usr/bin/sandbox-exec not found; macOS install is incomplete".to_string(),
"sandbox_init is unavailable; macOS install is incomplete".to_string(),

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.

thought: thinking about all the updated error messages in this PR that reference "sandbox_init" I'm thinking we should make it more consumer friendly. Something like "Seatbelt support through MXC is unavailable" or something a long those lines. Thoughts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Will update it to say "Seatbelt could not be found on this installation of macOS. Your macOS install might be incomplete. (sandbox_init not found)"

/// given permissions mode. Uses `O_CREAT | O_EXCL` (create_new) to avoid
/// symlink-following and collisions, and sets permissions immediately after
/// creation on the open file descriptor to close the TOCTOU window.
fn write_secure_temp_file(

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.

question: Was this code for the launch method stuff only?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Copilot AI balanced review requested due to automatic review settings October 16, 2026 00:08

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.

🟢 Approval recommended

The scoped cleanup preserves supported execution behavior, and the shared detection changes have targeted coverage with no identified blocking issues.

0 open findings

🧠 Review effort: Balanced

Comment on lines +438 to 439
support.reason = 'Seatbelt could not be found on this installation of macOS. Your macOS install might be incomplete. (sandbox_init not found)';
}

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.

note: we'll have to see how we can get this error message from the ffi directly so we don't have to add it in all the sdks. Do note though that I don't see an update to the .NET sdk for this. Was it already there?

@theelliotm
Elliot (theelliotm) merged commit 28fbad4 into main Oct 16, 2026
31 checks passed
@theelliotm
Elliot (theelliotm) deleted the user/emichlin/remove-open-launch-method branch October 16, 2026 05:32
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.

[Seatbelt] Remove spawn_open launch method from code

3 participants