Skip to content

fix(microsandbox): use msb run --detach with split entrypoint/cmd - #1105

Merged
skevetter merged 1 commit into
mainfrom
fix/microsandbox-entrypoint-cmd
Aug 18, 2026
Merged

fix(microsandbox): use msb run --detach with split entrypoint/cmd#1105
skevetter merged 1 commit into
mainfrom
fix/microsandbox-entrypoint-cmd

Conversation

@skevetter

@skevetter skevetter commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

msb create became boot-only upstream (superradcompany/microsandbox#1298, unreleased): the configured entrypoint no longer executes, so msb inspect reports the sandbox as running while the Devsy agent never starts.

Fix

Switch Create to msb run --detach. Instead of joining Entrypoint+Cmd into a single string and re-detecting shell-script shapes at the CLI boundary (the approach in #1036 — fragile: any argv shape the CLI's --entrypoint string can't represent gets silently dropped, running the image default instead), carry Entrypoint (string) and Cmd ([]string) separately on sandboxSpec, mirroring the split driver.RunOptions and the docker driver already use.

--entrypoint sets the executable; a trailing -- plus argv overrides the image CMD while preserving that entrypoint — this matches microsandbox's own OCI ENTRYPOINT/CMD resolution exactly, with no upstream fix required (see superradcompany/microsandbox#1340).

Fixes #1035. Supersedes #1036 (closing with credit to the original reporter/diagnosis).

Testing

  • go test ./pkg/driver/microsandbox/... — all pass, new cases cover: full spec, minimal spec, cmd-without-entrypoint, entrypoint-without-cmd.
  • golangci-lint run ./pkg/driver/microsandbox/... — 0 issues.
  • go build ./..., go vet (incl. microsandbox_integration build tag) — clean.

Summary by CodeRabbit

  • New Features

    • Improved sandbox startup with support for separate entrypoints and command overrides.
    • Added handling for sandbox names, images, runtime and resource settings, mounts, and optional egress restrictions.
    • Supports starting sandboxes in detached mode.
  • Bug Fixes

    • Ensures entrypoints and commands are passed independently, improving command execution behavior.

msb create became boot-only upstream (superradcompany/microsandbox#1298,
unreleased), so the microsandbox driver's entrypoint never executed and
the Devsy agent never started, even though msb inspect reported the
sandbox as running.

Switch Create to `msb run --detach`. Instead of joining Entrypoint+Cmd
into one string and re-detecting shell-script shapes (fragile: any
argv shape microsandbox's CLI --entrypoint can't represent would be
silently dropped, running the image default instead), carry
Entrypoint (string) and Cmd ([]string) separately on sandboxSpec, the
same split driver.RunOptions and the docker driver already use.
--entrypoint sets the executable; a trailing "--" plus argv overrides
the image CMD while preserving that entrypoint, matching
microsandbox's own OCI ENTRYPOINT/CMD resolution exactly.

Fixes #1035
@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit e604519
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a84d39b060764000861370a

@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 474f8cc9-894f-443c-bff9-ee2c3cd38e62

📥 Commits

Reviewing files that changed from the base of the PR and between 7f67331 and e604519.

📒 Files selected for processing (5)
  • pkg/driver/microsandbox/cliclient.go
  • pkg/driver/microsandbox/cliclient_test.go
  • pkg/driver/microsandbox/client.go
  • pkg/driver/microsandbox/microsandbox.go
  • pkg/driver/microsandbox/microsandbox_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The Microsandbox driver now stores entrypoints and commands separately. Create starts sandboxes with msb run --detach, including runtime options, resources, mounts, images, and optional commands.

Changes

Microsandbox run flow

Layer / File(s) Summary
Separate entrypoint and command specification
pkg/driver/microsandbox/client.go, pkg/driver/microsandbox/microsandbox.go, pkg/driver/microsandbox/microsandbox_test.go
sandboxSpec now stores Entrypoint and Cmd separately. buildSpec preserves both fields, and tests validate the separate values.
Detached run argument construction
pkg/driver/microsandbox/cliclient.go, pkg/driver/microsandbox/cliclient_test.go
Create now invokes msb run --detach. runArgs handles sandbox options, entrypoints, images, commands, resources, mounts, and egress denial. Tests cover full, minimal, command-only, and entrypoint-only cases.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to e6045

The change updates microsandbox command invocation and preserves separate entrypoint and command arguments; no actionable merge-blocking risk remains after normal checks and review.

Possibly related issues

Possibly related PRs

  • devsy-org/devsy#761 — Introduced the Microsandbox client and specification APIs changed by this PR.
  • devsy-org/devsy#1036 — Changes Microsandbox startup and runArgs handling in the same CLI client and tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: using msb run --detach and separating the entrypoint from the command.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/microsandbox-entrypoint-cmd

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@netlify

netlify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit e604519
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a84d39b97a157000885e4a6

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 1 medium

Alerts:
⚠ 1 issue (≤ 0 issues of at least minor severity)

Results:
1 new issue

Category Results
Complexity 1 medium

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@skevetter
skevetter marked this pull request as ready for review August 18, 2026 22:28
@mergify

mergify Bot commented Aug 18, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@skevetter
skevetter merged commit f6297e7 into main Aug 18, 2026
79 checks passed
@skevetter
skevetter deleted the fix/microsandbox-entrypoint-cmd branch August 18, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Upcoming Microsandbox msb create behavior change prevents Devsy agent from starting

1 participant