Skip to content

Sandbox setup: choose an external drive for the VM images and jobs (--disk, a drive list, the ownership fix), and show work disks in status - #1759

Merged
davidtai merged 6 commits into
masterfrom
fb/193-disk
Nov 5, 2026
Merged

davidtai merged 6 commits into
masterfrom
fb/193-disk

Conversation

@davidtai

@davidtai davidtai commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Refs Layr-Labs/darkbloom-sandbox#193 (choose an external drive in darkbloom sandbox setup).

What changed and why

The Sandbox add-on can put its VM images and job disks on external APFS drives (install --disk). darkbloom sandbox setup could not use this: it passed only the slot options. Owners had to run the raw installer, format the drive and turn ownership on by hand. Owners ask for this to save internal-disk space and wear.

This PR does the five steps of the request:

  1. --disk <volume> (repeatable). Setup makes each path absolute (~ expanded; a relative path from the current directory, because the installer runs in its own temporary directory). It gives each path, in order, to the installer's --plan and to the install.
  2. Drive choice. On a first setup without --disk, at a prompt, without --yes, and from a release with work disks, setup lists the drives that can take the work, then asks Choose 1-N [1]:. A drive is listed when it is mounted at its own /Volumes/<name>, shows in Finder, is local, writable and APFS, and has room for its floor (a tenth of the drive, 50 to 100 GiB) plus a Linux job and its images (34 GiB). Enter, or the end of input, keeps the internal disk. A chosen drive gets the drive check (below) and goes to the plan and the install as one --disk.
  3. Drive check and ownership. Before anything is installed, setup checks each drive with statfs: mounted where the path says, APFS, ownership on. With ownership off, setup prints the exact command (sudo diskutil enableOwnership /Volumes/FastSSD). At a prompt, it asks Turn ownership on for /Volumes/FastSSD now? (default no). On yes, it runs the command in the terminal's foreground process group, so sudo asks for the password itself; the CLI never reads it. Then it checks the drive again. With --yes or without a terminal, it prints the command and stops, as before. A drive that is not APFS gets the Disk Utility fix. Setup never formats a drive. The installer checks each drive again by the add-on's full rules (local, writable, not a disk image); when the plan refuses a drive (exit 2), setup shows the installer's fix and keeps its exit status.
  4. Docs. docs/provider/sandboxes.md ("Use an external drive": Thunderbolt or USB4 NVMe, APFS, ownership, keep it connected, the drive choice, the ownership offer, troubleshooting rows). docs/provider/cli-reference.md (flag, setup steps, drive choice, plan fields, rerun table, the disks status field). Changelog fragment changelog.d/sandbox-setup-work-disks.md.
  5. Status. darkbloom sandbox status reads the add-on's disks and shows one Work disk line per disk when an external drive or more than one disk is in use, for example Work disk: /Volumes/FastSSD: online, 812 GiB free; slots: Linux 2, macOS 1. A disk that is not online adds the add-on's detail (what to do).

Also: --disk goes only to an installer whose text names --disk. With an earlier release, setup says that work disks need add-on 1.2.0 or later and changes nothing. On a Mac that is set up, setup suggests --disk only when the installed add-on reports disks. A set-up Mac given --disk runs the installer again ("Applying the new work disks.") after the drive check.

Add-on side. No add-on change is needed. On darkbloom-sandbox master, install.sh passes --disk to the installer (scripts/dev/addon-install.sh), install and --plan take repeated --disk (AgentCommandLine.swift, WorkDiskPlan.swift), the plan event's disks entries carry path, root_volume, free_bytes, floor_bytes, linux_slots, macos_slots, and status --json reports disks with path, root_volume, state, detail, free_bytes, slots (ProviderStatus.swift). The CLI reads exactly these keys.

Before

