272 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 dd46dd7a0f feat(tools): tool images build side by side
A first run built its tool images one after another, each paying a
build VM's boot (5.7 s on vz, 9.3 s on QEMU) before a download of a few
seconds to a minute. Share.Build now hands the images out to up to four
slots (buildAll), each slot's builds one after another in a build VM of
its own:

- slots: as many as the host's memory, less what the backend's running
  VMs have, and its CPUs give a build VM of 2 GiB and 2 CPUs each after
  keeping 6 GiB and 2 CPUs, at most backend.MaxToolSlots (4) and the
  number of images; one alone keeps base's size. A backend that can't
  list its VMs builds one at a time. A running VM's memory counts whole
  (7.5 GiB, not 7): TestBuildSlotsFit's running VMs fail when it isn't
  counted or is truncated.
- plan lowers the slots until the backend's disks have room:
  Floors.ForTools counts Tools once for each build VM at once, as on a
  disk without copy on write each is a whole copy of base.
- backend.ToolsSpec gets Slot, Slots, Size and Hold; Lima's slot VMs are
  the constants ToolsVM to ToolsVM4, sized with --cpus/--memory, and the
  first slot's build deletes what a killed run left in the slots this
  run doesn't use. Builds hold the share's lock, so one devvm uses the
  slots.
