Repository navigation
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
`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>
…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>
Threat model review — advisoryReviewed head 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. 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. |
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 setupcould 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:
--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--planand to the install.--disk, at a prompt, without--yes, and from a release with work disks, setup lists the drives that can take the work, then asksChoose 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.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 asksTurn 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--yesor 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.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, thedisksstatus field). Changelog fragmentchangelog.d/sandbox-setup-work-disks.md.darkbloom sandbox statusreads the add-on'sdisksand shows oneWork diskline per disk when an external drive or more than one disk is in use, for exampleWork disk: /Volumes/FastSSD: online, 812 GiB free; slots: Linux 2, macOS 1. A disk that is not online adds the add-on'sdetail(what to do).Also:
--diskgoes 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--diskonly when the installed add-on reportsdisks. A set-up Mac given--diskruns 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.shpasses--diskto the installer (scripts/dev/addon-install.sh),installand--plantake repeated--disk(AgentCommandLine.swift,WorkDiskPlan.swift), the plan event'sdisksentries carrypath,root_volume,free_bytes,floor_bytes,linux_slots,macos_slots, andstatus --jsonreportsdiskswithpath,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"]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)"]Hooked up
Sandbox.Setup(darkbloom sandbox setup):--diskintoSandboxSetupOptions.disks.SandboxSetupFlow.run: first setup (checkMacthencheckWorkDisks, thenchooseWorkDiskinsidewithInstaller, beforesizeAndConfirm); rerun (checkWorkDisks);withInstaller(release gate);requestAddonPlan(plan refusal; takes the chosen options);printChangeHints(the--diskhint).checkWorkDisks→ownershipToTurnOn/turnOnOwnership→enableOwnershipseam →SandboxWorkDisk.enableOwnership→runInForeground(posix_spawnof/usr/bin/sudo -- /usr/sbin/diskutil enableOwnership <mount>, only stdio inherited).chooseWorkDisk→workDiskCandidatesseam →SandboxWorkDisk.candidates→SandboxTerminal.choose.SandboxInstaller.argumentsandplanArguments: each--disk <path>.SandboxSizingPlan.init(line:)andchecks: the plan'sdisks.SandboxAddonStatus.init(json:):supportsWorkDisksanddisks;SandboxStatusView.lines→diskLines(darkbloom sandbox status, and the report on a set-up Mac insetup).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/):problemfor each failure, in order (an unplugged drive's path on another drive that ignores ownership reads "not mounted", not "ownership off");candidatesagainst 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;minimumFreeBytesfor 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;runInForegroundandenableOwnershiprun nothing without a terminal in the foreground (stdin is a pipe);enableOwnershiprecords 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--planas--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:disksdecoding (null members, an entry without path skipped), the threeWork disklines afterImages, 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 disklines, docs). It made one behavior-preserving commit (98ed567):checkWorkDisksreads 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.checkbuilds the "cannot be read" refusal once, for a nil volume and for.unreadable. The two copies cannot drift.SandboxWorkDiskcomment says the check runs before setup installs anything. A drive picked from the list is checked afterinstall.shis downloaded.It kept the rest as it is, with these reasons:
runInForegroundusesposix_spawnwith 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--yesor without a terminal.chooseWorkDisk,checkWorkDisks,diskLines,candidatesandSandboxTerminal.chooseeach own one operation, with seams for the tests. Splitting them more would scatter one operation.install.sh --plan --disk,status --jsondisks). The docs match the code.Add-on release that first takes
--diskAdd-on 1.2.0 is the first release with work disks, from the darkbloom-sandbox record:
install --disk) merged tomasteron 2026-11-03 at 06:19 UTC. Before it, the add-on had no--disk.masterand qualified on 2026-11-03 at 20:11 UTC (darkbloom-sandboxAGENTS.md;docs/developer/agent-release-1.3.0.md: "Add-on 1.2.0 is already published to production, frommaster"). That is 14 hours after the merge.cache_bytes: 1.2.1;agent_sessions: 1.3.0) and leave the plan'sdisksunmarked.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
--planand--json-progress. 1.2.0 appears only in messages (SandboxWorkDisk.minimumAddonVersion).Decisions (David, 2026-11-04)
master. The other sandbox CLI PRs went tomaster(feat(provider): sandbox setup re-checks the add-on's plan on a set-up Mac and offers new slot counts #1735 merged there; fix(provider): sandbox commands pass Ctrl-C to their child, and setup shows installer lines as they arrive #1755 targets it).🤖 Generated with Claude Code