flowchart TD
    A["darkbloom sandbox setup --linux-slots/--macos-slots"] --> B["Check this Mac"]
    B --> C["Download install.sh"]
    C --> D["install.sh --plan (slot options only)"]
    D --> E["install.sh (slot options only)"]
    X["Owner wants an external drive"] -.-> Y["Run the raw installer by hand;<br/>format and enableOwnership by hand"]
    S["darkbloom sandbox status"] --> T["No work disk lines"]
Loading

After

flowchart TD
    A["darkbloom sandbox setup [--disk /Volumes/X ...]"] --> B["Check this Mac"]
    B --> W{"Each --disk (statfs):<br/>mounted, APFS, ownership on?"}
    W -- "ownership off, at a prompt" --> O["Offer: sudo diskutil enableOwnership<br/>(sudo asks for the password); check again"]
    W -- "other failure, or no prompt" --> F["Print the fix; stop, nothing installed"]
    O -- "still off" --> F
    W -- "ok" --> C["Download install.sh"]
    O -- "on" --> C
    C --> V{"--disk given and the script<br/>does not name --disk?"}
    V -- "yes" --> G["Say work disks need add-on 1.2.0+; stop"]
    V -- "no" --> M{"First setup, no --disk, at a prompt,<br/>script names --disk, drives to offer?"}
    M -- "yes" --> N["List drives; Choose 1-N [1]<br/>chosen drive: same check"]
    M -- "no" --> D
    N --> D["install.sh --plan [--disk ...]"]
    D -- "refused (exit 2)" --> H["Show the installer's fix; exit 2"]
    D -- "plan" --> P["Plan lines + one Work disk line per disk"]
    P --> E["install.sh [--disk ...]"]
    S["darkbloom sandbox status"] --> T["One Work disk line per disk<br/>(external or several)"]
Loading

Hooked up

  • Sandbox.Setup (darkbloom sandbox setup): --disk into SandboxSetupOptions.disks.
  • SandboxSetupFlow.run: first setup (checkMac then checkWorkDisks, then chooseWorkDisk inside withInstaller, before sizeAndConfirm); rerun (checkWorkDisks); withInstaller (release gate); requestAddonPlan (plan refusal; takes the chosen options); printChangeHints (the --disk hint).
  • checkWorkDisks → ownershipToTurnOn / turnOnOwnership → enableOwnership seam → SandboxWorkDisk.enableOwnership → runInForeground (posix_spawn of /usr/bin/sudo -- /usr/sbin/diskutil enableOwnership <mount>, only stdio inherited).
  • chooseWorkDisk → workDiskCandidates seam → SandboxWorkDisk.candidates → SandboxTerminal.choose.
  • SandboxInstaller.arguments and planArguments: each --disk <path>.
  • SandboxSizingPlan.init(line:) and checks: the plan's disks.
  • SandboxAddonStatus.init(json:): supportsWorkDisks and disks; SandboxStatusView.lines → diskLines (darkbloom sandbox status, and the report on a set-up Mac in setup).

How it was tested

No local build or test runs (repository rule for this work). The CI checks on this PR are the test.