- A failed build's VM goes in the run's cleanup, which runs after the
  build let go of the share's lock: it deletes the VM only once it has
  the lock again (ToolsSpec.Hold, Env.holdShare's TryLockFile), and
  leaves it while another devvm holds it (a build, gc or the daily
  refresh) (TestBuildToolsCleanupHolds, TestBuildHoldsShareForCleanup).
  The next tools build deletes what it finds in the slots, and so does
  devvm gc, which holds the share's lock: backend.Images'
  DeleteToolsLeft, Lima's deleting the slots' build VMs that are there
  and no other VM, which gc asks of every backend first, without
  asking, a backend that can't being a run log line. It returns what
  it deleted, which gc names in one line (tools_build_vms_deleted), and
  gc then never says nothing_to_clean or nothing_deleted
  (gc_tools_build.txtar, TestDeleteToolsLeft in lima and vm, the fake's
  ToolsLeft). The cli skill's judgment.md names this exception to "gc
  --force deletes exactly what gc lists". The conformance suite's
  delete-tools-left checks that it deletes no other VM, not even the
  project VM of a folder named tools (devvm-tools-<hash>), and no image
  (TestConformanceFinds: deletesAllVMs, deletesImage, deletesByPrefix).
  The share's lock
  is the data folder's, so devvms with their own data folders and one
  Lima home don't exclude each other's builds: the docs say not to build
  tools or run gc in two at once (a lock per build VM in the Lima home
  would close it, but it would replace Hold and needs e2e).
- Side by side, one status line covers the builds
  (building_tools_together), and their commands' lines in the run log
  are tagged with their tool (msg.WithLogTag): the UI's LoggedCmd
  prefixes them and shows no status line of its own. Every write starts
  with the tag, as does every line in it, one ended by "\r" included,
  so no build can pass a line off as another's (TestTaggedWrites), and
  a tool's lines are found after another's "\r" (taggedLines splits
  there, a progress bar's updates staying one line: TestTaggedLines). The
  first failure cancels the others and is what Build returns, tagged
  (backend.LoggedIn), so ErrorLogged shows that tool's lines' end.
- A test build's DEVVM_TOOL_SLOTS caps the slots; the CLI tests set 1,
  so the stub's calls keep their order, and tools_side_by_side.txtar
  sets 3, with an interrupt that leaves no build VM. The stub keeps each
  build VM's folder by its name, and the fake backend's BuildTools runs
  its builds outside its lock, as a real backend's would, passing
  ToolsBuild its context.

Docs: images.md's Building tools and Free space, ports-size.md,
space.md, images.md (using) and gc's help (the build VMs gc deletes),
settings.md (one Lima home for two data folders), extending.md,
testing.md and tests.md; the cli skill's judgment.md; the CHANGELOG's
first highlight and the release page's A faster first run.

New messages: building_tools_together, tools_build_vms_deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 22:57:15 -07:00
w3cjandClaude Opus 5.5 b625469ac6 fix(vm): devvm rm asks before opencode's worktrees' uncommitted changes go
An export leaves out opencode's worktree folder, as a git repository's config can name a command that git runs, so the uncommitted changes in the worktrees opencode makes there (~/.local/share/opencode/worktree/<project>/<name>, opencode v2.4.1's worktree/strategies.ts) went with the VM's disk on devvm rm, and on a remake with --clean-home, with nothing to say so.

The registry gets Worktrees (opencode's worktree/*/*, below its HistoryOwn, TestDefsComplete holding each to a plain pattern there). rm's unsaved-work check, cloneCheck, becomes workCheck: the clone (cloneLost, as before) and the agents' worktrees (agentTrees), one question for both. agentTreesState reads them in the running VM in one command, in its home folder, each * of a pattern sent as *, .[!.]* and ..?* (treeGlobs), so a name that starts with a dot is found: each folder with a .git, its git status and a detached HEAD's commit nothing else has; past 100 it says more. devvm reads at most 8 MiB of the answer, cancelling the command past it, and waits at most treesWait (2 minutes). parseAgentTrees takes the answer as untrusted: whole records of a glob asked for, each path clean, matched by its pattern and once, at most 100, each with one status. Dirty, detached, unreadable (wfail) and more are shown and asked about (delete_anyway or remake_anyway), which --force never answers; refused without a terminal (no_terminal_delete_trees, naming --no-worktree-check, or the clone's no_terminal_delete when it has work too). --no-worktree-check skips the check and warns (trees_check_skipped). A failed, late or hostile answer keeps the VM (trees_check_failed), and so does a VM that doesn't start for it (trees_check_not_started).

Rm and rmGone run it, and rmGone refuses a stopped VM with opencode, which starting would make its folder again (rm_gone_stopped_trees, naming --no-export --no-worktree-check); stillGone takes the refusal to give. remaking.checkWork runs it before a remake with --clean-home (remakeTo, Update, SetClone, whose clone check it joins), its messages naming the command as typed (remakeInVM.typed), with --clean-home, which --no-worktree-check needs (needs), so devvm clone off --clean-home's clone check messages name it too. A remake's flag has its own help. The stub guest runs the read in vmhome-<vm>.

Tests that fail without the check: TestRmAgentTrees, TestRmVMAgentTrees, TestRemakeAgentTrees, TestUpdateAgentTrees, TestSetCloneAgentTrees and the rm_agent_trees script; TestAgentTreesBounded (an endless answer cancelled, a silent VM given up on, in a synctest bubble); TestAgentTreesState runs the script under sh on real worktrees, a dot-named one included; TestParseAgentTrees holds the answer's checks, TestCloneGit the stub's. TestSetCloneOff names the command with --clean-home. e2e's network section makes a worktree in opencode's folder in the real VM, and devvm rm refuses, then --no-worktree-check deletes it.

Docs: coding agents' opencode's worktrees, How it works' opencode's worktrees, deleting a VM, a VM whose folder is gone, images, clone, the overview's remake, Commands, extending and rm's help; the changelog's What to do step 4 names --no-worktree-check for scripts and devvm rm VM of a stopped VM, and opencode's block gets the check; the release page has its section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:03:05 -07:00
w3cjandClaude Opus 5.5 b3e614743d fix(agents): opencode's service settings never reach the store or VMs
opencode 2 keeps its background service's settings in ~/.config/opencode/service.json, or service-<channel>.json on another channel (opencode v2.4.1's service-config.ts): the service's password, which the service makes when the file has none, and with remote access on, the secret route its address is served on and remoteAccepted. devvm agent import, and devvm agent save, copied every file of opencode's folder into the store, so every VM with opencode got a copy at each launch, with devvm-redacted in place of the password and the route as it was: each such VM's service took the known password devvm-redacted.

The agents' registry gets FolderOwn, the names of a WholeFolder agent's entries that are each machine's own; MachineOwn covers them, so agentFiles, agentDirs, agentLinks and listedPath leave them out: the import never copies them, no VM gets them from a store that holds them, and the save's script never sends the VM's own (which would have made the save fail). cleanStore (cleanSeeds, which now also runs cleanFolderOwn through the shared cleanOwn) takes them out of the store at a start, warning once (agent_store_own_cleaned, agent_store_own_clean_failed). The setup gets machine-own (agents.MachineOwnFiles) and DEVVM_REDACTED (agentlogin.RedactMark, exported, and now the one source of the placeholder in agentlogin's copies), and sync.sh's clean_machine_own takes out each regular file of those names that holds the placeholder, failing the setup with the cause when it can't, so the VM's opencode makes its own password; opencode service get password shows it.

Tests that failed first: TestSeeds' MachineOwn cases, TestOpencodeServiceNotImported, TestOpencodeServiceNotStaged, TestOpencodeServiceNotSaved, TestCleanStoreOpencodeService and TestSyncCleansMachineOwn. e2e's network section plants the store's service.json and checks the start takes it out, no VM gets its password or route, two VMs' passwords differ, and a launch takes out devvm's old copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 16:16:12 -07:00
w3cjandClaude Opus 5.5 394869407b test(e2e): Claude Code's login check asks for its full sign-in link
Since 2.1.330, Claude Code's sign-in link is a short one without the
state, which the check pastes back as code#state. Its documented
CLAUDE_CODE_FULL_SIGN_IN_LINK=1 prints the full link again, for scripts
that read the link, so the check sets it in the VM's login shells before
devvm agent login claude; earlier releases ignore it.

e2e's lock moves Claude Code from 2.1.327 to 2.1.331; nothing else moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 15:22:38 -07:00
w3cjandClaude Opus 5.5 9acdd0c47c fix(agents): history exports leave out opencode's machine key
opencode 2.4 keeps the private Ed25519 key of its home, which every machine it pairs with `opencode machine add` trusts and which it never replaces, in ~/.local/state/opencode/machine/home-key. That folder is in opencode's History, so devvm history export, and the exports devvm rm and a remake write, copied the key onto this machine, and devvm history import wrote it into other VMs, with the background service's registration (service.json and its .pty-handoff, the service's password and a handoff ticket) and the terminals' daemons (pty, their sockets and access tokens).

The agents' registry gets HistoryOwn: what of an agent's history is the VM's own as a machine. HistoryExcludes() returns it after each agent's HistoryExcludes, so the export leaves it out and the import never writes it, by its paths after it unpacks too. HistoryLogins() is each agent's HistoryExcludes alone, which a remake's home copy (homeSkips) leaves out, so a remade VM, the same machine, keeps its key. The copy of opencode's database empties its machine table (opencodeLogins), the paired machines' public keys, which are the VM's own pairings.

opencode's schema fixture moves to 2.4.1 (testdata/opencode-2.4.1.sql, from its release's schema.gen.ts, which matched 2.2.5's VM-printed file line for line): automation replaces schedule and is kept; machine is emptied.

Tests: TestHistoryExportRuns, TestHistoryImportRuns and TestHistoryImportV010 plant the key, service.json, its handoff and pty, and fail without the fix; TestHomeSkipsEveryLogin checks each HistoryExcludes is skipped and each HistoryOwn kept in a remake; TestLists covers HistoryLogins; e2e's network section plants the key in a VM and finds it in no export.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 15:22:38 -07:00
w3cjandClaude Opus 5.5 82f075c5bd build(deps): bump pins
scripts/bump.sh's safe bumps, patches and minors:

- images: mise 2026.11.10 -> 2026.11.14 (base and the host's, with
  internal/tools/mise.go's checksums), nix 2.35.6 -> 2.36.0, Docker's
  buildx 0.39.0 -> 0.39.1 and model 1.2.9 -> 1.2.10
- e2e: the lock's pnpm 12.21.0 -> 12.23.0, bun 1.4.4 -> 1.4.5, codex
  0.169.1 -> 0.171.0, opencode 2.3.2 -> 2.4.1, pi 1.5.2 -> 1.6.0;
  --from's node:24 by its new digest
- dev-tools: nilaway to its newest commit's pseudo-version
  (0.0.0-20261124161746-91ad9bf5d8e6), goreleaser 2.20.3, vale 3.28.1,
  markdownlint-cli2 0.24.2, whose lock folder moves to
  .mise/locks/markdownlint-cli2/0.24.2/, zizmor 1.33.1, with mise.lock
- ci: the workflows' mise 2026.11.14, jdx/mise-action v5.3.0,
  amannn/action-semantic-pull-request v6.1.4

The e2e lock keeps Claude Code at 2.1.327: 2.1.328 made its sign-in link
much shorter, without the state parameter that the network section's
login check reads to answer it, so with 2.1.330 that check and the
refresh after it fail. devvm itself never reads the link.

mise's and Nix's new checksums match upstream's SHASUMS256.txt and
.sha256 files; buildx and model are apt packages from Docker's signed
repository. Cursor's CLI stays on 2026.11.17-f532c45: 2026.11.22-e9042b2
is out, and it moves only when named. pflag stays held below 1.1.0 and
Node on 24.

The new nilaway no longer reports three of agentsave.go's bounds
findings, so their lines leave testdata/nilaway-baseline.txt, which
nilaway and nilaway:linux fail on while they're stale.

The CHANGELOG's Unreleased has the pins line, and the 0.2.0 page a
section for them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 14:35:10 -07:00
w3cjandClaude Opus 5.5 b7178b0dc8 docs: the design notes move to Contributing
The design notes are for contributors: they hold each emulation's
design note, its threat check and its tests, with hundreds of Go
identifiers, so the page moves from How it works to Contributing
(weight 8, after Writing docs), keeping its title and anchors. An
alias keeps /docs/internals/design/ working, as a redirect to the new
page.

Every reference follows: the internals, using, safety and contributing
pages' links, the page's own links to the How it works pages, the
section index pages, AGENTS.md's Backends rule, contributing/docs.md's
What goes where, internal/proxy/README.md and two e2e comments.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 22:49:50 -07:00
w3cjandClaude Opus 5.5 947decb301 fix(vm): VMs get the host terminal's COLORTERM (fixes #54)
limactl shell asks ssh to send COLORTERM (SendEnv), but its session
rides Lima's shared ssh connection (ControlMaster), opened without it,
and the master filters a session's environment by its own SendEnv, so
the variable never reached the VM (lima-vm/lima#2208, #1481). Closing
that connection would end every session and the VM's SSH agent relay,
so devvm now sets COLORTERM in the command it runs in the VM instead:

- backend.ShellOpts and ExecOpts get ColorTerm. Lima's Exec runs
  `cd D && export COLORTERM=<quoted> && exec argv`, and its Shell, with
  a ColorTerm, runs `sh -c 'export COLORTERM=<quoted> && exec "$SHELL"
  --login'`, as limactl shell does without a command; without one, the
  argv is as it was. colorTerm (lima) quotes the value with shell.Quote
  and links Lima #2208, so it can go once Lima sends it.
- vm's colorTerm is the one allow-list: only truecolor and 24bit pass,
  anything else or none is "". target.shell (devvm's shell) and
  AgentLogin.loginOpts (an agent's login on a terminal) fill it from
  Env.Getenv; no other command in the VM gets it.
- devvm's ssh config entries add `SendEnv COLORTERM`, so plain ssh by
  name (ControlMaster no) sends it: the e2e showed the base's sshd has
  AcceptEnv COLORTERM. It adds to a Host *'s SendEnv.

Tests, each failing without the fix: TestExecAndShellColorTerm (lima),
TestColorTerm (vm: the shell's and the login's value for allowed,
near-miss and injection-shaped values), testdata/script/colorterm.txtar
(the stub limactl's argv for the shell and an agent's login), ssh.txtar
and sshconfig's pinned lines, and e2e: a fresh VM's first shell, a
login shell on a terminal in the folder (24bit, and none for another
value) and ssh devvm-web. The structure test's dynamicScripts lists
both new built scripts.

Docs: Managing VMs, ssh access by name, How it works' Lima (A shell's
colors) and security (the ssh entries), and CHANGELOG Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-20 11:27:28 -07:00
w3cjandClaude Opus 5.5 4ccdbf8125 fix(vm): folder identity's last checks: a renumbered folder keeps its volume
From the volume UUID commit's security review. A folder at its own
recorded path on a disk numbered anew (platform.SameFolder's renumbered
case) must now also be on the volume its state records, when both are
known (platform.KeepsVolume): the finder checks it (finder.sameFolder,
Env.keepsVolume, so a launch refuses with vm_other_folder) and so does
recordFolder under the state's lock, so a copy of the disk with a volume
ID of its own mounted at the folder's path is another folder. A volume
that can't be told leaves the device's rule, as for a state that
records none. mountedBy and mountsRepo keep the check without volumes
(madeFor), which errs towards warning.

hereOf reads the folder's identity, uniqueness, owner and volume from
one open folder (platform.StatFolder, now with Owner), so the folder
checked as the user's is the one matched and recorded. StatFolder is
one function for macOS and Linux (folderstat_unix.go) over each
system's openFolder, which SameFolder's renumbered case uses too, in
place of openFolderID and darwin's copy.

devvm ls and devvm space look volumes up through the run's Env
(Env.FolderOf, Inventory.List(ctx, e)), each mount once a run, in
place of diskutil for each VM; FolderOf, parentVolume and movedAway go.
FolderDevice is unexported (folderDevice), so only platform reads a
device; OnRecordedDisk takes a record without a device as on any disk.

The folder-ids rule tracks names assigned from such names, however
many steps on, and maps keyed by an identity, indexed or in a map's
literal, without counting a struct literal's field; its loop is
sitesWhereIn, shared with sitesWhere. The hdiutil e2e check makes sure
macOS gave the disk a new number, attaching up to three images first,
and is skipped when it never does. The design notes say who can forge
a volume ID and what it gets them.

Tests: TestKeepsVolume, OnRecordedDisk without a device,
TestRenumberedOnAnotherVolume (a launch and recordFolder),
TestListLooksUpVolumesOnce, StatFolder's Owner on both systems, the
folder-ids rule's new cases, and fixture_v010_renumbered.txtar (another
volume at its own path refused with nothing recorded; ls calls the
moved folder gone by its recorded volume, where it said not_connected).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 07:15:53 -07:00
w3cjandClaude Opus 5.5 ba510eec1f feat(vm): a folder moved across a restart keeps its VM, by its volume
A project folder's identity was its device, inode and birth time, and
since #60 a folder at its recorded path matched on another device. A
folder that moved while a restart gave its disk another device number
matched nothing, so plain devvm made it a second VM, and folderOf took a
renumbered disk for an unmounted one ("not connected"), so movedAway was
false too.

Each VM's state now records the folder's volume, which no renumbering
changes, as folder_volume, "<kind>:<value>:<ino>:<btime>", bound to the
folder it was read with (platform.VolumeOf, RecordedVolume): macOS's
volume UUID from diskutil (platform.VolumeUUID, only for the mount point
and device read from the folder opened with no link, its answer checked
against both), Linux's f_fsid on ext4, Btrfs and ZFS (StatFolder, read
from the open folder); none on a read-only volume or a snapshot, or
elsewhere. state.VM's folder is unexported: Folder(), FolderVolume() and
SetFolder(id, vol), the one writer, which creation, adopt, a move and
recordFolder (renumbered's successor, at each launch) use; a launch
records the volume of a VM made before, once it can (1 s at a launch,
5 s at an adopt or a move, one failure a run stops the rest, through
Env.Volumes and its run's cache).

moveHere matches a moved folder by its volume, inode and birth time
(platform.MayHaveMoved, MovedFolder), looking the volume up only once
the rest matches, with the identity it matched and records both read
from the folder opened with no link (hereOf), and folderOf compares the parent's volume where the
state records one (platform.OnRecordedDisk), through Env.folderState for
a move or an rm. The folder-ids rule now also reads Folder() and
FolderVolume() calls, FolderDevice, locals assigned from any of them,
switches and strings/slices comparisons.

An older devvm keeps folder_volume as it is (checked with 0.1.0's own
reader in a temp copy of its tree). A rename keeps the inode, so the
binding stays right; when an older devvm adopts another folder for the
VM, or a move across volumes copies it, the binding names another inode,
so the record names no volume and is recorded again. DEVVM_VOLUME stands
in for diskutil, and for Linux's f_fsid, in test builds (VolumesOnly).

Tests: TestFolderOf (not connected after a renumbering), TestMovedFrom
(moved and renumbered, and a split between the read that matched and
the one recorded), TestRecordFolder (made, a VM made before at its next
launch, a failed lookup, a renumbering keeping the bound volume),
TestVolumeOfCache, TestVolumeOf, TestMovedFolderAndRecordedDisk,
TestStatFolder(AndVolumeUUID), TestPlistStrings, the folder-ids rule's
new cases, fixture_v010_renumbered.txtar (0.1.0's VM records its volume,
then moved and renumbered it's offered, never a second VM), and e2e's
projectRenumbered (hdiutil, macOS) and the project section's volume
check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 01:59:06 -07:00
w3cjandClaude Opus 5.5 aed6424c09 fix(proxy): a stale proxy.confined no longer hides proxy_old
run/proxy.confined said how the child was confined, but not which broker
said it. After a downgrade, an older devvm starts the VM's proxy as one
process and never writes the file, so the newer devvm's file stayed and
devvm doctor took the older devvm's unconfined proxy for a confined one.

The broker now writes a second line naming itself, its pid and its start
as the system tells it (proxy.BrokerID, through IO.Started), and
ReadConfined takes the file only when it names the running broker, which
doctor finds by the pid file and platform.ProcessStart (kern.proc.pid's
p_starttime on macOS, /proc's starttime on Linux). A file that names
another broker, or none, is one that hasn't said, so another binary's
proxy gets proxy_old, and when doctor can't read the running broker's
start it says it can't tell (proxy_confinement_unknown). The e2e broker
check reads the file's first line and checks the second names
run/proxy.pid's broker.

Tests: TestUnconfinedStaleMarker, TestReadConfined, TestProcessStart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00
w3cjandClaude Opus 5.5 01e837a164 build(deps): bump Cursor's CLI to 2026.11.17-f532c45, rechecked
scripts/bump.sh cursor: 2026.11.11-b912975 -> 2026.11.17-f532c45, the
one shared tool pinned for users, applied only when named because
devvm's login and proxy code was read against its pinned release. Then
scripts/bump.sh e2e-tools, which writes tests/e2e-mise.lock for the new
mise.toml and moves e2e's claude (2.1.326 -> 2.1.327) and opencode
(2.3.0 -> 2.3.2) patches with it.

The recheck read both releases' Linux packages (checksums checked, read,
never run) and Cursor's changelog (nothing after Nov 6):
- Package layout and entry point: the same launcher and files.
- Login: the same loginDeepControl page, GET api2's /auth/poll with
  uuid and verifier, 404 while pending, accessToken and refreshToken
  (or xAI's), selectedTeamId, NO_OPEN_BROWSER and
  /auth/exchange_user_api_key. waitForResult gained an optional wake
  argument that cursor-agent login doesn't pass.
- No refresh-token call, as before; the JWT reader still takes exp
  (300 s early) and sub, so the 2099 placeholder still serves.
- Connect: about 65 RPC definitions added, mostly DashboardService's,
  2 removed (DashboardService's pull-request draft preference), and the
  methods the bundle calls are the same, so every route agentlogin's cursorRoutes and the proxy's
  cursorMinting and cursorPersists name is still there, and no new
  method carries the login.
- Hosts, config and auth files (CURSOR_CONFIG_DIR, XDG_CONFIG_HOME,
  ~/.cursor, auth.json, cli-config.json), the updater and channel: the
  same. New environment variables don't touch updates or telemetry.
So nothing in devvm's code, tests or allowlist changes; the comments,
the policy's note and internals/network.md name the new release.

- CHANGELOG: Changed, the pin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 20:06:44 -07:00
w3cjandClaude Opus 5.5 c9005ae4be build(deps): bump pins: mise 2026.11.10, Docker 29.10.0, Hugo 0.170.1 and e2e's pins
scripts/bump.sh's safe bumps (patches and minors; no majors or held pins):

images (assets/):
- mise 2026.11.8 -> 2026.11.10 (base's, and the host's resolving mise)
- docker 29.9.3 -> 29.10.0, compose 5.7.1 -> 5.8.0
e2e:
- claude 2.1.322 -> 2.1.326, codex 0.167.2 -> 0.169.1, opencode 2.2.7 -> 2.3.0
- pnpm 12.18.0 -> 12.21.0, uv 0.13.7 -> 0.13.9, rust 1.99.1 -> 1.100.0
- ubuntu:26.04 digest 065aa8626841 -> d66b366dac61
- Ubuntu's cloud image release-20261016 -> release-20261108
go: deadcode v0.52.0 -> v0.53.0
dev-tools: govulncheck 1.9.0 -> 1.10.0, vale 3.26.0 -> 3.27.0,
  hugo-extended 0.169.0 -> hugo 0.170.1
ci: jdx/mise-action v5.2.8 -> v5.2.10, the workflows' mise 2026.11.8 -> 2026.11.10

Hugo 0.170 has no extended edition (one binary, without LibSass, which
the site doesn't use): mise.toml's hugo-extended becomes hugo, the docs
workflow installs hugo, its release job installs the tag's own tools
(an older tag names hugo-extended), and docs/hugo.yaml drops the
deprecated hugoVersion.extended.

The e2e runner deletes its sandbox's Ubuntu pin when it names a release
other than e2eUbuntuRelease (not in a --newest-base run), as devvm keeps
a pin it has: without it, moving e2eUbuntuRelease left a cached sandbox
on the old release. pinned and ubuntuPin are e2e's one reader of the pin,
and TestHarnessRepin covers repin.

Image keys change: base and every image above it, the docker layer's
included, and the shared tools' images build again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 17:26:09 -07:00
w3cjandClaude Opus 5.5 6965efcc0a fix(vm): devvm agent login claude --setup-token shows Claude Code's address (#57)
An agent's login in the VM ran with devvm's own writers as its output,
so os/exec gave limactl shell pipes, Lima added no ssh -t, and claude
setup-token, which draws full-screen, showed nothing and waited.

When devvm's stdin and stdout are terminals and both output streams are
files, the login now gets stdout and stderr as the files they are
(ui.Terminal, set by cli as vm.Env.Terminal), so Lima gives it a
terminal in the VM, as devvm's shell has. Without a terminal it keeps
pipes, and --setup-token warns first (setup_token_no_terminal). Its
output reaches devvm's output alone, never the run log, as before. On a
terminal, Ctrl-C goes to the login in the VM, which ends, and devvm
says the login ended or saved nothing.

- internal/ui: Terminal, over Files, never a half pair; TestTerminal.
- internal/vm: Env.Terminal; AgentLogin.loginOpts; the warning; why an
  interrupted login's cleanup stays as endLogin's backstop; endLogin's
  comment for a login on a terminal; TestAgentLoginTerminal
  (fails without the fix).
- internal/backend: ExecOpts says a terminal's files pass on as they
  are; Lima's TestExecStreamsAsGiven.
- internal/cli: vmEnv sets Terminal; agent_login.txtar checks the
  warning.
- locales/en.toml, internal/msg: setup_token_no_terminal.
- tests/e2e: OnTTY, out of TTYRun; network's check that
  devvm agent login claude --setup-token on a terminal shows the
  address, waiting for its devvm to end before the next login.
- Docs: internals/network.md, using/coding-agents.md,
  contributing/extending.md and tests.md; CHANGELOG Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 15:32:47 -07:00
w3cjandClaude Opus 5.5 c1db911d1b fix(agentlogin): the Claude login reaches claude.ai's connectors (#61)
Claude Code lists a claude.ai account's connectors at
api.anthropic.com/v1/mcp_servers and reaches each at
mcp-proxy.anthropic.com/v1/mcp/<id>, with the login's access token. The
OAuth login's binding named api.anthropic.com alone, so the connectors'
requests carried the placeholder and were refused.

ClaudeOAuthBindings gives the OAuth login a second binding,
claude-connectors: the same placeholder, into Authorization for
mcp-proxy.anthropic.com below /v1/mcp/ alone. It has a name of its own
because the proxy looks a value up by its binding's name, and
secrets.Store.Get gives claude-oauth a Claude Code token in the login's
place but never gives one to claude-connectors, so a token, saved or in
devvm's environment (whose scope isn't checked), still goes only to
api.anthropic.com. The bindings file stays version 1.

Tests: TestClaudeCapture and the claude-oauth golden check both bindings;
TestClaudeBindings checks the connectors' binding gets the OAuth login and
never a saved or environment token (with the claude-oauth control);
network.txtar checks the VM's secrets.json and secrets.policy. e2e's
network section adds the connectors' host to its fake upstream: with the
claude secret, neither its placeholder nor the OAuth login's gets the
token there (the API, the control, does), and after the host's refresh
the connectors' host gets the refreshed access token.

Docs: the Claude Code login, the attack vectors' new entry for connectors
(deny mcp-proxy.anthropic.com to keep them from a VM), How it works'
bindings and threat lines, the agents' table, and Contributing's e2e
network section, whose refresh sentence was stale (the refresh succeeds).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 13:19:11 -07:00
w3cjandClaude Opus 5.5 e97db057fd fix(agents): Claude Code's plugins get a folder of each VM's own, the store's a read-only seed (#56)
A VM's ~/.claude/plugins was the agent store's plugins folder, mounted
read-only, so everything Claude Code writes there failed with EROFS: a
plugin's data (${CLAUDE_PLUGIN_DATA}), installs, marketplace refreshes,
mcpb/ and the rest. Making the store writable would let one VM change
what Claude Code runs in every other VM, so each VM's ~/.claude/plugins
is now its own folder on its disk (CLAUDE_CODE_PLUGIN_CACHE_DIR), and the
store's folder is linked at ~/.claude/plugins-seed and read as Claude
Code's own read-only seed (CLAUDE_CODE_PLUGIN_SEED_DIR). Checked on a
devvm VM first: a seed-cached plugin from a GitHub-style marketplace
loads with only enabledPlugins, its hook writes ${CLAUDE_PLUGIN_DATA} in
the VM's own folder, installs in the VM work, and seed marketplaces
refuse updates.

- agents: Def.Seeds (Rel, Link, Entries), Seeds, SeedOf, MachineOwn;
  Env gains Home; Claude's Env sets both variables below $HOME.
- vm: the setup links a seed at its Link and stages own-dirs, which
  sync.sh makes a folder in place of a link; agentEnv writes Home values
  through homeValue (shared with toolchainEnv); a remake keeps the VM's
  own folder and skips the seed's link.
- devvm agent import copies only a seed's entries (known_marketplaces.json,
  marketplaces, cache), directly and through followed links, so the
  host's plugins' data, mcpb, synced, .trash, store and
  installed_plugins.json never reach the store.
- devvm agent save: the VM's script excludes a seed folder's other
  entries by name, and readSent refuses any (listedPath); a seed folder
  adds and changes, never removes or prunes; claudeRecords renames the
  VM's plugins path to the store's and joins known_marketplaces.json by
  key, leaving records Claude Code registered from the seed as the
  store's, and the store's file as it is when nothing changed.
- History: an export leaves the VM's plugins folder out and an import
  skips it and the seed's link: it's settings and plugin data (which can
  hold a plugin's own logins), not history, and reaches other VMs only
  through devvm agent save's reviewed diff.
- Review fixes (security-audit): historyImport refuses a name with a
  ., .. or empty part (GNU tar's anchored excludes missed
  .claude/./plugins and .claude//plugins, which now reach a writable
  folder) and deletes importSkips by path after the link sweep; the save
  script never excludes a name with a wildcard's character (it's sent
  and refused); only a marketplace record whose exact installLocation is
  clean and in the store's marketplaces joins the store's.
- Tests: claude_test.go (TestClaudePluginsSeed, TestClaudePluginsHistory,
  TestAgentImportClaudePlugins, TestAgentSaveScriptClaudePlugins,
  TestReadSentClaudePlugins, TestAgentSaveClaudePlugins), TestSeeds,
  TestListedPath cases, the agent, agent_save and sync CLI tests, goldens,
  and e2e project checks of the seed, the VM's folder and a plugin's data.
- Docs: coding-agents (store table, Claude Code's plugins under Mounts,
  the save's plugin example), internals/agents, a design note with its
  threat check, extending.md, CHANGELOG Fixed and After you upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 11:37:40 -07:00
w3cjandClaude Opus 5.5 1793353dd9 feat(proxy): Linux confines the proxy's child with Landlock and seccomp
Before it reads a byte of the VM's, devvm _proxy-child confines every
thread of itself through proxy.confineSelf on Linux: no_new_privs
(syscall.AllThreadsSyscall), Landlock from ABI 2 (TSYNC from ABI 8) to
its logs folder, the Nix cache and the resolver's files (never /, the
home folder or one that holds it), binding no TCP port (ABI 4), scoping
signals and abstract sockets (ABI 6, or ABI 6/7 with erratum 2),
refusing named unix sockets (ABI 9) and UDP but to port 53 (ABI 10);
then a hand-written classic BPF seccomp filter, installed with TSYNC,
that refuses with EPERM AF_UNIX socket/socketpair, listen, io_uring,
ptrace, process_vm_readv/writev, pidfd_getfd, a file's mode, owner,
xattrs and times by its path (chmod, fchmodat, fchmodat2, chown, lchown,
fchownat, the six xattr calls, utime, utimes, futimesat, utimensat with
a path), truncate, the keyrings (add_key, request_key, keyctl),
prlimit64 on any pid but 0, setpriority, ioprio_set,
sched_setaffinity, sched_setscheduler, sched_setparam, sched_setattr,
inotify_init, inotify_init1, inotify_add_watch, fanotify_init,
fanotify_mark, execve, execveat, fork, vfork, unshare, setns, bpf,
userfaultfd,
perf_event_open, clone for anything but a thread or with a namespace's
flag, and clone3 with ENOSYS; it kills a foreign architecture's call or
an x32 number. fchmod, fchown, ftruncate and utimensat on a descriptor
stay. It checks the confinement holds, then proxy.checkConfined, and
that it still reads the host's addresses, within 2 seconds, or fails
the start. A kernel without Landlock or seccomp leaves that part out;
the child runs and says so. The broker sets itself undumpable
(PR_SET_DUMPABLE 0). The Nix cache marks a file used through its
descriptor. The broker's start, and its life with the child, take a
reset of the socket (ECONNRESET, Linux's end of a socket closed with
frames unread) as the child's end, as EOF is (socketEnded,
TestHandshakeChildGone).

Built on the Seatbelt item's shared owner, proxy.Confinement:
- internal/landlock (new, stdlib only, Linux build tags): Self, Result,
  Floor, ABIPorts/ABISignals/ABIUnix, ErrUnsupported; landlock_linux.go
  (resolverFolders, refusedFolder, homeFolder), filter_linux.go (filter,
  asm, encode, archOf), seccomp_linux.go, self_linux.go (Self, check,
  refused).
- internal/proxy: confineSelf on Linux calls landlock.Self;
  landlockConfinement words it (By landlock, seccomp; Why
  no-landlock-or-seccomp, no-landlock, no-seccomp, landlock-below-abi4,
  landlock-signals; full from ABI 6 with seccomp and scoped signals);
  confineChild takes the child's needs and returns an error, bounded by
  confineWait (within, confineWith); checkConfined only where Landlock
  or Seatbelt confines files; confineStarted; IO.confine required, set
  by ChildMain alone; hostAddrs.check; touch_linux.go and
  touch_other.go (touchFile, undumpable); IO.dumpable for tests.
- devvm doctor: netpolicy.Unconfined's Linux warnings
  (proxy_unconfined_no_kernel, _no_landlock, _no_seccomp, _old_ports,
  _old_signals).
- Tests: TestFilter and TestFilterBytes (an interpreter of the program's
  bytes, amd64 and arm64, and the assembler's refusals), TestSelf (a
  real confined child: outside file, ssh-like unix socket, listen, bind,
  signal, chmod, chown, setxattr, utimes, truncate, a keyring, unshare,
  exec, clone3, and new threads, fchmod, ftruncate and futimens kept),
  TestKernel, TestCheck, TestRights (refusedFolder), TestArchNumbers,
  TestLandlockConfinement, TestConfineWithin, TestCheckConfined,
  TestConfineStarted, TestRunChildOn, TestUnconfined; network.txtar; e2e
  network's Landlock, NoNewPrivs and Seccomp check.
- CI: a nocgo job (CGO_ENABLED=0) for internal/landlock and
  internal/proxy.
- Structure test, depguard, goroutineSites; docs: the child's sandbox,
  processes (and its why-Go note on unsafe), design (the network row's loopback follow-up on Linux,
  other processes and /proc without Landlock), doctor's checks,
  troubleshooting, attack vectors, Contributing, the proxy's README,
  AGENTS.md, CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 941c63c696 feat(proxy): the proxy's child runs under Seatbelt on macOS
On macOS the broker starts devvm _proxy-child through
/usr/bin/sandbox-exec -p PROFILE, by devvm's real path, with a
deny-default profile, so the child is confined from its first
instruction: devvm's binary to run and read, its folder's metadata,
dyld-support.sb, /usr/lib and /System/Library, the time zone and
resolver files, its logs folder and the shared Nix cache (regular
files only, no hard links, no folder removed, no flags, ACL, owner,
set-id or xattr changes), stat alone on the watched files and every
link on the way, trustd and trustd.agent, mDNSResponder's socket, TCP
and UDP out (loopback left to the floor: a rule for a loopback port
applies at once, which a profile fixed at the start can't follow),
sysctl but kern.proc, signals to itself. No home folder, no devvm folder but its
own, no Keychain, no other unix socket, no bind, fork, exec, signal to
or look at another process (process-info, the process list).

- internal/seatbelt: the shared owner of Seatbelt (Exec, String,
  Path, Links, ChildProfile, Sandbox.ProxyChild); sbString, sbPath and
  sandboxExec move here from the Lima backend, which uses them.
  ChildProfile refuses a relative path and the root.
- internal/proxy/confine.go: the confinement report every platform
  shares (Confinement, ParseConfinement, ReadConfined: one line of
  fixed words in run/proxy.confined, refused unless it parses, and
  unless it fits what the broker started the child with), the child's
  self-check (checkConfined: its broker's config must be refused), and
  the in-process hook (confineSelf, confineself_linux.go and
  confineself_other.go) for the Landlock follow-up.
- internal/proxy/childstart.go: startChild, childSandbox, childNeeds;
  IO.Seatbelt, set by devvm _proxy on macOS.
  A missing sandbox-exec, or one that failed before devvm's code ran
  (exit 65 or 71, or SIGABRT or SIGKILL, before the child answered,
  decided before the broker's own stop), starts the child again
  unconfined within the broker's 4 seconds, with a warning in
  proxy.log; any other failure fails the start. The broker makes the
  Nix cache's folders first. start carries how the broker started the
  child (Spawned).
- watched.get: a stat refused for want of permission reads through the
  broker each time (a watched link pointed elsewhere after the start).
- daemon.Handle.ExitCode and ExitSignal.
- devvm doctor warns for each running VM whose proxy's child isn't
  fully confined (netpolicy.Unconfined; proxy_unconfined,
  proxy_unconfined_unsupported, _no_sandbox, _sandbox_failed,
  _check_failed).
- Tests: TestParseConfinement, TestCheckConfined, TestReadConfined,
  TestStartChildSandbox (an over-claiming ready, SIGTERM),
  TestSandboxFailed, TestChildNeeds,
  TestWatchedStatRefused, TestUnconfined, TestString, TestLinks,
  TestChildProfile, TestProxyChild, TestChildProfileConfines (the test
  binary run again under the profile on macOS: flags, rmdir, the
  process list), doctor's report, ExitCode and
  ExitSignal; e2e network checks run/proxy.confined is full seatbelt
  on macOS.
- Docs: How it works' The child's sandbox, Processes, the design
  note's confinement and threat check (loopback as open work, other processes'
  details and kern.procargs2, the shared folders' flags, mDNSResponder's
  records, trustd.agent's trust settings, the fallback's signals, a
  ready that claims more), Troubleshooting's The proxy runs without a
  sandbox, Staying safe's escaping the VM, doctor's
  checks, Contributing's packages, the proxy's README, AGENTS.md,
  CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 63bb1ff9a8 fix(network): a confined VM's programs ask 127.0.0.1 directly, so names fail at once
With transparent mode off or stopped, a confined VM's only name server,
127.0.0.1 (Lima's DNS setting), has nothing listening. glibc asked it
through systemd-resolved's stub, which could keep retrying it over UDP
and TCP without answering, so a lookup such as getent's waited out its
timeout instead of failing at once (seen on a Linux host: e2e network's
checks of DNS with transparent mode stopped and off).

Each launch's setup now replaces /etc/resolv.conf, the stub's link, with
devvm's own file on a confined VM: nameserver 127.0.0.1 alone, the stub's
search line, timeout:1 attempts:2. glibc gets a refusal at once with
nothing listening, and dnsmasq's answer through transparent mode's
nftables rule when it runs, as musl on Alpine does. An open VM gets the
stub's link back. Only systemd guests that have the stub's file and whose
/etc/resolv.conf is its link or devvm's own are touched.

Root cause, as far as it could be pinned down: with resolved's stub in
the path, a lookup depended on resolved's retry loop over a server that
refuses everything (24 attempts, flipping UDP and TCP feature levels),
and on the linux host that loop sometimes never answered the stub
within getent's 3 s. It didn't reproduce on demand (a base run on the
linux host passed both checks, and bursts of 200 parallel lookups and
stops mid-lookup all failed in under 2 s), so the fix takes resolved out
of glibc's path rather than tuning it.

Going back to open restarts systemd-resolved: it reads a /etc/resolv.conf
that isn't its own link as global servers and search domains, so it had
taken 127.0.0.1 and "~." from devvm's file, and kept them once the link
was back, which left an open VM unable to resolve names (caught by e2e
network's open checks on the linux host and ubuntu).

Review folded in: no change of a foreign or dangling link when the stub's
file is missing; two attempts; Docker's user-defined networks in the docs.
Second review: devvm's file alone is enough to go back on an open VM (a
warning when the stub's file is missing); a failed write says so in one
line and the launch goes on; troubleshooting's "An open VM resolves no
names after a downgrade"; tests for resolved's own resolv.conf link, an
open VM without the stub, a non-systemd guest with devvm's file and a
failed write.

workerd under wrangler dev, checked by hand on fedora with transparent
mode off: its fetch fails at once (Temporary failure in name resolution),
so the "about 40 seconds for each lookup" sentence is gone from lima.md,
safety/network.md and troubleshooting.md, and testing.md's manual check
covers it.

testdata/coverage/darwin.txt: internal/sshagent's baseline rose with
mise run coverage (unrelated to this change).

- backend.Confinement.Resolver: the one owner of a confined guest's name
  server; Lima's start sets .dns from it, sync.go sends it to the setup
  as DEVVM_RESOLVER; sync.go's setupInputs as mise run fmt writes it.
- assets/guest/sync.sh: resolver_conf; its unit test runs the function
  (internal/vm/resolver_test.go). sync.sh runs at each launch and goes in
  no image, so no image key changes.
- CLI tests: DEVVM_RESOLVER on confined (transparent on and off) and open
  VMs. e2e network: the stopped-transparent check also checks the file.
- Docs: network.md's The VM's resolver, lima.md, design.md, tests.md;
  CHANGELOG Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 aeea3135b2 feat(proxy): the proxy's broker and its child
A VM's proxy runs as two processes, as design.md's "The proxy's broker"
says: devvm _proxy, the broker, which keeps what only the host should
do, and devvm _proxy-child, which reads the VM's network and can be
confined by the follow-ups.

- wire.go: the protocol over one socketpair (close-on-exec from the
  start: SOCK_CLOEXEC on Linux, ForkLock elsewhere), length-prefixed JSON
  frames of at most 2 MiB, unknown fields refused, bytes as base64, one
  descriptor on a frame's first bytes (SCM_RIGHTS, MSG_CTRUNC breaks the
  rules), wire types for every secret (redact.Secret at once).
- broker.go: newBroker, the start (handshake: version 1 and each side's
  executable's SHA-256, within 4 s), the answers (value through lookups,
  kept 30 s or 5 min, a failure 5 s, dropped when the bindings change;
  file by number; link connected by the broker and passed as a
  descriptor; token exchanged by the broker), each by something in its
  own config, with caps 1/8/4/256; live: the lifeline closes the socket
  and kills the child 6 s later, SIGTERM stops it within a second, a
  child that ends ends the broker, a rule broken stops the child.
- child.go: the start (startOf), the child's server (newChildServer),
  the broker as hostSide over the socket (brokerClient), runChildOn;
  ready only after it reads the host's addresses (kept: the last good
  read), roots and time zone loaded first.
- process.go: Main(ctx, ...) and ChildMain; the child spawned with
  /proc/self/exe on Linux, PR_SET_PDEATHSIG from a locked thread
  (daemon.Cmd.DieWithThread), descriptors 3 and 4, and TZ, SSL_CERT_*
  and GODEBUG with updatemaxprocs=0 alone; run/proxy-child.pid and
  run/proxy.confined ("none" until the follow-ups); KeepLogs in the
  broker. ChildMain refuses to start unless descriptors 3 and 4 are a
  unix socket and an IP one (checkInherited): run by hand, without
  them, those numbers can be the Go runtime's own, which closing
  crashed it (signal_recv: inconsistent state).
- capture.go: a captured token request goes to the broker
  (captureToken, exchanger), so a login's real tokens never enter the
  child; an error reply passes up to 1 MiB, longer gets 502.
- watched.go: the child stats each changing file and asks the broker
  for it once it changed, keeping the stamp of what the broker read.
- rotate.go: proxy.log rotated by both through its descriptor, under a
  lock of a description of its own; OpenLog opens a log never through a
  link, one link, yours, replacing what a child left in its place.
- nixcache.go: the trim and its count through a safefile.Root, nar/
  only as a folder, links deleted as themselves; reads never through a
  link; the lock tried for 5 s (ErrNixLocked, nix_cache_locked).
- daemon: Cmd.Err, Files, Env, DieWithThread; Handle.Kill, Exit;
  WritePID.
- netpolicy: Proxy.Stop also stops a child that outlived its broker
  (run/proxy-child.pid, _proxy-child -for); proxy.log opened with
  OpenLog; a refused launch keeps a running VM only while both run.
  devvm network log and lock read the event log through safefile.
- vm, vmssh, vmlog: links.log and ports.log opened with OpenLog, read
  through safefile, trimmed only as a regular file with one link.
- backend: the build proxy's logs in a logs/ folder of their own.
- cli: _proxy-child; _proxy waits for its child on a signal
  (StopsItsOwn); the child reads none of devvm's folders (no
  makePrivate); ui.Files.
- Tests: FuzzBrokerFrames, the frames' rules, the handshake and the
  pair's end in synctest bubbles, the caps, the broker naming its own
  alone, the client over a real socketpair with a passed descriptor,
  ChildMain, TestInheritedSocket and proxy.txtar's child run by hand,
  the frozen 0.1.0 configs starting a broker and child,
  two writers rotating once, planted links, FIFOs and hard links; the
  testscript runner stops _proxy-child too; e2e: broker and child, their
  arguments, descriptors and environment, stop, SIGKILL either, planted
  files in the logs folder and the Nix cache, build proxies gone.
- Review fixes: the lifeline closes the socket and starts the kill's
  timer before logging; every log lock (proxy.log's, the event log's
  rotation) is tried without blocking for 200 ms (flockWithin, which the
  Nix lock shares), then written without or the rotation skipped; a
  copied log's rotation streams at most twice its limit from a line's
  start (copyFrom, copyAtomic); a reply too long to send goes as
  too_long; kept token headers capped at 1 KiB; the child gives up on a
  request whose context ended, dropping its late reply and holding its
  slot until then; a write deadline on the start frame; errors reach the
  child as codes (not_found, refused, busy, too_long, failed), their
  text in the broker's log; FuzzFrameStreams, and FuzzBrokerFrames
  writes from a goroutine; nix_cache_locked links to How it works.
- Docs: processes, network, overview, design (with threat rows for the
  logs' locks and a log made huge), troubleshooting, the proxy's
  README, structure, testing; CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 4a4aabe9a8 fix(netpolicy): a refused launch leaves a running VM and its proxy as they were
With config.toml's proxy naming a user and no proxy secret saved, devvm in
a running VM's folder refused (proxy_password_missing) but stopped the VM
(net_proxy_down_stopped), and devvm restart stopped it before refusing.
Every check that can refuse a proxy start already ran before Prepare
stopped the old proxy; runningConfinement stopped the VM on any error.

- netpolicy.Proxy.PrepareRunning: Prepare for a running VM. A refusal
  before its proxy is touched keeps the VM and proxy (net_proxy_kept, a
  new message) only while that proxy enforces the state's tier now
  (enforcesNow: built-in, files, denies, open, devvm binary); otherwise,
  or once its proxy was stopped or started, or with none running, the VM
  is stopped (unproxied, was Unproxied, which now stops a proxy left
  running too).
- netpolicy.Proxy.Refusal (shared): the user's CAs and the company proxy,
  checked first in prepare, before a VM is made (up), before a running VM
  is stopped to start again (target.stopToStart: devvm restart,
  restartForNextStart), and before a running VM's tier changes between
  confined tiers (checkTier: devvm network, lock), so its state never
  names a tier its proxy doesn't enforce.
- devvm network's change to a running VM's rules goes through
  PrepareRunning, so a proxy that can't start again stops the VM rather
  than leaving it running without one.
- Proxy.Upstream removed (no callers); shared, prepare, unproxied and
  tierNow are functions of the proxy, keeping Proxy within 24 methods.

Tests: company_proxy.txtar (launch and restart refused, VM and proxy
untouched; devvm network allowlist refused, tier unchanged),
TestPrepareRunningRefused (eight rows), e2e corpConfig checks the VM's
status after the refused launch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:32 -07:00
w3cjandClaude Opus 5.5 19f9900b86 fix(sshagent): a VM reaches its SSH agent only through its proxy's relay
OpenSSH's ssh-agent answers every request a forwarded connection sends,
so a VM that forwarded your agent or devvm's own (shared by every VM
that uses it) could remove all its keys (ssh-add -D), lock it with a
password of its own (ssh-add -x) or add keys without bound, denying the
agent to you and to the other VMs. Checked with a throwaway sshd and
ssh-agent: all three succeed over ssh -A.

Each VM's proxy now relays the agent its start chose on a socket of the
VM's own (paths.Dirs.AgentRelay, run/agent-<hash>.sock, mode 600), and
the VM's backend, devvm's own connections and the ssh entries for
editors name that socket. The relay passes on only
SSH_AGENTC_REQUEST_IDENTITIES, SSH_AGENTC_SIGN_REQUEST and the
[email protected] extension (so destination-constrained keys keep
their constraints), answers everything else with SSH_AGENT_FAILURE,
reads messages whole up to OpenSSH's 256 KiB, carries at most 16
connections and closes one idle for 2 minutes. A filtering relay rather
than an agent per VM: it covers your own agent too, needs no copy of a
key or a passphrase per VM, and fronts hardware and app-held keys.

- proxy: Config.Agent/AgentSocket (checked together, absolute), the
  relay in agent.go, listened before the proxy says it's ready; its
  accept loop backs off after an error that leaves the listener open
  (EMFILE), 5 ms doubling to 1 s, logging the first.
- daemon: AcceptRetry, vmssh's acceptRetry moved to the stdlib-only
  package the proxy already imports, so the relay, the port forwarder,
  the link session and a login's forward share one owner.
- netpolicy: Prepare takes a start's agent; a running VM's proxy keeps
  its start's agent from proxy.json (relayedAgent); Stop deletes the
  relay's socket.
- structure: paths.Dirs may have 62 methods (AgentRelay); the relay's
  goroutines in goroutineSites.
- sshagent: Made.Relayed, which RecordStart sets on every start of this
  devvm's whose choice forwards an agent, one without SSH_AUTH_SOCK
  included, and ReachOf(st,
  start): a relayed start gets the relay (or none while it's down), a
  start devvm didn't record (one outside devvm) gets none, or its
  proxy's relay, and only an older devvm's recorded start keeps the raw
  agent until its next start (runningConfinement, finder.inspect,
  sshconfig).
- vm: LeftoverSockets also finds a killed proxy's relay socket for
  devvm gc --orphans and devvm space.
- Tests: relay filter, wiring through Main, bounds and idle close, real
  ssh-agent/ssh-add/ssh-keygen through the relay, Prepare's relay,
  RecordStart/Relayed, sshconfig entries, vm agent tests, ssh_agent.txtar,
  an outside start in ssh_agent.txtar, and e2e checks that the VM can't
  remove, lock or add to your agent, nor the VM or an editor's
  connection remove devvm's agent's keys.
- Docs: processes (the SSH agents, listeners), ssh, attack-vectors,
  security, design, lima, overview, space, structure, proxy README,
  AGENTS.md, CHANGELOG Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:31 -07:00
w3cjandClaude Opus 5.5 3168eb04ad test(e2e): a company proxy in config.toml, its password the proxy secret
The network section's company proxy came only from the shell's
HTTPS_PROXY. Now config.toml's [proxy] names it with its user alone and
the shell sets none: the launch is refused (proxy_password_missing) until
devvm secret set proxy --stdin saves the password, in the run's own
secret store; then the VM's proxy config names the secret and holds no
password, and the company proxy, which refuses requests without it,
carries github.com. Its password is in no process's arguments, log,
proxy config or guest after.

netNoLeaks looks for every company proxy's password the section used,
netCorp's and netOpen's, as it is, as user:password, as Basic's base64
and as the whole Proxy-Authorization value, and for each VM's proxy
password as it is and in Basic's base64, in devvm's logs, the VMs'
proxies' logs and Lima's. corpThrough matches only the events after its
launch, so an earlier launch's tunnel can't pass it (eventsFrom), and
corpNoLeak is shared by both launches.

netSetup deletes the section's secrets at its start as well as its end,
so a proxy secret a killed run left can't let the refused launch go
ahead, and it links the section's HOME to the Keychains folder on macOS
from the start, as devvm secret set proxy is now its first Keychain
write (netClaudeLogins made the link before).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:41 -07:00
w3cjandClaude Opus 5.5 4d409589bb refactor(redact): every secret's value is a redact.Secret, revealed only where it's used
redact.Secret holds a value that lets whoever has it act as the user or
a VM, behind a pointer, so fmt's raw printing of an unexported field
shows only an address. String, GoString and Format print <redacted> for
every verb; MarshalJSON, UnmarshalJSON and MarshalText return
redact.ErrEncode, so a secret is never silently written as a stand-in
(which would lose a login); there's no LogValue. NewSecret ("" is the
zero Secret), Reveal, Empty and TrimSpace are the rest. internal/redact
joins the proxy's standard-library-only depguard group.

Reveal is refused by forbidigo outside tests; each of the 23 call sites
carries a //nolint:forbidigo saying why, and testdata/lint/forbidigo.go
keeps a call the rule must report. The structure test (checkSecrets)
refuses a struct that embeds redact.Secret outside internal/redact and
an interface that declares Reveal() string.

Typed now: proxy.Config.Password (configFile is the wire type, in
Config's order, held to it by TestConfigFile), the server's password,
proxy.Lookup and the cached values, upstream.auth, upstreamPassword,
Upstream.WithPassword's password; backend.NewProxyPassword, ProxyURL,
Confinement.ProxyPassword, BuildProxy.Password; netpolicy.Key and
NetMade.ProxyKey (netMade wire type); settings.CompanyProxy.Password;
secrets.Store.Value, saved, ProxyPassword, Token, Save, save, Get,
SaveKey, Yours.Save, Claude.Env, saveToken, oauthToken; agentlogin
File.Get, SetKey, ClaudeToken, every format's get, setKey and chatGPT,
refresh's refresh token, capture's access, refresh and id tokens, and
the JWT helpers (a login's map stays the wire, through token and
setToken; piKey is piBound); vm.Net.SecretSave, AgentLoginOptions.Key;
ui.UI.Secret. Strings by design: platform.KeychainGet/Set and the
desktop's VNC password.

Tests: TestSecret (unexported and nested fields too), TestConfigFile,
TestV010ProxyConfigs (0.1.0's proxy.json round-trips byte for byte),
TestFixtureStoreGet saves the Linux secret file back byte for byte,
checkV010Logins (login files read, copied and bound without a change),
secretCases, and e2e netNoLeaks, twice in the network section: every
VM's proxy password and the section's values, also as Basic
credentials, in no run log or proxy log, and the passwords in no
ha.stderr.log or serial log. Docs: Contributing's Secrets in the code,
the owners table, the secrets How it works page, design.md's Where
secret values live.

Fixed, found by netNoLeaks: Lima's boot script 07-etc-environment.sh
runs under set -x, so the console logs (serial*.log) kept the VM's
proxy password; redactLog now stars passwords in them as it does in
ha.stderr.log (CHANGELOG, overview, processes and attack-vectors pages).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:31 -07:00
w3cjandClaude Opus 5.5 e4ea123927 feat(ports): VMs' ssh on ports browsers refuse
Lima listens on a VM's ssh port on this machine's loopback, and root in
the VM can make what answers on port 22 speak HTTP, so a page opened as
http://localhost:PORT reached a server the VM controls with the cookies
of every app on localhost, even in a VM that forwards no ports.

- Every VM's ssh port, and every build VM's, is one of the 17 ports
  every browser engine refuses (ports.SSHPorts): the Fetch standard's
  bad ports from 1024 up that Chromium's kRestrictedPorts blocks too,
  which leaves out 4190 and 6679 (headless Chrome 157 loads both). The
  one allocator chooses it (Allocator.SSH and Build, through freeSSH). A
  stopped VM keeps its port while it's on the list, free, not listed to
  forward and not held by another start or build; else it gets one no
  state records, or else a stopped VM's, which that VM gives up at its
  own next start. Another VM's listed ports are avoided only while that
  VM runs or starts.
- The proxy and desktop ports never take one (free); one an older devvm
  chose moves at the VM's next start (Choose's keep path, proxyPort,
  the desktop's listener; Allocator.SSHOnly).
- A forwarder never takes one unless its VM lists it (ports.Reserved),
  so a guest forwarding every port can't fill them; devvm ports and each
  launch warn when a VM's list names one, whatever set it (--ports, a
  devcontainer.json, config.toml's ports) (ports_ssh_listed,
  ports.SSHListed).
- A start holds its port, kept or new, for a minute in the VM's own
  run/ports.ssh-hold (paths.VM.Forwarder; hold, held, projectHold),
  which other starts and builds avoid, so none takes it before Lima
  binds it; it goes with the VM's folder.
- A build takes its clone's own port (was) only when no other is free.
- Past 17: ports_ssh_limit names the VMs whose recorded ports are in
  use ("a or b" for a port two states record) with how many are taken
  otherwise, ports_ssh_limit_all when they have them all, and
  ports_ssh_limit_others when none of your VMs has one.
- Older devvm's ports move at the VM's next start, in startSets' one
  limactl edit, and the start pins the new host keys (pinHostKeys); a
  running VM keeps its port until then, and each launch warns of
  running VMs still on an off-list port (ports_ssh_old,
  Allocator.OffList, confirmed with the backend's Running).
- A test build's own list (DEVVM_SSH_PORTS, registry.Overrides.SSHPorts,
  the Allocator's and the Proxy's SSHList field), read only by
  readOverrides in a test build: each CLI test sandbox gets as many
  ports of its own from below the ephemeral range (sandboxPorts).

Frozen 0.1.0 fixture: each launch now makes exactly one limactl edit, of
.ssh.localPort alone, onto the sandbox's list, and vm.json changes only
in .ports.host.ssh (and the start it records); the fixture's data is
untouched.

Messages: ports_ssh_limit, ports_ssh_limit_all, ports_ssh_limit_others,
ports_ssh_listed, ports_ssh_old.
Tests: TestSSHPorts (Fetch's list less Chromium's gaps, SSHListed,
SSHOnly), TestSSH, TestSSHHolds, TestSSHListed, TestOffList, TestBuild,
TestReserved, TestForwardsHeld's reserved counts, TestStartBuildSSHPort,
TestPrepareRestartsTheProxy, TestDesktopListener, TestOverrides
(DEVVM_SSH_PORTS), ssh_ports.txtar, fixture_v010.txtar, layout.txtar;
e2e project: the ssh port, first and after a move, is one browsers
refuse.
Docs: internals/lima (the ssh bullet, the hold's limit), processes
(listener table), design (threat check), ports, overview,
contributing/structure and testing (DEVVM_SSH_PORTS), using/ports-size,
troubleshooting (Too many VMs at once), safety/attack-vectors (allowed
ports, port squatting), CHANGELOG Breaking (17 VMs; forwarding every
port leaves the 17 out) and After you upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:31 -07:00
w3cjandClaude Opus 5.5 b6954e1e11 refactor(vmname): a VM's name is a vmname.VM, parsed where it's read
vmname.VM is the name of every machine devvm runs on a backend: a
project VM, an image's machine (devvm-img-<key>), a build VM and a
remake's aside. Fields, parameters, results and map keys that held a VM's
name as a string now hold a VM, from the backend interface down to the
CLI's --json structs, whose output is byte for byte the same.

Boundary parsers, the only places a string becomes a VM:
- vmname.Parse: a project VM's name (state's vm.json name, export file
  names, devvm _links's argument, the forwarder's -vm, project.Nth)
- vmname.ParseListed: one path element, for what a backend lists
- VM.UnmarshalText: JSON (Lima's list, proxy config and events, links'
  targets in state, link lists); empty stays no VM
- vmname.Image(key), VM.Aside(), and typed constants for Lima's build VMs
- msg.M.VM: the VM a message's function took, read back

vmname's functions on names became methods (Hash, Slug, Short, Aside,
AsideHash, ImageKey, IsProject); Lima's image prefix moved to vmname;
vmname.Join joins VM lists. Messages' vm and vm_name fields are typed
by the generator. Seven messages whose field took something else became
what= (backend_lacks, backend_unreviewed, backend_unreviewed_used,
starting, deleting, configuring, running_script) and rm_vm_failed's
name=: the text is unchanged, the names-mode scripts follow.
Review.RequireFor names an image or the tools being built.

Typed sites per package (added lines with vmname.VM, non-test): msg 347
(generated), vm 124, lima 48, backendtest 32, vmssh 31, netpolicy 22,
backend 16, gitprotect 14, proxy 11, cli 11, project 10, state 8,
ports 6, paths 3, sshagent 2, sshconfig 2, tools 2.

The structure test's owners rule now fails on a field, parameter or
result named for a VM (vm, vms, otherVM, vmName) typed string, []string
or map[string]…, and on converting anything but a literal to vmname.VM
outside the files it lists; internal/stubtest is free. depguard holds
internal/vmname to the standard library, and the proxy may import it.

ParseListed and UnmarshalText refuse a name starting with -, which would read as a flag in limactl's argv, and vmname.Image refuses a key that's empty, holds a / or NUL, or makes a project VM's name, so Lima's ImageSize and DeleteImage no longer check it themselves. The check also fails on a *string VM name and an alias of vmname.VM, and says what it doesn't see.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -07:00
w3cjandClaude Opus 5.5 02ba74e614 build(lint): stricter linters, and the fixes they need
golangci-lint now also runs govet's nilness, unusedwrite, hostport and
waitgroup analyzers, nilnesserr, durationcheck, canonicalheader,
errchkjson, forcetypeassert, contextcheck and gochecksumtype.

- errchkjson checks each JSON encoding's error where the value could
  fail and drops it where errchkjson proves it can't, and reports
  structs without exported fields; tests may drop theirs.
- forcetypeassert holds the code; tests are exempt.
- gochecksumtype: agentlogin's format is a sum type (//sumtype:decl),
  and a switch on one names every case, default or not.
- canonicalheader: WWW-Authenticate, X-Request-ID, X-Api-Key.
- contextcheck: ctx threaded through carry, peekClientHello and sniOf,
  and through inject and value, whose cached lookup takes
  WithTimeout(WithoutCancel(ctx)), so two forbidigo nolints go;
  openTransparent takes its dialer's ctx. nolints stay where
  contextcheck can't follow: ReverseProxy's Rewrite, WithoutCancel
  alone, cobra's cmd.Context, e2e's runner window.
- No-behaviour fixes: scrubList for redact's list, the loopback
  forward's ports kept with its listeners, upgradetest's Key keeps its
  public key, a CA's leaves read through leafOf.

Contributing's Go lint rules lists each one and the sum-type convention.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 00:17:50 -07:00
w3cjandClaude Opus 5.5 c63f9a3340 fix(links): relays end with their link, their master or 30 s after their client closes
A relay's ssh (-W) ends only when the VM's sshd ends its channel, so a
VM that ignored EOF could keep a relay, its ssh process and one of its
owner's 256 slots:

- A link's removal closed only its listener, so its open connections
  went on until the target's master or the session ended. The same held
  for connections through a target master replaced when the target
  started again, and for a link whose address and port named another
  target at the next sync.
- While a forward or a link lasted, a relay whose client had closed its
  side stayed for as long as the VM liked.

Each relay now gets its own context, which a link's removal, its
master's replacement or end, and its target's change cancel, as a
forward's close already did (f76b2fa2); that pattern has one owner,
relayConns, which the forward, each link and each target master use.
pipeSSH, which carries every relay of the forwarder's, the link
sessions' and a login's callback, also cancels it once the client has
closed and the VM has sent nothing for 30 s, the first byte included, or
30 s after the client can take nothing more. A client that half-closes
and waits still gets an answer the VM keeps sending; one that waits
longer than that for a first byte (nc -N in front of a slow query) is
cut. devvm link unpublish keeps the link, so its open connections stay.
No cap for each target: what a target can still hold is connections the
client's programs keep open.

- vmssh: relay.go, the relays' owner: relayConns (add, done, cutAll),
  pipeSSH moved from forward.go, pipeSSHFor, relayGrace, graceTimer
  (newGraceTimer, reset, stop), graceReader. forward.conns is a
  relayConns; linkEnd holds a *relayConns, with close, and targetMaster
  one, with end; sync cuts a link's set when it goes or its target
  changes; take reads the link and its set together; carry tracks each
  connection in its link's set and its master's (track, untrack);
  targetMaster returns the master
- structure: relay.go listed in execSites (each connection's ssh -W);
  forward.go's reason is its master alone
- tests: TestLinksEndStuckRelays (an ssh stand-in that never exits: a
  removed link's, a replaced master's and a changed target's relays end,
  their ssh gone and slots freed, no goroutine left, under -race);
  TestLinksCarryCut (a cut link's and a cut master's connection: no
  check or relay, no event, not tracked); TestPipeSSHGrace (closed,
  half-closed, talking and closed while talking clients);
  TestPipeSSHGraceWriteError (failed writes end the relay within the
  grace); TestGraceTimerStopped
- e2e: link's lkRmEnds, on a port of its own: a connection held by the
  client to a server that never closes it, whose relay ssh ends after
  devvm link rm
- docs: using/links (removing a link), internals/ports (how it reaches
  the VM, when links change), the design note (each connection for
  forwards and links, a lead for relays held after their client closed,
  not covered, two threat-check rows), CHANGELOG Unreleased Fixed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 16:15:34 -07:00
w3cjandClaude Opus 5.5 88eeca20ff chore(deps): bump the end-to-end tests' pins
scripts/bump.sh e2e-tools e2e-from e2e-ubuntu e2e-lima.

tests/e2e-mise.lock, resolved again with devvm's host mise 2026.11.8:
- node: 24.22.2 -> 24.22.3
- go: 1.27.3 -> 1.27.4
- dotnet: 10.0.403 -> 11.0.100 (shared-tools/mise.toml has
  dotnet = "latest", so users already resolve .NET 11)
- claude: 2.1.319 -> 2.1.322
- codex: 0.167.0 -> 0.167.2
- opencode: 2.2.6 -> 2.2.7
- pi: 1.5.0 -> 1.5.2
Up to date: pnpm 12.18.0, bun 1.4.4, python 3.15.2, uv 0.13.7,
rust 1.99.1.

tests/e2e/from_test.go's digests from Docker Hub:
- node:24: sha256:8fa96264f302... -> sha256:9d266751ca3d...
- ubuntu:26.04: sha256:6a06111c3b0a... -> sha256:065aa8626841...
- alpine:3: up to date

Up to date: e2eUbuntuRelease release-20261016, CI's Lima 2.3.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 08:15:32 -07:00
6c36850251 feat(cursor): devvm cursor opens this folder's VM in the Cursor editor
devvm cursor is devvm code's twin for Cursor, the editor. It gets the
folder's VM ready as devvm host does, then runs
`cursor --remote ssh-remote+HOST DIR` in devvm's place, with the SSH
agent devvm started with. Without `cursor` on PATH it fails with
no_cursor_command, naming the host to connect to.

Cursor's Agent and your sign-in (from CJ's manual check with a real
login): recent Cursor runs Agent in the editor's server in the VM, which
holds your Cursor sign-in in memory only (no token on disk, in any
environment or command line) and calls Cursor from the VM. Cursor's
`cursorAgentHost.remoteInferenceRoute` is application-scoped, so it's
read only from the user settings on this machine; with it set to
"always", Agent's own requests go through the Cursor app here, while
the VM's server still talks to Cursor.

- vm: Code and Cursor share openRemote; vm.CursorCommand names the
  editor's command, apart from the CLI agent's agents.Cursor. After
  LookPath finds `cursor`, devvm reads Cursor's user settings on this
  machine (platform.AppSettingsDir: Application Support on macOS,
  $XDG_CONFIG_HOME or ~/.config on Linux) through safefile.Read, 1 MiB
  at most, read-only, as JSON with comments, and warns with
  cursor_agent_in_vm unless the route is "always". It never fails on
  the file.
- sync.sh: Cursor's ~/.cursor-server/data/Machine/settings.json gets VS
  Code's remote.autoForwardPorts, git.terminalAuthentication and
  github.gitAuthentication off, in one loop over both editors' files.
  devvm doesn't write the route there, since Cursor ignores it.
- structure: nameFree lets a literal that is an agent's name stand in
  one file, with its reason, and fails when it frees nothing.
- cli: cursor.go (--ssh-config, --here, --parent), registered beside
  code; cursor_failed, no_cursor_command, cursor_agent_in_vm and their
  doc links; ssh_host_info names Cursor too; the cli skill's judgment
  note: an editor's command is a bare verb named after the editor's.
- Tests: host_code.txtar (cursor, its full-name host, the missing
  command, the warning and no warning once the route is set),
  guest.txtar, TestCursorAgentWarning (always, absent, other values, no
  file, broken JSON, too long, a FIFO, the XDG path; never written),
  e2e network: devvm cursor passes the editor only the host and folder,
  a fake editor sign-in on this machine reaches neither the VM's home,
  its processes' environments nor the proxy's logs, and a Cursor login
  in the store reaches the CLI's methods while the agent store's are
  refused.
- Docs: SSH and editors (commands first; "Cursor's Agent": it runs in
  the VM with your sign-in, the user-settings line, what it doesn't
  cover, open only VMs you trust; if Tab doesn't work on the allowlist
  tier, devvm network allow api3.cursor.sh), the agents page's Cursor
  notes, Commands, attack vectors, design, the home page, CHANGELOG,
  generated CLI pages.

Reviewed adversarially before the push: the settings read (size, FIFOs,
links), the warning's wording and when it fires. Researched with PR
#44's design as reference only.

Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-13 00:05:36 -07:00
w3cjandClaude Opus 5.5 5d7f941678 feat(network): quiet hosts: documented telemetry stays blocked without a notice in the VM
A built-in policy's `quiet HOST[:PORT]` line, for one exact host name,
marks a host devvm leaves out on purpose. A quiet host is blocked as any
host no rule allows, and an allow of the user's still lifts it. A block is
quiet only when its reason is "not on the allowlist" (notAllowed), it isn't
refused, and no rule covers the host (an allow, a deny or one that
narrows): then it's logged with "quiet": true but never counted in
/blocked or /blocked/new, so neither the VM's prompt nor devvm-why shows
it, its 403 page suggests no command, devvm network log --blocked shows it
as a row of its own with "- (quiet)", and devvm network lock never offers
it.

- proxy: rule.quiet, parseQuiet (exact hosts only), PolicyLine.Quiet,
  policy.quiet, Allowlist.Quiet, Event.Quiet, server.blocked (proxy and
  transparent paths), notAllowed; loadPolicy skips and logs quiet lines in
  the user's files.
- netpolicy: Judge.Quiet, Block.Quiet (its own row key), FormatEvent's
  ", quiet", RuleFile.Quiet, quietMark, policy_quiet_not_own in
  PolicyWarnings.
- cli: quiet in network log --json, log --blocked --json and network
  --json; the agents' table leaves quiet lines out.
- Quiet hosts, each with its source: api3.cursor.sh (the host Cursor
  documents for Tab requests; Cursor's CLI uses it for its metrics) and
  telemetry.go.dev (Go). Not marked: Claude Code's Datadog intakes (shared
  multi-tenant hosts projects may need), .NET's telemetry (no host in
  Microsoft's docs).
- Tests: TestParseQuiet, TestQuietHosts, TestQuietOnlyWhenNoRuleAllows,
  learn/log/rules tests, network_rules.txtar, e2e network check for
  api3.cursor.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 23:38:24 -07:00
w3cjandClaude Opus 5.5 4baa6202cc fix(cursor): Cursor's agent stream passes, read message by message
CJ's M3 run with a real login: cursor-agent couldn't chat; it kept
reconnecting to agentn.global.api5.cursor.sh, and the VM's proxy logged
AgentService/Run as refused ("devvm couldn't read the login's token
request or reply"). The CLI's agent client compresses its requests
with gzip (connect-node's sendCompression, read from the 2026.11.11
package, for messages of 1 KiB and more), and a Connect server answers
a gzipped request with gzipped messages whatever the client accepts
(connect-go's negotiateCompression mirrors the request's; the spec has
the server assume the client takes the request's encoding). cursorReply
refused any reply with a Connect-Content-Encoding or Grpc-Encoding but
identity, so it refused Run's reply at its headers.

- frameScanner: a reply whose Content-Type is a Connect or gRPC stream
  passes message by message. Each is read whole, at most 16 MiB as it
  comes and as it decompresses, gunzipped when flagged compressed, and
  checked for a JWT's start before any of it passes, as it came.
  Connect's end of stream, and every message of a JSON stream, is also
  decoded and its strings checked, so escapes can't hide a token. An
  unknown flag, a compressed message without gzip or that isn't gzip,
  one over the limit, an envelope cut off, a token in the trailers, and
  gRPC-Web's base64 text end the stream before that message. Other
  replies keep jwtScanner; requests carry placeholders and pass as
  before.
- cursorReply takes gzip only as a stream's own message encoding, and
  refuses any other encoding as before.
- TestCursorStreams: a recorded-shape Run stream (gzipped messages, a
  plain one, an end of stream), which failed first ("an encoded reply");
  gRPC; each refusal; a token compressed, plain, at the end and escaped
  there; JSON streams. TestCursorReplyScans now uses a unary reply.
- e2e network: the fake company proxy's api2.cursor.sh answers Run as a
  Connect stream with gzipped messages, which passes whole through the
  VM's proxy, and one with a token, which ends before it.
- A focused threat review (security-audit skill): no way found for a
  token to reach the VM that the old refusal stopped; its memory and
  JSON-codec points are taken (no allocation from a declared length,
  JSON streams decoded, grpc-web-text refused). Base64 inside messages
  stays unread, as before, in internals' network page.

api3.cursor.sh, also blocked in that run, is the CLI's metrics host
(MetricsService, with a fixed key of the CLI's own, fire and forget),
which the allowlist leaves out on purpose; the CLI reaches it with
http2.connect, around HTTPS_PROXY, hence "without proxy settings".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 21:57:18 -07:00
w3cjandClaude Opus 5.5 90694a414f feat(agent): devvm agent import follows links out of an agent's folder when allowed
A link out of an agent's folder, such as a dotfiles repo's link into
~/.claude, was always left out. Now it's copied when you allow it:
config.toml's follow-links names folders whose links devvm follows
without asking, and otherwise devvm names each link and its target and
asks, a question --follow-links answers. Without a terminal and the
flag, links out are left out with a warning naming --follow-links.

- The store gets copies only: a linked file as a file, a linked folder
  as a folder of files; the next import replaces them, a folder that
  became a file included, and prunes them once the link is gone.
- Each link is resolved one name at a time (linkHops), then read through
  its allowed folder as a safefile.Root opened one folder at a time from
  / (openPhysical); a link inside is read only to a file in that root.
- Always refused: the home folder or a folder holding it, devvm's config,
  data and Lima folders, ~/.ssh, ~/.gnupg, ~/.aws, ~/Library/Keychains,
  ~/.config/devvm, ~/.netrc, ~/.config/gh, ~/.docker, ~/.kube, and every
  agent's logins and history, compared by name and identity (isIn); a
  follow-links folder in or holding one fails the import.
- A target in a VM's project folder warns, naming the VM; a chain through
  a link in a VM's folder to a place outside it is refused.
- Bounds: devvm agent save's, 20,000 entries, 128 MiB and 16 MiB a file,
  across one import.
- A settings file must link to a file and a settings folder to a folder.

Messages: agent_import_link_not_followed, agent_import_link_refused,
agent_import_link_too_big, agent_import_follow, agent_import_link,
agent_import_link_followed, agent_import_link_project,
agent_import_link_via_vm, agent_import_root_refused,
follow_links_invalid.

Tests: TestAgentImportFollowsLinks, TestAgentImportNestedLinks,
TestAgentImportRefusedPlaces, TestAgentImportRefusedRoots,
TestAgentImportProjectFolderLinks, TestAgentImportLinkThroughProject,
TestAgentImportRefusedOtherCase, TestAgentImportLinkBounds,
TestLinkSourceGrown, TestAgentImportLinkKinds, TestAgentImportLinkPrune,
TestAgentImportLinkedAgentFolder, TestLinkHops, TestOpenPhysical,
TestFollowLinks; testscript agent_import_links; e2e project section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 20:47:48 -07:00
w3cjandClaude Opus 5.5 848d07f9f8 test(e2e): a failed check keeps the sandbox's proxy logs
A block's cause is in the proxy's own log, which the run deletes with
the VM or build that wrote it, so a failed check showed the block but
never why.

- keepProxyLogs: copies every proxy.log with lines under the sandbox's
  devvm folder (VMs' and builds', not images' or tools'), read through
  os.Root, into proxy-logs/<time> in the state folder, and prints the
  folder and the last 5 lines of each written since the attempt began.
- runner.tail calls it for a failed check and a flaky check's first
  failure; runner.began is the attempt's start; newRunner empties
  proxy-logs/ (sandbox.proxyLogs).
- TestHarnessKeepProxyLogs; Contributing's testing page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 20:42:43 -07:00
w3cjandClaude Opus 5.5 d55476d3e2 feat(images): the prelude is one line, so build scripts keep their line numbers
Every script a build runs with bash, devvm's own and the user's layers,
now gets the prelude as one line, eval $'…', in place of its #! line, so
bash's errors and $LINENO give the script's own line numbers. A script
without a #! line is one line further down.

- shell.QuoteLine: ANSI-C quoting for bash, on one line of printable
  ASCII; every other byte as \xHH, so a multibyte locale's lead byte
  (Shift-JIS, GBK, GB18030, Big5) can't swallow the backslash escaping a
  quote, and a NUL panics as a caller's bug. image's layer rule allows
  internal/shell, a leaf.
- image.WithPrelude, the one place the prelude and a script are joined
  (OwnScript calls it), used by base.sh, apt.sh, the built-in layers and
  features, the user's layers, shared-tools/build.sh and oci/build.sh.
  Every devvm script has a #! line. A leading UTF-8 BOM goes before the
  #! check.
- A build's exports for a company proxy (lima's proxyExports) and the
  user's CAs (trust's exports) end in "; ", not a newline, so they share
  the first line and move no line either; backend.Trust.Env says so.
- The stub logs a bash -s script's second line, which is the script's
  own second line with or without the prelude.
- Keys: every build script's bytes change, so base, every image and
  every shared tool image are built again once; the CHANGELOG's After
  you upgrade says so with git-lfs, and what VMs say until devvm update,
  and Breaking has its own heading.
- Tests: TestQuoteLine (every byte but NUL, a break-out word, in
  /bin/bash 3.2 and PATH's bash, in C and each of ja_JP.SJIS, zh_CN.GBK,
  zh_CN.GB18030 and zh_TW.Big5 that locale -a has), TestQuoteLineNUL,
  TestWithPrelude's shebang and BOM cases, TestWithPreludeRuns (the real
  prelude's line gives the prelude back; a layer under set -euo pipefail
  gets the names, keeps its function and its line numbers, with and
  without exports before it).
- e2e nix: the layer copy no longer adds the prelude itself.
- Docs: images.md's prelude section, Customizing's layer bullet,
  structure.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 17:46:30 -07:00
w3cjandClaude Opus 5.5 6ad4f6cb63 feat(images): your own layers get the scripts' prelude
devvm now puts assets/prelude.sh before a user's layer script, as it does
for its own scripts, so a layer gets $devvm_arch, $devvm_libc and
devvm_sha and can pin a download per architecture (and per C library on
Alpine) the way devvm's scripts do.

- image.WithPrelude puts the prelude before any script; OwnScript calls it.
- build.(*Env).LayerData reads the user's layer and puts the prelude
  before it; a deleted layer is still fs.ErrNotExist (Missing).
- The layer's step holds the prelude, so its key changes on its own:
  every image with a user's layer, and every image above one, is built
  again once. base and built-in-only images, and tool images, keep
  their keys; keyFormat is unchanged. The v0.1.0 fixtures have no user
  layers, so their keys don't move.
- The prelude runs first, so a layer that sets its own devvm_ name keeps
  it.
- layer new's starter mentions devvm_sha and $devvm_arch.
- Tests: TestWithPrelude, TestUserLayerGetsThePrelude (LayerData, the key
  differing from a prelude-less build's, a deleted layer still missing);
  prelude.txtar runs a layer as a build does on gnu and musl, and one
  that overrides devvm_arch and devvm_sha.
- e2e (images): the fixture layer prints $devvm_arch, $devvm_libc and
  devvm_sha of two fake pins, which the check compares with the VM's.
- Docs: Customizing's Mailpit example uses $devvm_arch and devvm_sha;
  images.md's key table, recipe and prelude sections; structure.md;
  CHANGELOG (Breaking).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 17:46:30 -07:00
52bb0f467b feat(clone): a --clone VM gets the repo as it is here
A --clone VM's clone is now seeded with a snapshot, not git push, and
gets everything a working copy has. devvm clone fetch brings it all
back, and devvm rm and clone off check it before deleting.

- Refs: every branch, tag and notes ref, and a detached HEAD.
- Uncommitted changes: staged, unstaged and untracked files; files
  skip-worktree by hand get the index's version, named.
- Operations in progress (merge, rebase, cherry-pick, revert, bisect)
  and the stash; a stash's untracked part goes as its own branch.
- The repo's settings and hooks, sent as settings only where they live
  in the repo (husky); ORIG_HEAD never goes.
- Partial clones, with their promisor remote, and messages per network
  tier when it can't be reached.
- Initialised submodules, nested ones too, each with a clone of its
  own; a submodule's own folder is refused as a top-level --clone.
  vm.json gains an optional `submodules` field.
- Git LFS both ways: objects hash-checked, written under os.Root with
  no link followed, a question past 2 GiB; the filter is set only in
  the clone's repos; git-lfs 3.8.1 in base, pinned by SHA-256.
- rm and clone off keep the VM when anything the VM has didn't come
  back, and name it.
- Every shell script embedded in Go is shellchecked.
- clone.md is a guide that leads with commands; TestUserPageProse
  covers it and coding-agents.md.

After you upgrade: base and every image on it build again once, for
git-lfs.

Fixes #40, reported by @Josuesp1620. Thanks to @dhruv1220 for #42,
which found the cause (receive-pack refusing a shallow push); its
receive.shallowUpdate setting stays in the VM's repos.

Co-authored-by: Dhruv Arora <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:54:42 -07:00
d349868c31 feat(agents): one definition per coding agent, and Cursor's CLI
Every list of the coding agents now derives from internal/agents'
registry, one Def each, and Cursor's CLI (cursor-agent) is a fifth
agent.

The registry:
- each agent's login command, login formats and capture on its Def;
  one message for every agent where each had its own
- the agents' table, the README's list and the docs' history lists are
  generated from the registry (cli.DocBlocks, TestDocBlocks); scripts
  and Go tests take their lists from it too
- each agent's own code lives in a file named for it; the structure
  test lets only an agent's own files choose by its name, following
  constants named after an agent
- a VM remade by clone on/off keeps no agent's login files
  (agents.LoginFiles from every Def.Logins; Claude Code's .claude.json
  stays, as it is also history)

Cursor's CLI:
- `devvm --agents cursor`, `devvm agent login cursor`, history import
  and export of ~/.cursor/chats
- the proxy captures its login at a GET endpoint, guards a shared host
  by path, and puts the login in only where the CLI sends it, bound to
  the CLI's 57 methods
- account changes and the agent store are refused in a VM; Cursor's
  headers and trailers are scanned for tokens
- e2e: Cursor's CLI in the network section, its poll behind the fake
  company proxy

Docs: the agents' pages lead with commands, with a How it works page
for the agents.

Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:49:48 -07:00
CJandClaude Opus 5.5 2b49967b4e chore: CI time zones, test isolation from the repo, a flaky test and the agents page (#45)
Upkeep: CI, flaky tests, dead code and the coding agents page.

- test: tests never run git on the repo they're run from. A git that
  runs the tests (a hook, git rebase --exec) sets GIT_DIR and friends,
  and the tests' plain git followed them into the real repo's config.
  Every test's git now runs through internal/stubtest (Git, GitEnv,
  NoGitRepo), the structure test enforces it, and the whole suite
  passes with GIT_DIR pointing at a decoy repo that stays untouched.
- ci: two test jobs instead of three: Linux in America/Los_Angeles
  (DST) and macOS in UTC, with lint on both, since golangci-lint checks
  only the runner's OS's files.
- test(e2e): accept Codex 0.167's wording for an API-key login.
- test: internal/safefile's swap-after-look branch is tested on purpose
  through a seam, so its coverage no longer depends on a race (97.7%
  every run).
- test(fetch): TestRetryUnanswered's "no answer" comes from a listener
  that keeps its port, so a parallel test's server can no longer take
  the freed port and answer in its place (Linux reuses ports at once).
- refactor(proxy): the test-only policy.decide and policy.byRequest
  move to the tests; the proxy already judges a host from one read of
  the rules (rulesFor).
- docs(agents): "Pasting images" moves down the coding agents page,
  before History, and its run of paragraphs becomes commands and
  lists, every fact and anchor kept.

Gate and coverage pass on each commit; e2e `network` and `project` pass
on Linux (251 passed, 4 macOS-only skips).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-12 07:20:42 -07:00
2f0cc97392 feat(paste): devvm paste and devvm paste rm (#38)
feat(paste): devvm paste, an image, PDF or copied file from the clipboard into the VM (#38)

devvm paste reads the host's clipboard and streams what's on it into the
running VM's paste folder over the backend's Exec, with no SSH agent and no
new channel, then copies the file's path in the VM to the host clipboard for
the agent's prompt. devvm paste rm empties the folder after a question, and
a launch that starts a stopped VM offers to.

What it reads:
- an image (PNG, JPEG, GIF, WebP; TIFF is converted to PNG), checked by its
  bytes; browsers hand over a PNG, so an animated GIF arrives as one frame
- PDF data, sent as it is, and preferred over a file reference beside it
  (Preview's page copies)
- one copied file, after a question that shows its path on this machine;
  --send-file answers it only for a file inside the project folder reached
  without links, and never for a --clone VM
- never text; several files are refused

Security:
- macOS reads file URLs only through NSPasteboard (FileURLsOnly): AppleScript's
  «class furl» coercion turned any text, such as a path a web page or the
  VM's OSC 52 put there, into a file to send
- copied files are opened with openat and O_NOFOLLOW|O_NOCTTY|O_NONBLOCK,
  following a root-owned link only in a folder only root can change, and read
  through internal/safefile (Checked), capped at 64 MiB
- osascript and pbcopy by absolute path, Linux's tools only from system
  folders, never PATH
- time limits on every clipboard tool and on paste.sh in the VM; bounded
  reads of everything the VM prints
- the path copied back is built on the host, keeping only the file's
  extension: nothing the VM says reaches the clipboard

Also: the paste-dir setting (default /tmp/devvm-paste, made at each
launch), --json with sent, the agents' guide line, messages with doc links,
stubs, CLI tests, an e2e check in the project section, and docs on
coding-agents, settings, design, security and attack-vectors.

Co-authored-by: dustypolk <[email protected]>
Co-authored-by: w3cj <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-11 22:29:46 -07:00
w3cjandClaude Opus 5.5 28d7eca6c8 test(e2e): never leave or trip over a project VM
Check 2 of project fails at once without check 1's VM, cleanup deletes
any VM whose folder is under the run's project folders (and its state
folder), and setup refuses a slot whose Lima home has project VMs an
earlier run left, printing the commands that delete them (not with
--reuse). leftoverVMs, projectVMs; TestHarnessLeftovers,
TestHarnessProjectVMs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ
2026-11-09 12:19:49 -07:00
w3cjandClaude Opus 5.5 7b876d7285 build: bump nix to 2.35.5 and the e2e pins (#39)
scripts/bump.sh nix e2e-tools e2e-from; mise stays deferred.

- assets/layers/nix.sh: nix 2.35.4 -> 2.35.5 (sha256 arm64
  34b8d0c0658321e63143f892086bd2d9623a81bf96e4ffefc1551092d80caedb,
  amd64 c349f0559b7849a2cb3b20b8584e532b3fcf5025092cb6180eb0b99240d7b96c),
  which changes the nix layer's image key.
- tests/e2e-mise.lock: codex 0.166.0 -> 0.167.0 (its entries now carry
  mise's checksum_source = "mise-versions", as others already did) and
  opencode 2.2.5 -> 2.2.6; node, pnpm, bun, python, uv, go, rust,
  dotnet, claude and pi were already the newest.
- tests/e2e/from_test.go: fromAlpineDigest -> sha256:f59abe656b69…,
  alpine:3's digest now (3.24); node:24 and ubuntu:26.04 didn't move.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ
2026-11-09 10:46:11 -07:00
w3cjandClaude Opus 5.5 ab125b1af6 fix(lima): tidy the remount restart's failure paths
A review of the remount restart found its failure paths loose:

- A restart whose limactl stop failed returned the plain message, and
  the caller then stopped the VM's proxy with the VM still running.
  Now a folder still mounted with the old mode is warned of and the VM
  goes on with its proxy, and anything else fails as a logged
  stop_failed, saying the VM didn't stop.
- The interrupt's cleanup was dropped before the restart's stop, so a
  Ctrl+C during that stop could leave an open-tier VM running. It now
  stays until any stop in remountProject returns.
- The start again repeated the first start's warnings (policy lines,
  pins, a degraded start). The UI now says each warning once a run, by
  its name and values, which covers every package's warnings without a
  flag through each of them.
- mount_cache_unmounted and mount_cache_unchecked come only after the
  restart failed, so they no longer say to run devvm restart: they say
  the VM is stopped and its console log may say why.
  mount_cache_remount_failed says the old mode can lose writes and what
  may hold the folder. Their doc links stay on "When the cache mode
  changes", which now points to the console log.
- The mountinfo check's comments and docs say why it's used (portable:
  any awk, no util-linux tool but mountpoint), not that Alpine lacks
  findmnt, which devvm's base layer installs there.
- design.md: the stop that fails, the warnings said once, the cleanup
  through the stop, and the older race of another devvm starting the VM
  in the gap, which fails closed.

Tests: TestRemountRestartStop (the cleanup held through the stop; a
stop that fails, mounted or not), TestRemountRestartConfined (each
start's undoStart, an interrupt between the starts: one start, the proxy
stopped, the one undo kept; a start again whose proxy fails), TestWarnOnce,
and mount_cache.txtar's allowlist restart warning of a bad policy line
once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ
2026-11-09 10:33:03 -07:00
w3cjandClaude Opus 5.5 db26def35b fix(lima): restart once when the folder can't be mounted again
After a cache-mode change, a Linux VM's start mounts its 9p project
folder again in the guest. On an Alpine --from VM (OpenRC) the umount
succeeds but both mounts fail ("already mounted or mount point busy"),
and devvm stopped the VM with mount_cache_unmounted, though a plain
restart boots with the new mode, which lima.yaml already has.

Now a folder left unmounted, still on the old mode, or a check that
fails gets one restart: the Lima backend writes why in the run log,
stops the VM under one status step (remount_restarting) and returns a
backend.RemountError. The caller, starter.start, starts the VM again
once through startOnce, the same path every start takes, so the restart
gets a new proxy following the new hostagent (the old one exits with
it), the .git pins applied in QEMU's new namespace, its host keys read
again for the new start, and its start recorded. That start's
Want.CheckCache asks Lima for the mountinfo check without the remount;
its outcome is final: unmounted or unchecked stops the VM and fails
with today's messages, another mode warns (its text now says to run
devvm restart to try again). An interrupt gets no restart, and the
cleanup stops the VM once.

- backend: RemountError, Want.CheckCache; backendtest.Fake.StartErr.
- Tests: TestStartSetsProjectCacheOnce (each failure a RemountError,
  the run log's line), TestStartRechecksProjectCache (the restart's
  check, no second restart), TestRemountInterrupted (no restart),
  TestRemountRestart in vm (two starts, a proxy each, no third).
- Stubs: remount-fails (the remount fails and leaves the folder
  unmounted until the next start); TestGuestMountOptions covers it.
- mount_cache.txtar: the restart that mounts the folder, and the one
  that doesn't, with no third start.
- e2e: the from section's Alpine check expects the launch to succeed
  through the restart.
- Docs: backends/lima.md's "When the cache mode changes", design.md's
  remount, restart and running-VM paragraphs, tests.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HTFcPrY8FzzQMopN5wgpLQ
2026-11-09 09:57:17 -07:00
w3cjandClaude Opus 5.5 2406b498d8 fix(lima): check the remounted folder without findmnt
After a start that switches a Linux VM's project folder to cache none,
devvm checked the remount with findmnt -no OPTIONS, but the Alpine
--from base has no util-linux and busybox has no findmnt, so an Alpine
VM got an empty answer and was stopped with mount_cache_unchecked. The
guest now prints the folder's line of /proc/self/mountinfo, picked by a
POSIX awk (lastMount) that busybox runs: the last line whose mount
point is the folder exactly, as mountinfo escapes it (mountinfoPath:
\040, \011, \012, \134), which awk reads from the environment, as -v
would undo the escapes. devvm reads the mount's and its file system's
options from it (optionsOfMountinfo), refuses an answer that isn't a
mountinfo line, and keeps the 4 KiB cap, the last line and "unknown"
for a mode it doesn't know.

- TestOptionsOfMountinfo, TestMountinfoPath, TestLastMount: real lines,
  9p with and without cache=0x5, Alpine's without optional fields,
  stacked mounts, a path with a space; awk run on them.
- The stubs' guest answers with a mountinfo line; the start tests and
  the mount_cache script check the new command.
- e2e: the from section's Alpine VM, given Lima's mmap with no mode
  chosen, gets none from devvm mount-cache none at its next start on a
  Linux host; the e2e helper reads mountinfo too.
- design.md and tests.md say how the check works and what e2e checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 08:57:45 -07:00
w3cjandClaude Opus 5.5 665f27dcb5 fix(network): log only IPv4 connections as transparent mode's refusals
In table inet devvm_transparent, the sentinel chain began with
`ip daddr != 198.18.0.1 return`, and in an inet table an ip match
holds for IPv4 alone, so every IPv6 TCP connection skipped the return
and hit the refusal's log: devvm-why listed [::1]:8787 as refused while
curl localhost:8787 worked over it. The sentinel now returns anything
but IPv4 first. The stand-in address is IPv4, and a connection to it
from an IPv6 socket (::ffff:198.18.0.1) leaves as IPv4, so this opens
no IPv6 way to it. The other chains' ip daddr rules match positively,
so IPv6 only skips them: early_in, early_out and input drop or accept
IPv4 traffic to the stand-in address, and the DNS redirects in output
and from_containers never took IPv6.

- TestTransparentRuleset: the sentinel's first rule returns IPv6, then
  the address's return, and the refusal's log is the sentinel's alone.
- e2e (transparentRuns): an IPv6 connection on loopback that works
  isn't listed under devvm-why's refused connections.
- docs: with transparent mode off, a lookup in a confined VM fails at
  once on macOS but only after systemd-resolved's timeout on a Linux
  host, 35 to 40 seconds for each lookup (safety/network.md,
  troubleshooting, internals/lima.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:41:57 -07:00
w3cjandClaude Opus 5.5 cb36951de2 refactor(git-protect): drop strict, convert strict VMs to on
devvm git-protect strict (0.1.0, 0.1.1-rc.1) set diff.ignoreSubmodules =
all in the locked .git/config, which can't keep git on this machine out
of a submodule the VM adds: a .gitmodules ignore line the VM writes
overrides it, and git add -A/-u, describe --dirty, diff-index,
diff-files, fetch and pull recursion and --ignore-submodules on the
command line enter submodules anyway (#37). --clone is the only way to
keep VM code away from host git.

- devvm git-protect takes on|off; strict is a usage error
  (git_protect_strict_refused) naming devvm clone on. Use, help,
  completion (Modes) and --json reflect it.
- A VM left strict reads as on (Mode, Next) and is pinned and kept as on.
  The first check that finds it stopped (Check, then converter.unstrict:
  launches, devvm stop, devvm clone on and its undo) removes the value all
  from the .git/config of each repo its state recorded before that check,
  under the host's git lock, and only where .git's identity is the
  recorded git_id (a replaced .git, or a VM with no record after devvm
  adopt, is left alone, its all named with the manual remedy:
  git_strict_unknown). Each config is read through safefile first,
  unlocked for the edit and locked again even after an interrupt
  (context.WithoutCancel), and checked to still be a regular file in that
  .git afterwards (git_lock_raced). On a watching host, a config whose sum
  isn't the check's is left, and the new sums go into the watch's. An
  interrupt records nothing. Then on is recorded (mode and next) with one
  warning (git_strict_converted), none when next is off. Set on/off and
  Unlock (devvm rm) remove it the same way, silently (strictLeft).
- strict recorded nothing about a value it overwrote, so nothing can be
  restored: only all is removed (--unset-all '^all$'); any other value is
  the user's and stays. This fixes off, which unset any local value.
- A config another VM keeps locked keeps it, named with the manual
  remedy (git_strict_kept, via msg.M.Value), and its repo goes in the
  state's strict_left, retried at each later stopped check until empty.
  A config git can't change is named (git_strict_left).
- Messages: git_locked and git_embedded_new say what on can't stop;
  git_locked_strict and git_config_failed go.
- Docs: .git protection's Strict section becomes VMs that were strict,
  with the remedies; on and Not covered say a submodule or repo the VM
  adds runs through host git until the next check names it, and only
  --clone keeps VM code away; attack vectors, How it works, the design
  notes, the commands table, ls, the cli skill and the CLI reference
  follow.
- Tests: strict_test.go (conversion, values kept, off/on/unlock, nested,
  kept and retried, replaced and unrecorded .git, interrupted, next off,
  changed since the check, Linux pins and sums, Watch, next, a failed
  edit), TestUnstrictFIFO, msg TestValue, git_protect.txtar,
  git_pins.txtar, fixture_v010_strict.txtar (0.1.0's app VM made strict
  on macOS), e2e project checks on macOS and Linux.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:20:00 -07:00
w3cjandClaude Opus 5.5 647ad4bf2a feat(network): transparent mode for tools that ignore the proxy settings
On every confined tier, a tool that ignores the proxy settings (workerd
under wrangler dev, a static Go binary, a container made through Docker's
API) reaches the VM's proxy by the names it looks up. In the VM, dnsmasq
answers every name with the stand-in address 198.18.0.1 and has no
upstream; nftables sends that address's ports 80, 443 and those the allow
rules name to socat listeners on it, which make each an authenticated
CONNECT transparent.devvm.proxy:PORT to the VM's proxy. The proxy reads the
host from the connection's first bytes (TLS SNI, or each HTTP request's
Host) and judges it as CONNECT host:PORT, with the same order of checks,
log, secrets and floor. A blocked HTTPS host gets the 403 over a
certificate from the VM's CA. Nothing new runs on the host, and the
backends don't change.

Proxy (internal/proxy):
- transparent.go: TransparentHost, ProxyDomain, SentinelAddr,
  IsSentinelAddr, ViaDNS, transparent (serve, take, tls, handler,
  refusePage, ports), sniHost, replay, reservedRefusal, withVia, viaOf.
- routeFor and route: the one order of checks for CONNECT and the
  transparent path; carry, the one tunnel with its SNI check; block split
  into the record and blockPage; links.refuse split (isLinkDomain);
  caEndedRefusal's test moved to routeFor; handshake and serveOne shared
  by intercept and the 403 page.
- devvm.proxy reserved whole, CONNECT devvm.proxy:P included; the stand-in
  address refused with its own reason.
- Hosts and SNI in ASCII alone, never folded (the Kelvin sign), in
  splitHostPort, sniMatches and sniHost.
- A ClientHello record past 16 KiB + 256 is never read; once it starts,
  a ClientHello must arrive whole within 10 s, on every tunnel; a stream
  whose first byte is 0x16 is TLS from then on, so a record header that
  doesn't come whole, or isn't TLS's version, is refused, never passed on
  unchecked; and only a ClientHello that parsed (sniOf) counts, so one
  split across records is refused, an address's tunnel's included, which
  may have no name (a gap older than this change).
- routeFor carries the method and path rules: a host they narrow is
  refused where it can't be decrypted and intercepted where it can, on
  the transparent path too.
- On the transparent HTTP path, devvm.proxy answers /blocked alone.
- policy.transparentPorts and /transparent/ports: 80, 443, then the ports
  allow rules name for hosts by name, at most 32, never 22 or 53.
- Event.Via ("dns"), shown in devvm network log, /blocked and the prompt's
  note as "without proxy settings".

Guest (assets/): base.sh installs dnsmasq(-base), socat and nftables;
guest/transparent.sh is devvm-transparent: setup and teardown from
sync.sh (the proxy URL on stdin), the supervisor service (systemd or
OpenRC), the ruleset (render: two filter chains at -150 keep every
interface but lo and Docker's bridges, and every protocol but TCP, UDP
and ICMP, off the stand-in address; both NAT chains at -110 map every port of
the stand-in address, so Docker's published ports never take one; DNS to
public servers and 127.0.0.1:53 go to dnsmasq, which listens on the
stand-in address alone; private, link-local, CGNAT and loopback servers
are left alone, but the VM's own name servers, which Lima's DHCP adds
beside 127.0.0.1 and Docker gives containers, go to dnsmasq too), slots,
the port list's check, and status for devvm-why. Names without a dot and
names under the search domains (this machine's network's, through Lima)
don't resolve.

Setting: config.toml's transparent-proxy, and devvm network transparent
[on|off], the VM's own value in net.transparent (Settings.Transparent,
SetTransparent; netpolicy.TransparentOf, TransparentAddr); the setup gets
DEVVM_TRANSPARENT_ADDR while the VM runs confined and its mode is on.
devvm network --json has transparent; devvm network lock lists apart the
hosts only tools without proxy settings reached (Learned.NoProxy, via in
--json). vmssh.dialAddr refuses the stand-in address.

Tests: the transparent path's unit tests and FuzzTransparent; the
setting, TransparentOf, FormatEvent's via and learned hosts; the ruleset,
slots and port list under bash 3.2; network_transparent.txtar and
sync.txtar; e2e: transparentRuns, the network section's checks, a docker
step, the from section's Debian 12 and Alpine on the allowlist tier, and
the guarantee checks run with transparent mode stopped and running.

Docs: safety/network.md (tools that ignore the proxy, what isn't
covered, the setting, logs, lock), internals/network.md (tools that skip
the proxy), internals/design.md (the design note and threat check),
using/settings.md, using/troubleshooting.md, using/limits.md,
using/images.md, safety/attack-vectors.md, internals/lima.md,
contributing/tests.md and testing.md, the proxy's README, the CLI
reference and the Commands page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:18:53 -07:00
w3cjandClaude Opus 5.5 6fd1d846d6 fix(lima): cache a Linux VM's project folder with 9p's none
Linux's 9p client loses data with Lima's default cache=mmap for a
writable share: a stat() during an extending write() takes the host's
stale size and writeback drops the data, so files reach the host empty
or cut to 4096 bytes even after fsync (Claude Code's Edit sets it off);
and on devvm's Ubuntu 26.04 guest kernel, a lock after a write makes the
next read return zeros, which breaks SQLite in any journal mode and
Gradle's daemon. macOS's vz VMs use virtiofs and aren't affected.

- New VMs on a Linux host record cache mode none in a new mount section
  of vm.json, and their project folder is made and started with it, as
  is the folder devvm clone off mounts. VMs whose state has no mode
  (0.1.0's, and every VM made before this) keep Lima's mmap untouched,
  with no limactl edit, and each launch warns (mount_cache_unchosen)
  until devvm mount-cache none.
- devvm mount-cache [none], with --json: none is the only mode devvm
  sets, so any other value is a usage error (mount_cache_invalid); a
  stopped VM gets it in its next start's one edit, a running one after
  the restart devvm offers. macOS refuses (backend_lacks), and so does a
  Linux VM whose folder isn't a 9p mount (mount_cache_no_choice). No -g
  or config.toml key: every new VM gets none.
- The start that changes the mode mounts the folder again in the guest,
  as cloud-init rewrites fstab only after systemd has mounted it, through
  the logged runner with a minute's limit (output pipes closed a second
  after), then checks it with mountpoint and findmnt, reading 4 KiB at
  most and only the last line: a folder left unmounted stops the VM and
  fails the start before its shell (mount_cache_unmounted), and so does a
  check that gets no answer (mount_cache_unchecked); one still mounted
  with the old mode is warned of (mount_cache_remount_failed), any mode
  but none or mmap named unknown. An interrupt meanwhile, on any tier,
  leaves a cleanup that stops the VM, the one stop then. A launch into a
  running VM asks the guest, in words, whether its folder is a mount
  point, and refuses one that isn't (project_unmounted) or whose check
  fails or gives no answer (project_unchecked). A stored mmap, from a
  build before none alone, reads as none chosen, and devvm clone off
  records none for its new mount; any other mode is refused naming
  vm.json.
- backend: FeatureMountCache (native on Linux, none on macOS, built on
  project-mount), Want.ProjectCache, Instance.ProjectCache, CacheModes.
- lima: mount rewrites keep only the sshfs and 9p settings devvm knows
  where they differ from Lima's defaults, and drop the rest for Lima to
  fill in, so lima.yaml never freezes a default; same() compares the
  cache where devvm sets one. Build VMs' writable output folders (tools,
  --from) get none.
- tools: an EROFS tool image that ends before its superblock does, or is
  shorter than its superblock says, as a build under mmap could leave
  one, counts as not built, so the next build makes it again; a build's
  short output is refused. The fakes' tool images are a page
  (backendtest.ToolImage).
- The limactl stub lists QEMU's vmType, fills in 9p cache defaults on
  Linux, and answers the remount's check.
- Docs: backends/lima (the project folder's cache, when it changes,
  programs that map files for writing, SQLite), using/limits,
  using/clone, commands, internals/lima, internals/backends, the design
  note (both mmap bugs, why none alone, the remount, tool images, the
  e2e findings), the CLI reference and the cli skill.
- Tests: TestProjectCache, TestMountRoundTrip,
  TestStartSetsProjectCacheOnce (the remount's outcomes), TestCutShort,
  TestBuiltCutShort, TestGuestMountOptions, TestFilledMounts,
  TestUpCacheMode, TestWarnMountCache, TestCacheAtNextStart,
  TestSwitchCache, TestSetMountCache, TestCheckStateCache, the
  mount_cache CLI test, clone_switch and the 0.1.0 fixture on Linux, and
  e2e's projectMountCache (findmnt, a stat-while-write loop, SQLite's
  journals, a shared writable mmap refused, the opt-in switch of an
  unchosen VM, what mmap does reported, macOS unchanged).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-09 07:17:12 -07:00
w3cjandClaude Opus 5.5 01e5d2488a feat(network): rules by HTTP method and path, and secrets by method
A policy rule for a host name can narrow it to some of its requests:
`api.github.com GET,HEAD /repos/` in a policy file, written by devvm
network allow, deny and rm from --method and --path. Allows add up and a
deny beats any allow, as for every rule, so narrowing a host that a rule
allows whole, such as devvm's built-in GitHub, takes a deny:
`devvm network deny api.github.com --method POST,PUT,PATCH,DELETE`, or
`devvm network deny github.com --path '/*/*/git-receive-pack'`. An allow
by method and path for a host already allowed whole warns that it
narrows nothing and names the deny.

The proxy decrypts such a host's HTTPS on :443 with the VM's CA, refuses
its tunnels on other ports and without a CA, and judges every request on
the connection, kept-alive HTTP/1.1 and HTTP/2 alike, every absolute-form
one, and the shared Nix cache's own fetches. A connection's verdict and
whether its requests are judged come from one read of the policy files.
A blocked request gets 403 and a blocked event with its method and path;
devvm network log shows it, and an allowed one's forward event names the
rule that let it through.

One matcher, internal/proxy/request.go, judges rules and secrets'
bindings: methods from a closed list (RFC 9110's, PATCH, QUERY; never
CONNECT); the methods a request names besides its own (every
override-like header in any spelling, `_` for `-`, and the query's
_method), each word judged, and while a rule narrows by method, a value
that isn't exactly one method refused; path patterns with *, ** and a
last / for everything below; and only a path in plain form. Allows and
bindings match strictly, denies broadly: any case, every path that isn't
plain, the prefix above a trailing /, and a last segment cut at its first
dot (/admin.json, /admin.). A method devvm doesn't know isn't a rule, so
a typo in a deny is a broken deny. Upgrades other than WebSocket and
CONNECT inside a decrypted tunnel are refused for narrowed hosts.

devvm secret set takes an optional --method (none for every method), and
a secret's --path takes the same patterns, marked path_pattern in
custom-secrets.json; a saved path with a * from before is refused rather
than read as a wildcard. The bindings file stays version 1 while every
binding reads alike to an older proxy, so devvm secret set and rm after
an upgrade don't take a running older proxy's bindings away; a binding
with methods or a pattern makes it version 2, which such a proxy refuses
instead of putting a value in for every method, and writing one warns
for each such VM. devvm network allow, deny and rm warn, naming the VM,
when a rule by method and path changes while the VM's proxy runs from
another devvm binary, or one devvm can't tell. A query with a ; or one
Go can't read whole is refused while a rule narrows the host by method,
and denies also match each segment with its trailing dots dropped. An
allow that narrows nothing names the VMs, with -g by each VM's own
allowlist, and says when it narrows only port 80's plain HTTP.

- proxy: match, Methods, ParseMethods, PathOK, plainPath, matchPath,
  overrides, overrideLike, server.judgeRequest; parseRule/parseHostRule,
  CanonicalRule, NarrowRule, Narrowable, hostRules (rulesFor, verdict,
  byRequest, judge, unjudgeable), egress.checkHost,
  Allowlist.CoversWhole, trimDots; Binding.Methods, BindingListVersion
  2 when needed (v1Binding);
  pathWithin and PathPrefixOK folded into match; the Nix cache judged
- netpolicy: Rule(rule, deny, methods, path), NarrowedHost, sameRule,
  Proxy.Allowlist, Proxy.NarrowNotes, Proxy.OtherBinaries, BasePolicy,
  Proxy.SecretsWritten (after RefreshSecrets and devvm agent login
  --api-key's write);
  FormatEvent shows a blocked request's method and path and a forward's
  rule
- secrets: Def/Secret/customJSON Methods, path_pattern, CheckMethods,
  CheckPath on proxy.PathOK
- vm: RuleChange, PolicyChange(ctx, rules, RuleChange)
- cli: --method and --path on network allow, deny and rm, --method on
  secret set, METHODS in devvm secret and "methods" in its --json
- messages: bad_request_path (was bad_secret_path), bad_methods,
  rule_not_narrowable, rule_narrows, rule_narrows_nothing,
  rule_narrows_http_only, rule_narrows_unknown, proxy_other_binary,
  secrets_other_binary
- tests: TestParseRuleNarrowed, TestMatchPath, TestDenyBypasses,
  TestAllowNarrowed, TestCoversWhole, TestForRequestMethods,
  TestInterceptRules and TestInterceptSecretMethods (HTTP/1.1 kept alive
  and HTTP/2), TestNarrowedNotDecrypted, TestNixCacheRulesByPath,
  FuzzDenyBypass (paths, methods, headers, _method), TestRule,
  TestNarrowedRules, TestOtherBinaries, TestRefreshSecretsOtherBinary,
  TestNarrowNotesUnreadable, TestDefine's path of /, TestReadBindings'
  versions,
  TestCustomsUnreadable's prefix path, network_narrow.txtar (narrows
  nothing), secret_custom.txtar's --method; on 0.1.0's frozen state:
  TestV010Bindings, TestV010ProxyConfig, TestV010Rules (0.1.0's
  TestParsePolicy and TestDecide, frozen), fixture_v010_network.txtar;
  e2e network: netRequestRules
  and the basic secret's --method GET,HEAD
- docs: safety/network.md's Rules by method and path, the secrets'
  flags and an example, internals/network.md's Requests by method and
  path, the design note replacing the open-work entry, attack vectors,
  the commands page, internal/proxy/README.md, the CLI reference

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-08 21:38:23 -07:00