SandboxWorkDiskTests (provider-swift/Tests/DarkbloomCLITests/):

  • parsing and arguments; add-on support; the rerun decision;
  • the drive check and problem for each failure, in order (an unplugged drive's path on another drive that ignores ownership reads "not mounted", not "ownership off");
  • candidates against a temporary /Volumes: only mounted, Finder-visible, local, writable, APFS drives with room are listed, sorted; the startup disk's link, a share, a read-only, a hidden, an exFAT and a too-small drive, and dot names, are not; a drive with ownership off is listed; minimumFreeBytes for a 2 TB drive is 134 GiB;
  • SandboxTerminal.choose: Enter and end of input give 1; out-of-range and non-number answers ask again;
  • runInForeground and enableOwnership run nothing without a terminal in the foreground (stdin is a pipe);
  • flows against the fake installer: ownership off without a prompt stops before any download; the ownership offer accepted (the fake enableOwnership records the mount, the drive passes on the second check, the plan follows); the command fails ("Ownership is still off", exit 1, no download); the drive menu (choice 2 goes to --plan as --disk /Volumes/FastSSD); a release without --disk; first setup with a disk; a plan that refuses a disk (exit 2); a rerun with a disk; the hint.

SandboxStatusTests.workDisks: disks decoding (null members, an entry without path skipped), the three Work disk lines after Images, and no line for the internal disk alone.

The previous head's only red check was shard 3's MiMoV26ManagedAudioProviderTests.testNativeAudioReleaseAcceptsOpenRouterAACVideoThroughAuthenticatedHTTP (XCTAssertEqual failed: ("1") is not equal to ("0")), in MiMo audio, which this PR does not touch.

Refactor pass

The first two commits had their refactor pass by a separate subagent (helpers for option detection and job-count wording, a relative-path guard, clearer stop lines).

A dedicated refactor subagent reviewed the drive-choice commit (4010d44: drive list, ownership offer, Disk Utility fix, status Work disk lines, docs). It made one behavior-preserving commit (98ed567):

  • checkWorkDisks reads each drive's volume once and gives it to the check and to the ownership offer. Before, it read the volume a second time for the offer.
  • SandboxWorkDisk.check builds the "cannot be read" refusal once, for a nil volume and for .unreadable. The two copies cannot drift.
  • The SandboxWorkDisk comment says the check runs before setup installs anything. A drive picked from the list is checked after install.sh is downloaded.

It kept the rest as it is, with these reasons:

  • runInForeground uses posix_spawn with only stdio inherited (POSIX_SPAWN_CLOEXEC_DEFAULT), in the CLI's own process group. sudo reads the password; the CLI never does. sudo runs only after a yes at the prompt (default no), never with --yes or without a terminal.
  • chooseWorkDisk, checkWorkDisks, diskLines, candidates and SandboxTerminal.choose each own one operation, with seams for the tests. Splitting them more would scatter one operation.
  • No output line, flag, test or add-on key changed (install.sh --plan --disk, status --json disks). The docs match the code.

Add-on release that first takes --disk

Add-on 1.2.0 is the first release with work disks, from the darkbloom-sandbox record:

  • Layr-Labs/darkbloom-sandbox#155 (install --disk) merged to master on 2026-11-03 at 06:19 UTC. Before it, the add-on had no --disk.
  • Add-on 1.2.0 was published to production from master and qualified on 2026-11-03 at 20:11 UTC (darkbloom-sandbox AGENTS.md; docs/developer/agent-release-1.3.0.md: "Add-on 1.2.0 is already published to production, from master"). That is 14 hours after the merge.
  • The add-on's release docs mark later fields by release (cache_bytes: 1.2.1; agent_sessions: 1.3.0) and leave the plan's disks unmarked.
  • Limit: the add-on repository has no tags or GitHub releases, and it records no source commit for the 1.2.0 publish. To prove it before a reply to providers, run one read-only check of the public installer: curl -fsSL https://api-sandbox.darkbloom.dev/install.sh | grep -c -- '--disk'. A result of 1 or more means the release on offer takes --disk.

The CLI does not depend on the number. It reads the installer's text, as for --plan and --json-progress. 1.2.0 appears only in messages (SandboxWorkDisk.minimumAddonVersion).

Decisions (David, 2026-11-04)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 5, 2026 12:33am UTC
d-inference-console-ui-dev Error Error Nov 5, 2026 12:33am UTC
d-inference-landing Ready Ready Preview Nov 5, 2026 12:33am UTC
darkbloom-status Ready Ready Preview Nov 5, 2026 12:33am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 5, 2026 12:33am UTC

Request Review

davidtai and others added 3 commits November 3, 2026 17:17
`darkbloom sandbox setup --disk <volume>` (repeatable) passes each drive,
as an absolute path, to the add-on installer's plan and install. Before
anything is downloaded, setup checks each drive with statfs: mounted at
its /Volumes/<name>, APFS, ownership on. With ownership off it prints the
exact `sudo diskutil enableOwnership <volume>` line and stops; it never
runs sudo or formats a drive.

--disk goes only to an installer that names it; otherwise setup says work
disks need add-on 1.2.0 or later and changes nothing. A set-up Mac offers
--disk only when its add-on's status reports disks. The plan's `disks`
render as one Work disk line each, and a plan that refuses a disk stops
setup with the installer's fix and exit status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers, relative-path guard, clearer stop lines)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tests capture no locals)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owner agrees, show work disks in status

- A first setup without --disk, at a prompt and from a release with work
  disks, lists the drives mounted at their own /Volumes/<name> that show in
  Finder and are local, writable and APFS, with room for the floor and a
  Linux job. Enter keeps the internal disk; a chosen drive gets the work disk
  check and goes to the plan and the install as one --disk.
- With ownership off, at a prompt and without --yes, setup offers to run
  sudo diskutil enableOwnership in the terminal's foreground process group
  (sudo asks for the password), then checks the drive again. Otherwise it
  prints the command and stops, as before. Setup never formats a drive.
- darkbloom sandbox status reads the add-on's disks and shows one Work disk
  line per disk (state, free space, slots, and the add-on's detail when a
  disk is not online) when an external drive or more than one disk is in use.

Refs Layr-Labs/darkbloom-sandbox#193

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@davidtai davidtai changed the title Sandbox setup: put the VM images and jobs on external drives (--disk) Sandbox setup: choose an external drive for the VM images and jobs (--disk, a drive list, the ownership fix), and show work disks in status Nov 4, 2026
…one unreadable line)

- checkWorkDisks reads each drive's volume once and gives it to both the
  Work disk check and the ownership offer; it read the volume twice before
  the offer.
- SandboxWorkDisk.check builds the "cannot be read" refusal once for the
  nil volume and the unreadable problem, so the two cannot drift.
- The type's comment says the drive check runs before setup installs
  anything: a drive picked from the list is checked after install.sh is
  downloaded.

No change to output, flags or the add-on contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Threat model review — advisory

Reviewed head 37304d7d8713 against base e8f3d53f6d49.

Reviewers: anthropic/claude-sonnet-5.5: first pass completed; anthropic/claude-opus-5.5: selected depth completed (8 batches); openai/gpt-6.1-sol: selected depth completed (3 batches)

No actionable findings in the reviewed text. This is not a security approval.

Models: budgeted Sonnet / selective Opus / selective Sol 6.1. Findings require human validation; this review never requests changes or blocks merging.

Scan completed; human review required.
Cross-file reviewer requests further review; independent human review required; Final reviewer requests further review; independent human review required

Coverage: 64/64 source units; cross-file integration complete. 0 selected depth batch(es) pending. All threat definitions indexed; relevant full definitions selected. Unchanged callers are not scanned.

Cost this run: $0.0000 reported, $0.0000 reserved with unknown cost; 0 paid request(s), 0 reused batch(es), 0 provider cache-hit tokens.

Saved findings and earlier report · Historical findings are not confirmed resolved.

Bedrock: 27 request(s), 1199034 uncached + 0 cache-read + 117305 cache-write input / 25713 output tokens; 0 request(s) with unknown usage. OpenRouter backup used 0 time(s). Dollar amounts above cover OpenRouter only; AWS billing is reconciled separately.
Workload allowance: 28 native request(s), including one shared response repair; 500 emergency ceiling. Selected depth and integration rounds are admitted as their scope becomes known.

This branch had an error being deployed

2 failed and 3 active deployments
Preview – eigen-homepages-darkbloom — 37304d7d Deployed Nov 5, 2026 by vercel[bot]
Preview – d-inference-landing — 37304d7d Deployed Nov 5, 2026 by vercel[bot]
Preview – darkbloom-status — 37304d7d Deployed Nov 5, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 37304d7d Deployed Nov 5, 2026 by vercel[bot]
Preview – d-inference — 37304d7d Deployed Nov 5, 2026 by vercel[bot]
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.

2 participants