340 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 ffacfb75ef fix(bump): e2e-tools reads mise's 404 when mise prints in color
On CI mise prints its log in color, so unpublished's ^mise ERROR match
missed the 404 and the run failed with "mise lock failed" instead of
waiting for upstream. mise lock now runs with MISE_COLOR=0, and
unpublished strips SGR escapes before it reads the errors and the
Processing line.

bump.txtar: a stub log with CI's colored lines, and the stub records
the MISE_COLOR it was run with.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 09:13:04 -07:00
w3cjandClaude Opus 5.5 bc185ec80e fix(release): every file release.sh writes is 0755 or 0644, whatever the umask
minisign writes its signatures with the process umask, so on a host
whose umask is 0002, as Ubuntu's is, dist/SHA256SUMS.minisig came out
0664, and --ci-sign's SHA256SUMS.ci.minisig, --sign-legacy's signature,
--formula-from's formulas and --ci's folder for the co-signer were
group-writable too. release.sh now sets umask 022 once at its top, for
the host and the container alike, in place of the two copies in build
and modules.

release_head.txtar's modes check builds under umask 0002, checks the
signature is 0644, and labels the catch-all lines so a stray mode can't
pass as an expected one; release_ci.txtar's --ci-sign runs under umask
0002 and checks its signature is 0644. Both failed before the fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 07:35:02 -07:00
w3cjandClaude Opus 5.5 2cc9d8c862 fix(bump): e2e-tools waits for a release that isn't published everywhere yet
When a shared tool's newest version, newer than tests/e2e-mise.lock's, has
no download for a platform yet (mise lock stopping on a 404, as for Node
24.23.0's linux-arm64-musl build, a lock entry without a checksummed
download, or a dotnet SDK without its archive), e2e-tools names the tool,
version and platform. --check reports it as waiting for upstream and goes
on, so the weekly Pins workflow passes; applying prints mise's output,
stops, to try again later, and writes no lock.

After a 404 wait, --check holds that tool back in its copy of mise.toml
(at the e2e lock's version, or left out when the lock has none) and runs
mise lock again, so the other tools are still reported and their
failures still stop the run. A tool is held back once at most: its 404
again fails the run, so the loop ends. The Pins workflow's issue lists
the waiting lines in their own Waiting for upstream section and stays
open while any is there, and maintaining.md says to look at a wait that
lasts two weeks, and to bump the other pins by name meanwhile, since a
plain run stops at e2e-tools.

Real failures still stop the run: a 404 or missing download for a version
the lock already has, a checksum mismatch, any other mise lock error, an
unfetchable releases.json, and a dotnet entry its downloads can't go into.
A 404 counts as unpublished only when it's mise's only ERROR line, apart
from its Version: and Run with --verbose trailer, and never a WARN, so a
checksum mismatch beside a 404 fails. dotnet's downloads go only after
the specifiers line of dotnet's own entry, which ends at the next [
header, and only dotnet_downloads' own wait (dotnet_waited) skips
dotnet's checksum check.

It waits rather than stepping back as devvm does for users: a step back
in bash would copy internal/tools' stepBack, and the next run retries.

New in scripts/bump.sh: newer, not_yet, unpublished, hold_back, the
waiting and dotnet_waited flags. bump.txtar covers the musl 404 with the
rest still reported (the tool left out, and held at the lock's version),
a held tool's 404 again, the lock-version 404, a checksum mismatch alone,
beside a 404 ERROR and beside a WARN-level .sig 404, a WARN-level 404
alone, a 404 whose URL holds two tools' versions, mise's output on the
apply path, dotnet waiting (reported once, for its own platform) and its
control, an unfetchable releases.json against the older lock, a tool
missing checksums reported once with the rest still reported, a dotnet
entry missing a checksum while another tool waits, and a dotnet entry
without specifiers before another tool's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 07:35:02 -07:00
w3cjandClaude Opus 5.5 c09875c55d fix(bump): e2e-tools downloads devvm's host mise as its pinned .tar.gz
devvm's host mise pin (internal/tools/mise.go's miseSHA256) has been the
SHA-256 of mise's .tar.gz since mise was downloaded as its archive, and
bump.sh mise writes it from SHASUMS256.txt's .tar.gz lines, but
bump_e2e-tools still downloaded the raw binary (mise-v$v-$os-$a) and
hashed it against that pin, so every e2e-tools run, the Pins workflow's
--check included, stopped with "devvm's host mise ... doesn't match its
pinned SHA-256". It now downloads mise-v$v-$os-$a.tar.gz, as miseURL
does, checks it against the pin, and runs the mise/bin/mise it takes out.

Its hashes, and e2e-from's and e2e-curl's digests, go through the
script's sha256 helper rather than shasum, which Fedora lacks.

bump.txtar's new case runs bump.sh mise and then e2e-tools on a release
whose .tar.gz and raw binary have their own SHA-256s, as a real one does:
the lock is resolved by the archive's mise, with dotnet's downloads and
the mise.toml's SHA-256, and an archive that isn't the pinned one is
refused before its mise runs. It failed on the old script with the
Pins workflow's error.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-12-01 05:19:12 -07:00
w3cjandClaude Opus 5.5 0c6ee50ff5 fix(bump): GitHub's API calls send the workflow's token
The Pins workflow's run on 30 November failed right after nix with
"curl: (22) The requested URL returned error: 403". The next call was
direnv's gh_latest, an unauthenticated curl to api.github.com: GitHub
allows 60 of those an hour from one address, which a hosted runner
shares with other jobs, and answers 403 once they're spent. The workflow
already set GH_TOKEN and GITHUB_TOKEN for gh, but curl never sent them.

gh_api now makes every GitHub API call (gh_latest, gh_head and Lima's
release), with GH_TOKEN or else GITHUB_TOKEN when one is set, written
to a header file in the run's temp folder (mode 600) and passed as
-H @FILE, so it's on no command line and goes to api.github.com alone.
A failed fetch now names its URL, which the failed run's log didn't.

bump.txtar's curl stub records the header files it reads, and the test
checks that GitHub's API gets GITHUB_TOKEN, and GH_TOKEN when both are
set, that for each no other URL and no argument gets it, that no call
has a header without one, and that a failed fetch names its URL. It
fails on the old script. Contributing's Updating pinned versions and
the Pins workflow's comment say so.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 23:15:59 -07:00
w3cjandClaude Opus 5.5 19ae9a7071 feat(release): the switch: the maintainer signs and pushes the tag, and CI and the co-signer do the rest
scripts/publish.sh's default is now the maintainer's whole part of a
release that CI builds and the co-signer publishes: the tag's checks,
then main and the tag pushed to origin, which starts the Release
workflow, and what comes next. It needs git alone. It refuses a tag
whose commit has no release keys, which CI's workflow would refuse, and
a version with no changelog entry, which the co-signer takes the notes
from.

- scripts/publish.sh --sign-legacy, the one command for the bridge:
  VERSION's draft release, which the co-signer made, has SHA256SUMS,
  SHA256SUMS.ci.minisig and SHA256SUMS.cosign.minisig downloaded, and
  scripts/release.sh --sign-legacy checks both signatures with this
  checkout's packaging/keys and devvm-release <version>, then signs
  SHA256SUMS with the old key, devvm <version>, and checks that with
  packaging/minisign.pub; after asking once, SHA256SUMS.minisig goes on
  the draft, which the co-signer waits for, then publishes. A draft
  that has it already, or a published release, or a draft without the
  co-signer's signature yet, is said so, and nothing is uploaded. A
  checkout without the release keys is refused before anything is
  signed, pointing at github-setup.md's step 1, as is the default
  mode's tag without them.
- scripts/publish.sh --local, the old path, as it was: built, signed
  with the old key alone and published from this machine. It stays
  until the GitHub setup for CI and the co-signer is done, and goes
  when the bridge ends, as a release that only the old key signed is
  then one no devvm accepts. A flag, not the default, because the
  default is what's documented and what's safe to run at any time: it
  publishes nothing itself, so run before the setup it only pushes a
  tag whose workflow run fails; and a --local release after the
  co-signer starts is one it alerts on, as it didn't publish it.
- scripts/release.sh --check-tag: --check's tag and keys checks alone,
  with no container runtime or signing key, which the default mode runs.
- The shared parts are one function each: check_tag (the tag, main
  and origin), notes (the changelog entry), ask (the question), needs_gh.
- release.sh's closing line names publish.sh --local, and --tag's build,
  CI's and the co-signer's, has none.

Tests: testdata/script/publish_tag.txtar (the modes in --help, two
modes refused, no tag, another signer, a dirty tree, no release keys,
no changelog entry, a tag off main's HEAD, --dry-run, n, y and the
pushes in order, again with nothing to push, origin's other tag;
--sign-legacy: gh logged out, no draft, no co-signer signature yet, a
co-signer signature by another key, CI's for another version, --dry-run,
y and the upload, which verifies as devvm 1.2.3, again with nothing to
do, a published release, a checkout without the release keys), failing
before the code; publish.txtar runs the old path as --local, in a repo
without release keys, as devvm is until they're made: SHA256SUMS signed
with the old key alone, no role signatures, install.sh's key lines
empty.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
w3cjandClaude Opus 5.5 5b2786c758 ci(release): CI's release workflow, which builds, signs and hands each tag over
.github/workflows/release.yml, CI's half of each release, for a pushed
v* tag, in the release environment, which waits for the maintainer's
approval and holds what the workflow trusts: RELEASE_TAG_SIGNERS, the
SSH keys that sign release tags, and RELEASE_CI_KEY, CI's release key.
The job's token has contents: read, and id-token and attestations write
for the attestation alone, so it can't make or publish a release; the
co-signer does.

- scripts/release.sh --ci TAG DIR: the tag checked against
  DEVVM_RELEASE_SIGNERS, an allowed signers file, never the tagged
  commit's packaging/release-signer, as CI runs the tag's workflow and
  release.sh: annotated, a release's version, its tag object naming
  itself, signed by one of those keys, its commit on main
  (DEVVM_RELEASE_MAIN, refs/remotes/origin/main by default) and holding
  the three release keys. Then --tag's build, with the same signers as
  git's, and DIR with SHA256SUMS and exactly the files it lists, each
  checked against its SHA-256, and not the formulas, which the
  co-signer renders.
- scripts/release.sh --ci-sign TAG DIR: SHA256SUMS signed with CI's key,
  read on standard input into the script's memory and handed to
  minisign through a pipe, never a file or an argument, with the trusted
  comment devvm-release <version>, checked with the tag's
  packaging/keys/release-ci.pub, which can't be marked PLACEHOLDER: a
  key on standard input that isn't CI's is refused, and its signature
  removed. The placeholders' check is placeholder(), one owner for
  --tag's check and this one. --ci and --ci-sign refuse a tag without
  the release keys, pointing at github-setup.md's step 1.
- The workflow: a first step that stops a tag without the release keys
  before anything is installed, with the same pointer, then the tag
  fetched as GitHub has it, minisign alone through
  mise with no cache, the build under the runner's podman, the
  signature, an artifact attestation of every file SHA256SUMS lists
  (subject-checksums), and the artifact release, kept 90 days. Every
  action pinned by its commit; actionlint and zizmor (and zizmor's
  auditor persona) find nothing.
- The base's workflow, base.yml, comes with the published base; the
  workflow's header says where it goes.
- maintaining.md: CI's release workflow, its steps and its trust.

Tests: testdata/script/release_ci.txtar (signers only from
DEVVM_RELEASE_SIGNERS, an empty one, a tag signed by a key git trusts
but the list doesn't hold, not a release's tag, a lightweight tag, a
tag object of another tag, a commit off main, a folder that's there or
relative, the folder's exact files and their checksums, no key on stdin,
another role's key, the right key's signature and its trusted comment,
a second signature, a release-ci.pub marked PLACEHOLDER, a commit with
no release keys for --ci and --ci-sign), failing before the code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
w3cjandClaude Opus 5.5 f3052e5a8e feat(upgrade): releases checked by two of three release keys, bridged from the old key
devvm upgrade and install.sh accept a release's SHA256SUMS when any two
of three release keys signed it (CI's, the co-signer's and an offline
recovery key's), each in SHA256SUMS.<role>.minisig, checked only against
its own role's key, with the trusted comment devvm-release <version>
compared exactly; one signer counts once. While releases bridge from it,
the old release key's single SHA256SUMS.minisig (devvm <version>) still
passes alone, so 0.1 and 0.2 keep upgrading and --to/--version can
install them; install.sh now checks that key's trusted comment too.

The keys themselves aren't made yet, so packaging/keys holds none and
install.sh's three key lines are empty: a devvm built so checks each
release with the old release key alone, and a release that only the
release keys signed is refused. Releases go out as before, signed with
the old key, until the keys are made and added, all three at once.

- internal/minisign: the one owner of signature checks (moved from
  internal/upgrade): ParsePublicKey, PublicKey.Check (comment always
  compared), Role (CI, Cosign, Recovery), Kind (Release, Base),
  Kind.Comment, SigName, KeyFile, Keys/NewKeys/Keys.Check (two of three,
  distinct keys and key IDs). minisigntest/ signs for tests. Stdlib and
  blake2b only (depguard), a leaf; FuzzCheck, FuzzKeysCheck,
  FuzzParsePublicKey.
- The structure test's signatures rule: outside internal/minisign no
  code calls ed25519/rsa/ecdsa's Verify functions or imports blake2b,
  but signatureFree's files (ubuntu/pgp.go, proxy/nixcache.go).
- internal/upgrade: Source.Keys, checkSums (signatures.go); the bridge
  in legacy.go (checkLegacy, legacyKey, Source.Key); FuzzSumOf.
- packaging/keys/release-{ci,cosign,recovery}.pub, none yet;
  packaging.Key ("" without one). TestReleaseKeys (checkReleaseKeys:
  none, or three distinct minisign keys, none the old key),
  TestCheckReleaseKeys (fixture keys from minisigntest),
  TestInstallScriptKeys (checkInstallScriptKeys: one line per role,
  empty without keys), TestReleaseRefusesPlaceholders (no key in keys/
  marked PLACEHOLDER).
- scripts/release.sh (a tag, --check, --tag; never a snapshot) needs
  none or all three of packaging/keys' release keys. With none,
  install.sh's release_<role>_key lines are empty or missing; with all
  three, each is a minisign key, distinct, not the old release key, not
  marked PLACEHOLDER (placeholder), and equal to its install.sh line.
- install.sh checks with minisign -VHQm: prehashed signatures only.
- The structure guard also flags dot imports of the verifier packages
  and calls of x509's CheckSignature* method names.
- install.sh: release_<role>_key lines, download_signatures (a role's
  signature only when the script has its key), check_signature,
  signed_by_two, check_legacy; plainer warning without minisign, with
  the commands to check by hand.
- Tests: signatures_test.go (TestFetchWithoutReleaseKeys among them),
  upgrade.txtar (-legacy, -keys, and the keys built in, none),
  install.txtar (stub minisign with -Q; NO_KEYS), install_minisign.txtar
  (real minisign), release.txtar (none, nolines, nokeyline, old, marked
  and the rest); DEVVM_RELEASE_KEYS override.
- Docs: internals/install.md, using/upgrading.md, maintaining.md's
  Release keys, structure, tests, testing, SECURITY.md, CHANGELOG,
  releases/0.2.0.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 21:36:37 -07:00
w3cjandClaude Opus 5.5 d001f7be0f build(release): every release builds to the same bytes on any machine
The signing design's first phase. The same tag, built by two builders,
now gives byte-identical archives, source tarball, install.sh,
SHA256SUMS and formulas.

- scripts/release.sh builds every file but the signature in one
  container, release_image (Debian's buildpack-deps:trixie-scm, pinned
  by its index's digest), under podman or Docker
  (DEVVM_RELEASE_RUNTIME), on this machine's processor. The image and
  the code that runs in the build's container (_build) are the built
  commit's copies, so a tag builds the same from any checkout; a commit
  whose release.sh pins no release_image is refused. Everything outside
  the build's container is the checkout's: the tag's checks, the
  downloads, the modules' container, the checks on what the build
  wrote, and the signature.
- The build has no network (--network none). The Go modules come first,
  in a container of their own, the only one with the network, which
  runs only the checkout's code: its release_image, its release.sh
  _modules and the Go its mise.lock pins, given only the commit's go.mod
  and go.sum, read-only, and downloading from proxy.golang.org alone
  (GOVCS=*:off, GOWORK=off). The checkout's Go rather than the commit's,
  so a commit can't pick an old Go with a known flaw for the step with
  the network, and rather than refusing a commit whose Go is older than
  the checkout's, which would refuse every old tag once mise.lock moves
  on, though rebuilding old tags is what --tag is for; go.sum pins the
  module files, so the bytes don't depend on which Go downloaded them. A
  commit whose go.mod needs a newer Go than the checkout's is refused
  before anything runs. Every module path the commit's go.mod names is
  looked up on Google's proxy and checksum database, which the docs say.
  The build reads the modules read-only as a GOPROXY's files
  (file:///mod).
- Every container runs with --cap-drop ALL, --security-opt
  no-new-privileges, --pids-limit 8192, --memory 8g and --entrypoint
  bash, so a setuid file in the commit's image gives no privileges under
  a rootful runtime, root in it can't chown, a fork bomb or a runaway
  allocation stops at the container's limits, and the image's
  entrypoint never runs; Go and GoReleaser are unpacked with tar
  --no-same-owner. Both runtimes take both limits; rootless podman
  applies them on cgroups v2 with the pids and memory controllers
  delegated, as systemd does, and CI's runner needs the same. A full
  build peaked at 330 processes and 1.8 GiB under Docker Desktop on 10
  CPUs. Neither runtime can bound a bind mount's disk use, so the docs
  say that a running build can fill the temp folder's disk until the
  time limit.
- Each container is named for its run (devvm-release-<the temp folder's
  suffix>-<n>), so no other run's container, even one left over, has
  the name, and it's removed (rm -f, then its client ended, then rm -f
  again): after two hours (DEVVM_RELEASE_TIMEOUT seconds) by a
  watchdog, and as soon as release.sh stops early. The client runs in
  the background, so Ctrl+C (INT), a closed terminal (HUP) and kill
  (TERM) run release.sh's traps at once, which exit through the EXIT
  trap that removes the container; in the foreground, bash would wait
  for the client, and the client for the container's PID 1, bash, which
  ignores them. After kill -9, the watchdog, which outlives release.sh
  and ignores INT and HUP, removes the container and the temp folder.
- Go and GoReleaser are the built commit's mise.lock downloads for
  linux-arm64 or linux-x64, kept in ~/.cache/devvm-release by SHA-256
  and checked before each use, as is the modules' Go from the
  checkout's mise.lock. A URL has to start with
  https://dl.google.com/go/ or GoReleaser's releases/download/, can't
  hold .. or %, which curl decodes (so %2e%2e can't be ..), and goes to
  curl as --url's value (a lock URL of -K<file> was curl options, run
  on the host); file:// only from the folder that
  DEVVM_RELEASE_TEST_FILE_URLS names, which only the tests set, and
  only when it exists and isn't /. curl: HTTPS redirects only, 30 s to
  connect, 15 minutes, 1 GiB. A lock with two entries for a tool, or
  two downloads for the platform, is refused.
- The build's repository is new (git init --template=), holding only
  the commit and, for a tag, the tag, fetched into a pack: no other
  branches, tags or objects of the maintainer's, no hardlinked files
  the container could write, and origin set to devvm's GitHub URL,
  which GoReleaser needs and nothing fetches. Go stamps the binary
  from the tags it finds, so it finds only the release's.
- The container runs as root under a rootless runtime and as you under
  a rootful one, from the runtime's info (podman's
  Host.Security.Rootless, Docker's security options), never its name;
  a runtime that doesn't answer stops the build. Inside: umask 022,
  TZ=UTC, LC_ALL=C.UTF-8, GOTOOLCHAIN=local, -mod=readonly, no git
  config but safe.directory, and Go's caches in a container-local
  folder (Docker Desktop's share lost files that parallel module
  downloads renamed).
- The build writes its files to /out, a mount of its own that it can't
  swap for a link. Before anything is copied, signed or kept, the
  folder has to be the one release.sh made, not a link, and everything
  in it a file or a folder, never a link, yours, and neither setuid,
  setgid, sticky nor world-writable, and 2 GiB at most, counted as
  read (sparse files whole) and read no further. The files are then
  copied to dist/, never moved, as yours with mode 0755 or 0644.
  minisign signs outside, after the containers are gone.
- release.sh --commit COMMIT builds any commit as --head does, with its
  VERSION; release.sh --tag TAG builds a tag as its release, with its
  checks, unsigned, to compare with a published SHA256SUMS. An unsigned
  build never replaces a dist/ that holds SHA256SUMS.minisig, and a
  build signed with a test key never replaces one whose SHA256SUMS
  verifies with the checkout's packaging/minisign.pub, the release key.
- .goreleaser.yaml: builds_info and every file's info set owner and
  group root, mode 0755/0644 and the commit's time.
- scripts/repro-check.sh [COMMIT | TAG] builds twice with the
  checkout's release.sh, so no commit's code runs on the host directly.
  Build 2 fetches from a repository with a stray tag, v0.0.0-stray, at
  the commit, and runs under Docker where build 1 runs under podman when
  both are installed (root against your user); every platform
  archive's files have to be root's with mode 0755 or 0644 (tar -tv).
  A build that leaves no release fails, whatever its exit status. CI's
  repro job runs it under the runner's podman and Docker, with a
  45-minute limit. The docs say that building a commit runs its code,
  in a container only as isolated as the runtime keeps it, so an
  outside commit is built only with the maintainer's go-ahead, and that
  rebuilding an old tag needs proxy.golang.org to still serve its
  modules.
- scripts/bump.sh release-image moves the container's digest, the
  SHA-256 of the index it fetched, after checking the index lists
  linux/amd64 and linux/arm64; TestBumpCoversPins finds the pin.
- Tests: release_head.txtar, publish.txtar and the new
  repro_check.txtar run the scripts through podman and docker stubs
  and a mise.lock of file:// tarballs. New cases: -K, http://, another
  host, .. and a percent-encoded .. in a lock URL refused before curl
  runs, file:// refused without the switch, with it set to 1, to a
  folder that doesn't exist, to / and from another folder, curl's
  bounds, two go entries, the build's repository's tags, refs, objects,
  hardlinks and origin, a stray tag kept out, the image and build code
  taken from the commit, a commit with no release_image, each runtime's
  user (rootless and rootful podman and Docker, podman behind docker,
  no answer), both containers' run lines (security options, limits,
  entrypoint, --network none, mounts), each container's name its run's
  (the stub checks it against the run's temp folder), the modules'
  container getting only go.mod, go.sum, Go and the checkout's
  release.sh, in the checkout's image, with the checkout's Go, a go.mod
  newer than the checkout's Go refused before any container, and the
  build reading its modules; refused output: a link in it, the output
  folder swapped for a link, a mode 4755, 2755 or 0666 file, a mode
  1755 or 0777 folder, a sparse file a byte over 2 GiB (a file of
  another user's needs root to test, which the test says); a mode 0600
  file copied as 0644; a build past DEVVM_RELEASE_TIMEOUT removed by
  name; release.sh sent INT, HUP and TERM mid-build, ending within 10
  s through its trap, and kill -9, each leaving no container, process
  or temp folder; an unsigned --head and --tag refused over a signed
  dist/, and a test-key build over a release-key one; --commit never
  running the commit's host code, --tag's unsigned build matching the
  signed SHA256SUMS, and repro-check catching a build that records its
  user, archives that aren't root's, and a release.sh that builds
  nothing; bump.txtar covers the platform check. Each fails with its
  fix taken out, which was checked for every fix of the third review:
  the name, the limits, the test-key refusal, %, the folder's
  existence and /, the size cap, setgid, sticky, the signal traps, the
  EXIT trap's removal, the watchdog's removal after kill -9, the client
  in the background (in the foreground, INT took 60 s), the checkout's
  Go and the Go version check.

Proof, with a throwaway commit whose _build probes its container and
leaves a mode 4755 copy of bash and a mode 0666 file in /out, built by
this release.sh under Docker Desktop on an arm64 Mac, and under rootful
Docker and rootless podman on x86_64 Fedora: every build ran with
CapEff and CapBnd 0, NoNewPrivs 1 and no network, couldn't write /mod
or rename /out, and was refused before anything was kept; rootful
Docker refused its chown to root. The same image under the old run
line, on Fedora's rootful Docker: CapBnd a80425fb, NoNewPrivs 0, and
proxy.golang.org reachable.

Real builds of this commit, stopped 20 s into the build's container:
under Docker Desktop, INT, TERM and HUP ended release.sh within 3 s
(exit 130, 143, 129) with no container left at once, and kill -9 left
the container running for the watchdog, which had removed it and the
temp folder 5 s later. The same on Fedora under rootless podman (INT,
kill -9, TERM, HUP) and rootful Docker (INT, kill -9). Afterwards no
devvm-release container or temp folder was left on either machine.

repro-check on this commit, a prerelease (no devvm.rb), agreed on all
eight files on the Mac (Docker Desktop, both builds) and on Fedora
(rootless podman as root, then rootful Docker as cj), and the two
machines' printouts were the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 23:41:10 -07:00
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 3c7fbad7a3 feat(tools): mise downloaded as its .tar.gz, on the host and in base
mise's raw binary is 147 to 192 MB, its .tar.gz 51 to 63 MB. Both of a
first run's mise downloads now take the archive:

- the host's mise (internal/tools): the .tar.gz checked against its
  pinned SHA-256 by fetch.Download as before, into a folder of its own,
  then hashed again through the descriptor that mise/bin/mise is taken
  out of with archive/tar and compress/gzip, capped at miseCap. One
  devvm downloads it at a time (Dirs.MiseDownloadLock,
  cache/mise/download.lock, mise_waiting), and another takes what it
  kept. Under the lock, a .download-* folder a killed run left is taken
  away first (TestHostMise). A failure says its cause
  (mise_download_failed's Because) in the run log too.
- base's mise (layers/base.sh): devvm-fetch's .tar.gz, unpacked with tar
  in a folder of mktemp's, which every base has (gzip is Essential on
  Debian and Ubuntu, BusyBox has it): .tar.xz would need xz, which
  --from images may lack.

The pins are the archives' SHA-256s from the release's SHASUMS256.txt,
and scripts/bump.sh reads the .tar.gz lines. TestMisePins still checks
that base.sh's Linux pins are the host's.

Docs: images.md's Versions and overview.md's locks; the release page's
A faster first run; the CHANGELOG's Highlights, a first run that
downloads less with the cloud image's two lines, now highlights too.

Base's key changes (base.sh). Tool images' keys don't: they hash base's
mise version, not its checksum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 22:53:34 -07:00
w3cjandClaude Opus 5.5 a8f0517579 feat(lima): devvm downloads Ubuntu's cloud image itself
Lima's download of the cloud image neither retries nor times out: one cut
in its 900 MB fails base's build, and a stall hangs it. devvm now
downloads the pinned image itself through fetch.Resumable
(ubuntu.Download), into images/ubuntu/<sha256>.img (Dirs.UbuntuImage),
resuming across cuts, stalls and runs, and gives Lima that file. Lima
2.3 checks a local file against the digest before it copies it.

- Before downloading, it takes the image from Lima's own download cache
  when that holds it with the pin's SHA-256: copied into a new file of
  devvm's own, mode 600, hashed as it's written, capped, stopped by the
  context, and kept only once it checks out. Lima's cache is never
  changed, and a base whose dated release Ubuntu may have removed still
  builds again.
- One devvm downloads at a time (images/locks/ubuntu-image), another
  waiting under ubuntu_image_waiting and looking again under the lock
  (TestUbuntuImageAfterWait, which fails without that second look).
- The download goes through the company proxy and trusts the user's CAs
  (Lima.Roots, from trust.Pool, which internal/cli passes through the
  registry), as do the Finder's lookups (TestNewTrustsRoots, and the
  registry's TestOverrides). An untrusted certificate is
  ubuntu_untrusted, naming the CAs' folder, one from a trusted CA
  that's for another host, out of date or not valid yet
  ubuntu_bad_certificate (check the clock and what answers for the
  host), and any other that fails to verify (a SHA-1 signature, a CA's
  name constraints, a key for clients alone) ubuntu_certificate_invalid,
  naming Go's reason, for the lookups (the listing, the checksums, their
  signature: TestLookupCertificates) and the download alike
  (TestLocalImageFailsFor), and a release Ubuntu removed (404, 410)
  ubuntu_release_gone, which names devvm rebuild base; none is retried.
  ubuntu_download_failed no longer starts with devvm.
- fetch.Untrusted, fetch.BadCertificate (an x509.HostnameError, or a
  CertificateInvalidError that's Expired) and fetch.Unverified (any
  failure to verify, with its reason, so every error the other two
  name), beside fetch.Gone, are the one
  place that tells a certificate's failures apart: Transient asks
  Unverified, the lookups and the download ask all three, host mise
  asks Untrusted, and a forbidigo rule keeps x509's and tls's
  verification errors in internal/fetch (TestCertificateClasses,
  TestTransient, testdata/lint, the owners doc's row).
- An https address, or a test build's file:// DEVVM_UBUNTU_URL, read
  from disk the same way; anything else is refused. The CLI tests'
  sandbox has a stand-in of this host's image in the store.
- Base's record keeps the image's address, and the key is as it was: it
  hashes the pin (release, file, digest), not the location.
- devvm gc --caches frees devvm's copies that no record names and that
  aren't pinned now, unchanged for an hour, a stopped .part and a killed
  import's .import included, and those of a kept image once its .img is
  there. A pin it can't read fails it.
- Of Lima's cache, it frees only an entry that devvm's own state shows a
  build of devvm's left: a base record names its address, devvm has its
  own copy of the image, and the installed Lima's own templates
  (share/lima/templates beside limactl, Lima.Templates) don't name it.
  An entry no record names may be the user's own Lima's, so it stays,
  and none is freed when the templates can't be read, with a line in
  the run log naming the folder and why. A test build's
  DEVVM_LIMA_TEMPLATES stands in for the templates folder.
- ubuntu.ParseImage reads a record's image as Image.String writes it,
  and ubuntu.IsSHA256 is the one check of a cloud image's SHA-256, in
  place of Lima's own regex.
- devvm space shows the copies as a cloud images row, freed by gc
  --caches, kept as state, as a release Ubuntu removed can't be
  downloaded again.

0.1.0's frozen state runs the new commands (fixture_v010_cloud_image):
devvm looks in Lima's cache under the SHA-256 of the address 0.1.0's
base record keeps and never changes the entry, base builds from devvm's
own copy, and gc --caches keeps that copy, frees Lima's entry the
record names and devvm's own stale copies, and keeps an older entry no
record names.

Docs: images.md (the download, its failures, the import, gc's rules),
space.md, backends/lima.md, settings.md (the lookups and the download
trust your CAs), troubleshooting.md, overview.md, testing.md,
tests.md, structure.md's internal/fetch row; the CHANGELOG's two Fixed
lines, which later commits make highlights, What to do 5 and 6, and the
release page's Ubuntu's cloud image in devvm's folder.

New messages: downloading_ubuntu, importing_ubuntu, ubuntu_image_waiting,
ubuntu_download_failed, ubuntu_release_gone, ubuntu_bad_certificate,
ubuntu_certificate_invalid, ubuntu_image_checksum, ubuntu_untrusted.
Lima.LocalImage is the seam, Lima.ImageClient the client.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-29 22:53:34 -07:00
w3cjandClaude Opus 5.5 e4b44b5994 fix(lima): limactl shell never starts a stopped VM past devvm's checks
In a terminal, limactl shell of a stopped VM asks whether to start it, yes by default (Lima 2.3.0, reproduced under a pty), and that start is Lima's own: no proxy or sandbox-exec profile (no QEMU wrapper on Linux), no pins, and no folderChanged, so the project folder's mount, by path on Linux's 9p, follows a link put at the path or makes a folder that's gone again. devvm opens a shell (Shell) and runs an agent's login (Exec) on the terminal after bringUp, so a guest that powered itself off between the two got that question. This is the start path the self-check's restart was suspected of: that restart goes through startOnce, but limactl shell didn't.

The limactl builder, which every limactl command of devvm's goes through, now gives limactl shell --start=false, which Lima has had since 2.0.0-rc.0 (devvm's oldest is 2.2): a stopped VM's shell or command fails at once ("instance is stopped"), without asking, and devvm's next launch starts it with every check. devvm limactl, which passes its arguments on as given, is unchanged.

TestShellNeverStarts checks Exec's, Shell's and the builder's limactl shell, and fails without the change; the lima package's and the CLI scripts' expected limactl shell calls name the flag, their negative patterns too, so none turns vacuous. Docs: How it works' Lima page's A stopped VM's shell; the changelog's Security hardening gets the line, its summary widened to cover both of its lines, and the release page its section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 07:43:53 -07:00
w3cjandClaude Opus 5.5 80923fc580 test(vm): a gone folder's VM restarted by its self-check is refused before its start
devvm rm VM, for a VM whose project folder is gone, goes on with the VM as it runs for its export, or with --no-export for the check of the agents' worktrees, and the network self-check of a confined VM started outside devvm offers to restart it confined. A yes stops the VM, and the restart goes through startOnce, which checks folderChanged before the backend's Start: the start is refused (project_folder_changed), the VM is kept, stopped, and its folder, which Lima would make again for its mount, isn't made. startOnce holds the only backend Start in internal/vm, so every start devvm makes (a launch, devvm restart, an export, rm's checks, a remake, the self-check's restart) is checked the same way.

rm_gone_unenforced.txtar drives both rm paths with a yes to the restart: no limactl start, no export or worktree read, the VM kept, and once stopped refused as ever (rm_gone_stopped, rm_gone_stopped_trees) until the flags that skip what needs it running. The stub's limactl start makes no folder, so no limactl start is what shows the folder isn't made again. With startOnce's check before the backend's Start removed, it fails: the backend starts the VM, and only the check after the start stops it (project_folder_changed_stopped).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 07:43:46 -07:00
w3cjandClaude Opus 5.5 376f1c2ad7 fix(agents): opencode's save, plugin approvals and the history scripts' framing
devvm agent save refused a VM whose ~/.config/opencode held a bun.lock (which opencode's plugins' installs write), a package-lock.json, a .gitignore or a .DS_Store: the save's script sent every entry of that folder but node_modules and FolderOwn, while the host's listedPath refuses those files (fileSetting), so it saved nothing. notSettings is now their one list, as patterns path.Match and the shell's case read alike: fileSetting leaves them out and the script sends a file of those names no more, only a folder that isn't a link, which is a setting. TestAgentSaveScriptRuns plants them and a folder named old.lock, and failed with agent_save_unsafe before the fix.

opencode's HistoryOwn names its native client's plugin approvals, in its state folder (cli-rs's plugin/src/loader/approval.rs and tui/src/plugins/host.rs, opencode v2.4.1): plugin-approvals.json, its .lock and the .plugin-approvals.json.<pid>.<n>.tmp it's written through, and plugin-staged, the approved trees' copies, which it reuses by their hash's name without hashing them again, so a hostile VM's export could approve a project plugin for the VM that imports it. That client doesn't ship in 2.4.1. TestHistoryExportRuns and TestHistoryImportRuns plant them, with plugin-notes.json as the control, and failed on fedora without the entries.

The history scripts' framing (onInputCmd) now says why on its stderr, which goes to the VM's log, when its input was cut short: TestOnInputCutShort checks it for every cut, an empty input included, and none for a whole one, and failed before. TestHistoryScriptsOnInput holds each script under 128 KiB, Linux's limit on one argument, which bash -c "$s" passes it as. The CLI scripts match the framing's new start.

Docs: the save's and the store's table say which files stay in the VM; the import's and How it works' lists name the plugin approvals; the release page gets opencode's lock files in a save and the approvals; the changelog's opencode block gets the save's fix, and the hardening line names approved plugins. The review's optional wording: the design note's `*` matches every resource, and the plain-password steps set this machine's password first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-25 00:03:05 -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 962c183117 fix(agents): imported opencode history brings no automations, approvals or resumed turns
An export of opencode's history held what opencode 2.4 acts on without asking, so a hostile VM's export could run commands in the VM that imports it (opencode v2.4.1's source): its automations (automation), each a trigger and a shell command that it approved once and never asks about again (core/src/automation/shell.ts); the requests you said always to allow (permission, which Permission.evaluate turns into allow rules); each session's own rules (session_v2.permission, a Permission.Ruleset); the subagents' jobs (job), the queued messages (session_inbox) and the suspended sessions (session_v2.time_suspended), which its service starts or resumes when it starts (core/src/session/execution/restart.ts), with the session's agent's own rules, explore's allowing shell; a project's commands (project.commands), whose start command it runs with bash -lc for each worktree (core/src/worktree.ts); and its git repositories in its data folder (snapshot, repos, worktree), whose config can name a clean filter or core.fsmonitor that its own git update-index runs (core/src/snapshot.ts, git.ts).

opencodeClean now empties the tables opencodeUnattended picks (automation, permission, job, session_inbox, and any whose name starts so), sets the columns opencodeNulled picks to NULL (time_suspended, commands, in any case), keeps only the deny and ask rules with a text action of every permission column, each written again from what sqlite3 read, so a key written twice can't keep an allow effect for JSON.parse (opencodeAllowRules), drops every view, and fails its check on a generated column (opencodeHidden). Its check counts each and must print 0, so a sqlite3 without JSON leaves the database out. A view, an upper-case column, a generated column and a duplicate key bypassed the first version, as the security review showed.

opencode's HistoryOwn now names its background service's registration on every channel and the files written beside it (service-*.json, service.json.*, service-*.json.*) and its git repositories (snapshot, repos, worktree): an export leaves them out and an import never writes them, while a VM made again keeps them. The import's clean-up loop expands each as a pattern; TestHistoryImportScript holds every skip to a path's plain characters.

Tests that failed first (fedora's gate): TestOpencodeCleanSchema (automation and permission emptied, a session's allow rule gone), TestHistoryImportRuns and TestHistoryExportRuns (service-local.json, the handoff's and the registration's temporary files); TestOpencodeCleanSessionRules fails closed without the statements. The review's additions: TestOpencodeCleanSchema (job, session_inbox, a suspended session, a project's commands), TestOpencodeCleanSessionRules (a key written twice, a non-text action, an upper-case column), TestOpencodeCleanHidden (a view, a generated column), and the git folders in the export and import tests.

The review's docs fixes across the stack land here too: the changelog's What to do steps, the release page, the coding agents page, How it works and the design note.

A kept rule whose resource is missing or isn't text gets "*", as opencode's Permission.Rule needs one, and the check also counts a rule that isn't in the rebuilt form, so a copy whose rules weren't rebuilt fails closed. A stack-wide review's last docs fixes land here: devvm rm deletes opencode's worktrees with the VM, so the changelog has a What to do step to commit their work first.

The export's and the import's scripts, which the stack doubled, now go on the VM's input (onInput): a line with the script's length, the script, then the import's export. In the command's arguments, quoted for ssh's shared connection, macOS's ssh failed to start the session (mm_send_fd: sendmsg: Message too long), which the mini's e2e hit, the export first and then the import. The VM reads exactly that many bytes (dd bs=1) and runs the script only when it read them all, so an input cut short runs nothing (TestOnInputCutShort), and the script gets the rest as its input. TestHistoryScriptsOnInput holds every argument under 4 KiB; TestHistoryExportRuns and the import's runs use onInput too. The stub guest takes such a script off its input (inputScript), matches its switches and files() against it and keeps an export's and an import's in history-export.sh and history-import.sh, which history, history_import, rm_vm, existing_agents and layer_add read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 17:17:55 -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 8e04b1c86d fix(scripts): bump.sh moves a Go tool's pseudo-version from the module proxy
mise latest prints nothing for go:go.uber.org/nilaway/cmd/nilaway, which
has no releases and is pinned to a pseudo-version, and exits 0, so
bump.sh --check reported "nilaway: X -> (change)" and the run listed it in
its summary without moving it.

dev-tools now reads a go: tool pinned to a pseudo-version from the Go
module proxy's @latest, for the longest prefix of its package's path that
the proxy has as a module (go.uber.org/nilaway). Only the proxy's 404 or
410 moves on to a shorter prefix; any other failure is an error, so a
failed request never takes another module's version. An empty newest
version, from the proxy or from mise latest, stops the run with an error,
never a change, before anything is edited. A pseudo-version has no
"newest within" for a hold to fall back on. proxy_url is the proxy's
escaped path, which mod_versions now shares.

bump.txtar's mise stub prints nothing for nilaway, as mise does, and its
curl stub answers the proxy's @latest with -w's status; it checks the
bump, the errors for an empty @latest, for no module at any prefix, for a
503 at a longer prefix and for an empty mise latest, each with mise.toml
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-24 12:57:34 -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 cb7177b32c feat(ui): waits for another devvm's lock show a status line; a project folder devvm can't read says so
Lock waits:
- platform.LockFile and LockFileShared take a platform.Waiting, called
  once they find the lock held, never when it's free, whose end they call
  once the wait ends; LockFileWaiting, LockFileSharedWaiting and their
  delays (ShareNote, OCINote, WaitNote, groupsNote, makingNote) go.
- msg.Waiting makes one from a Reporter's Status and a label;
  msg.WithStatus and msg.StatusOf carry the run's Status in its context
  for the two packages that take no Reporter, internal/state and
  internal/trust, which cli's execute sets; forbidigo keeps StatusOf to
  them, and AGENTS.md says so.
- Every lock that waits shows its own label: vm_state_waiting (a VM's
  state, its deletion), claims_waiting, layout_waiting, git_lock_waiting,
  ca_waiting, packages_waiting, rebuilds_waiting, ubuntu_pin_waiting,
  custom_secrets_waiting, forwarder_waiting, agent_store_waiting, and the
  waits that printed a line after a delay, which now show theirs as a
  status line: share_waiting, oci_waiting, image_build_waiting,
  group_waiting, making_waiting.
- An agent's login file's lock (agentlogin's lockLogin, a folder's flock
  that a VM's proxy holds while it refreshes the login) tries first
  without waiting and shows agentlogin.File's Waiting
  (agent_login_waiting) while it waits; secrets fills it from its
  Reporter, for SaveLogins, Claude Code's logins folder and every File.
- The structure test's status-lines rule counts a LockFile or
  LockFileShared whose waiting is nil as slow work; the build port's
  record, a file just made that never waits, is listed in statusSites.
- Without a terminal, or with -v, a status line draws nothing, so the
  waits that printed an info line after a delay no longer print it there;
  the CHANGELOG and the troubleshooting page say so. from.txtar's check
  that a free conversion lock printed no wait goes, as TestLockOCI checks
  it.

The layout's migration runs under a status line (layout_migrating),
only when there are migrations to run.

Backend calls outside a launch: TestCommandStatusLines runs devvm ls,
ports, size, network, tools, git-protect, history export, stop and rm on
a running and a stopped VM and fails on a backend call with no status
line showing, with a control that each makes one.

A project folder devvm can't open and read (vm_folder_unreadable) was
taken for another folder's VM (vm_other_folder, which offers rm and
adopt, and adopt went on); the finder now keeps why (target.unread), and
every command on the folder's VM, from the folder or a subfolder of it,
names the folder and why; devvm rm VM run elsewhere goes by the VM's
name as before.

platform.UniqueFolderID had no caller but its test: FolderStat.Unique,
from the open folder, replaced it; it goes, and its test checks
StatFolder's Unique instead.

Tests: TestLockFileWaiting (rewritten: called only when held, its end
once got or given up, shared too), TestVMLockWaits, TestCheckLayoutWaits,
TestCheckLayout (migrations under layout_migrating, nothing shown
otherwise), TestLockGroups, TestLockShare, TestMaking, TestLockOCI and
the build lock's test (status lines, not info lines), TestLockLogin,
TestInitCACancelled (ca_waiting), the status-lines rule's lock cases,
TestCommandStatusLines, TestUnreadableFolder (a subfolder of it too),
TestStatFolderUnique.

Docs: Contributing's CLI page (Status lines) and structure page, the cli
and codebase-standards skills (the guards), AGENTS.md's Go conventions,
internals/images.md and design.md (the waits), using/troubleshooting.md,
using/vms.md (a folder devvm can't read); CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 15:10:22 -07:00
w3cjandClaude Opus 5.5 da872a6550 fix(vm): a renumbered folder's volume is checked until it's read; folder identity is read once
When a boot numbered a project folder's disk anew and its volume couldn't
be read at that launch (diskutil failing or slow), recordFolder recorded
the new device with the old volume, and from then on the identity
matched byte for byte, so no launch compared the volume again: a copy of
the disk with a volume ID of its own, mounted at the folder's path
later, would have kept the VM. It now records the folder unchecked
(state.VM.SetFolderUnchecked, vm.json's folder_unchecked), so each
launch looks the volume up again; Env.keepsVolume compares it while the
record is unchecked, as for a renumbered one, refusing another volume
(vm_other_folder), and the first lookup that finds the recorded volume
clears the mark (folderRecord). A move matches an unchecked record only
on its volume (here.same), and a move whose lookup fails keeps the
recorded volume, bound to the inode and birth time a move keeps,
unchecked (recordMove). On Linux, where the volume is read in the
process (volumeFree), every launch compares it, so a Btrfs snapshot or
a ZFS clone mounted at the folder's path is another folder even on the
original's device; after a volume's UUID changes, devvm adopt gives the
folder its VM again.

The finder's sameFolder and madeFor share one body (madeForOpen), and
the folder is opened once: platform.SameOpenFolder is SameFolder for a
folder StatFolder already read, platform.RecordedAs is its exact match,
and keepsVolume, recordFolder and here.same take that read rather than
open the folder again (here's id and unique are its stat's). madeFor,
which the checks that ask which VM mounts a folder use, falls back to
the folder's stat when it can't be opened, as when code in a VM that
mounts it took away its read permission, so no VM hides from
clone_repo_mounted or project_in_vm_folder that way. recordFolder
compares again under the state's lock with the same folderRecord.

The structure test's folder-ids rule now finds a map literal keyed by a
folder's identity whose type is a named map type of the module's, a
generic one included, or elided in a map's or a slice's literal whose
elements are maps.

Docs: a Btrfs rollback at the folder's path, or a volume's new UUID,
needs devvm adopt; a Mac volume that ignores ownership makes every
folder yours to the offer's check; the unchecked mark and Linux's check
at every launch (internals, overview's vm.json fields).

Tests: TestUncheckedOnAnotherVolume, TestKeepsVolume, TestRecordFolder
(unchecked, then checked), TestRecordFolderUnderLock,
TestRecordMoveVolume, TestMovedFrom (unchecked), TestMountedByUnreadableParent,
TestSameFolder (SameOpenFolder, RecordedAs), folder-ids' named, generic
and elided map cases, and fixture_v010_renumbered's unchecked steps on
0.1.0's state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 09:37:13 -07:00
w3cjandClaude Opus 5.5 bb0df957a0 fix(doctor): a broken VM state hides no other VM's warnings; Cursor's account services refuse more changing verbs
doctor's policy warnings (netpolicy.NotRules) listed the VMs with
state.VMNames, which fails whole for one state it can't read, so one
broken vm.json made doctor skip every VM's policy warnings. So did
devvm network's warnings about every VM (allowlists for -g, and
OtherBinaries). They now use state.ReadableVMs, the VMs whose state
reads, which leaves the broken one out and the rest in; VMNames stays
strict for what must count every VM, such as ports. A VM folder doctor
can't read got two warnings, vms_unreadable from state.VMFolderProblems
and vm_state_broken from vm.StateProblems; VMFolderProblems now leaves
it to the latter, which names the VM and why.

cursorChanges, the verbs refused in Cursor's DashboardService,
AutomationsService and BackgroundComposerService, gains merge, fork,
write, pin, unpin, rerun, confirm, request, release, acquire, activate,
deactivate, notify, make, open, ensure, park, copy, bulk, advance,
abort, wake, snapshot, seed, reply, opt, hand, fail, use, skip, decide,
unshare, undelete, unpublish, unprepare, unresolve, enroll, unenroll,
upgrade, suspend, switch, duplicate, dismiss, deregister, deliver,
decline, convert, close, append, execute, provision, mutate, inject,
finish, finalize, reassign, reinstall, reject, renew, reorder, reparent,
replace, resend, rmdir, report and record. Each was checked against all
1,463 methods of those services in 2026.11.17-f532c45, read and not
run: every one of the 102 methods they match changes something, none
only reads, and the CLI calls none (Submit, Resolve, Check, Batch and
the like stay off, as their methods read or the CLI calls them).

fixture_v010_logs' capped.sh loop and network.txtar's sleeps around the
squatting proxy now wait with wait_until.

Tests: TestNotRules and TestOtherBinaries (beside a state that can't be
read), TestVMFolderProblems, doctor.txtar (an unreadable VM folder, one
warning), TestCursorChangingVerbs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-19 07:45:34 -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 ecd266c7d3 test(cli): one wait for the scripts; the docs release job installs only what it builds with
The scripts waited with copies of the same loop: desktop.txtar's and
nix_cache.txtar's waitfor files, and sh -c loops in link_life,
fixture_v010_links, fixture_v010_small, ports and ports_stopped, each
with its own interval and limit. They now use one testscript command,
wait_until SCRIPT, which runs sh -c SCRIPT every 100 ms until it
succeeds, for up to 90 s, and fails at once when every background
command has ended, as wait_file does, or when SCRIPT exits 100
(waitGiveUp, a status no tool the scripts run gives), as the links
check does when its session has ended. Contributing's tests page names
it beside wait_file, whose limit it now says is 60 s.

The docs workflow's release job installed every tool in the tag's
mise.toml. It now installs only Go, Hugo by the name the tag gives it
(hugo-extended before Hugo 0.170) and Node when the tag draws its
diagrams, with --locked as mise-action did, picking them with mise's
own reading of the tag's mise.toml (mise ls --current --json, the tag's
file alone), and fails when the tag names no Hugo. MISE_AUTO_INSTALL is
off for the job, so mise run docs:diagrams and the shims install
nothing more, and a tool the pick missed fails the build. This job runs
only at a release, so it hasn't run yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00
w3cjandClaude Opus 5.5 5924a373f0 feat(doctor): devvm doctor checks every VM's state
doctor read no VM's state, so a vm.json that devvm can't read, or one
with a section its package can't read, showed only when a command on
that VM failed. doctor now reads every VM's state (ReadStates) and runs
the check every command makes of the VM it finds for a folder on it
(checkState, every section's reader), and warns of each VM it can't
read, naming it, or its folder when the file can't be read, and why,
which names the file (vm_state_broken). It only reads, and --json lists
the warnings with the rest.

The task also named "the files vm.json names that devvm reads at
launch". None in a VM's folder stops a launch from older state: its
own policy file is read by the proxy, which keeps its last rules, and
doctor already checks its lines; home.tar.gz is read only while a
remake hasn't finished; run/ is written again at each start. So only
vm.json and its sections are checked. A value that reads but that a
launch refuses, such as a size that isn't a number, isn't checked, and
the docs say so.

Tests: doctor.txtar (a vm.json that isn't JSON, a section that doesn't
read, and one that's fine), fixture_v010.txtar (every 0.1.0 VM reads,
and no file changes), fixture_v010_housekeeping.txtar.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00
w3cjandClaude Opus 5.5 b5f3899f1a test(vm): smaller 0.1.0 cases
fixture_v010_small.txtar runs what changed since 0.1.0 on its frozen
state, in smaller cases:

- devvm ports on 0.1.0's records of app's port forwarder (its pid and
  status, no list of what it forwarded) says nothing is held, taken,
  past the limit or refused.
- A proxy port 0.1.0 chose on one of the ports only VMs' ssh may have
  (its proxy port moved onto the sandbox's first ssh port) moves at
  app's next start, off the list, and the proxy's config listens there.
- On Linux, that start gives the guest's connections to the proxy the
  capped devvm _qemu connect, to that port, with app's own
  run/proxy.slots, where a 0.1.0 start had the two-argument form. The
  limactl stub now records the start's DEVVM_GUESTFWD
  ($STUB_DIR/start-guestfwd-<name>, empty when unset), as it records
  the start's agent, with its unit test, and the structure test's
  envSettings lists the stub as a reader of DEVVM_GUESTFWD.
- app, stopped, holds none of its listed ports: scratch lists 3000 too
  and forwards it, and app, started again, says scratch has it
  (ports_held, held_by in devvm ports --json) and that a program here
  has another port it lists (ports_taken), never the limit or a
  refusal. While it runs, devvm ports names each reason its
  forwarder's record gives (ports_taken, ports_limit, ports_refused,
  each its own port), and none for an older devvm's three-line record
  (reasons.sh judges only a run on the record as it wrote it, trying
  again when app's forwarder, waiting on scratch's port, replaced it).
- #52's leftover, a state as 0.1.0 wrote it for a folder named x--y
  before Lima refused the name (built from app's 0.1.0 state: its name
  and alias with the run of separators, the folder's path, no created
  time or start), is read as no VM and replaced by the folder's VM.
- After a boot that numbered the disks anew and a move of app's folder,
  devvm adopt VM moves app to the new path, and its launch starts it
  there.

Found, not changed: a moved folder on a renumbered device isn't taken
as the VM's folder (platform.SameFolder matches another device only at
the recorded path, as a copy keeping the inode and birth time sits
elsewhere), so devvm there, without adopt, makes a second VM for the
moved folder, saying nothing of the first, whose folder is gone; devvm
adopt VM is the way back, as the docs say.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 20:06:44 -07:00
w3cjandClaude Opus 5.5 7800be5ed5 test(vm): host keys and log caps on 0.1.0 state
fixture_v010_logs.txtar gives 0.1.0's app VM's Lima folder a serial
console's log (serialv.log) and a hostagent's error log (ha.stderr.log)
of 11 MiB each, holding the proxy's password from 0.1.0's proxy config
(which today's devvm keeps, as vm.json's proxy key) near their start
and at their end, as a boot logs it, checked there before the launch.
After a launch, each is at most 10 MiB with a .1 beside it holding the
log, and neither holds the password: the log keeper looks first in the
proxy's broker, before limactl start, so it copies 0.1.0's unredacted
log into the .1, whose redaction this checks. (Real Lima starts each
log afresh at every start, which the stub doesn't.) The launch pins
the new start's host keys in place of 0.1.0's: known_hosts' start line
is no longer 0.1.0's, a key line is pinned, and 0.1.0's key line is
gone. Nothing found to fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:59:14 -07:00
w3cjandClaude Opus 5.5 58c7d87fe8 test(vm): links and the resolver on 0.1.0 state
fixture_v010_links.txtar starts 0.1.0's db VM, then its app VM, which
links to db's published 5432 as db.devvm.internal at 127.77.0.1: app's
launch says nothing of a stopped target, its link session starts and
carries 127.77.0.1:5432, and run/links.json is written again from
0.1.0's link with the same hosts, address, port and target and the
sandbox's own socket, which exists. The setup app gets
(sync.tar's vm) names the confined VM's resolver,
DEVVM_RESOLVER='127.0.0.1', and the paste folder, which 0.1.0's setup
didn't have, and its hosts file names db.devvm.internal. Nothing found
to fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:59:14 -07:00
w3cjandClaude Opus 5.5 bc00ebc088 test(vm): housekeeping never deletes 0.1.0 state
fixture_v010_housekeeping.txtar runs today's housekeeping on 0.1.0's
frozen state: a launch whose daily retention is due (0.1.0's
retention.run made older than a day, and touched by the launch), then
devvm gc --force, devvm gc --orphans --tool-images --retention --force,
devvm space --json and devvm doctor. Every VM's vm.json and run folder
stays, every shared tool image a state's tools.made.files names stays
(the list read from the states before anything runs), no limactl
delete names a project VM, devvm ls, devvm space and Lima still list
all four, and nothing says unreadable or corrupt. A copy of a tool
image under a name no state has goes, the control that gc could delete
one. On Linux, 0.1.0's VMs' disks are modelled as it made them, qcow2
overlays of the image's disk (the fixture keeps no disks; the stub's
qemu-img info reads the backing file), and gc keeps 0.1.0's base image
with image_in_use; on macOS it deletes it, an older base than today's.
Nothing found to fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:59:14 -07:00
w3cjandClaude Opus 5.5 93322e9154 fix(vm): running 0.1.0 VMs are warned of and tested
A VM that devvm 0.1.0 started and that runs as you upgrade keeps what
0.1.0 gave it until its next start. Two of those went unsaid:

- A launch into a running VM whose start forwarded an SSH agent itself
  (an older devvm's recorded start, without made.relayed) keeps that
  agent, which can add, remove or lock keys, and now warns, naming
  devvm restart, which gives it the relay (agent_raw_old).
- devvm doctor said nothing of a running proxy without
  run/proxy.confined. One that another devvm binary started (its
  config's devvm_sha256) is an older devvm's single process without a
  sandbox, which it now names (proxy_old); one this binary started that
  hasn't written the file yet is still starting and gets none. doctor
  now passes devvm's own binary to the check.

Tests, on 0.1.0's frozen state made running in the sandbox copy
(hostagent pid file at 0.1.0's start's time from its known_hosts, run/
started, known_hosts and agent.made.started for that start, Lima
listing it running, its ssh port listened on, and 0.1.0's one-process
proxy): fixture_v010_running.txtar (doctor's proxy_old; a launch with
no stop, start or edit, ports_ssh_old, the proxy started again as
broker and child with proxy.confined, secrets.json and known_hosts
unchanged, no relayed; then stop and launch: one .ssh.localPort edit,
the new start's keys pinned) and fixture_v010_running_agent.txtar
(devvm's agent forwarded raw: kept and warned, then devvm restart gives
the relay and relayed, with only the ssh port's edit). The modelled
hostagent is a live process of the test's, not 0.1.0's pid 54798,
because a start counts as devvm's only while its hostagent runs.
TestUnconfined: a proxy that hasn't said, by this binary, another, or
an unreadable config.

- msg: agent_raw_old, proxy_old.
- Docs: ssh (agent forwarding), troubleshooting (the proxy runs without
  a sandbox), internals/install; CHANGELOG After you upgrade.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:59:14 -07:00
w3cjandClaude Opus 5.5 7cc0dd76ed fix(agents): a 0.1.0 store's plugin data stays out of the seed
devvm 0.1.0's agent import copied the whole of ~/.claude/plugins into
the agent store, each plugin's data and installed_plugins.json
included, and every VM with Claude Code mounts the store's plugins
folder whole as its seed, so that data kept reaching every VM until
agent import ran again. Every start (starter.bringUp) now takes out of
each seed's folder in the store the entries a seed doesn't have
(agents.MachineOwn), before the VM runs, and warns once, naming them
(agent_seed_cleaned). The folder itself stays, so no VM's mounts or
Lima config change. A running VM stops seeing them through its mount
at once on macOS; on Linux, 9p's cache can keep what it read until its
next start.

The folder is reached from devvm's config folder as a root, each part
of the path below it a folder: a link there (only a hand-made store
has one, and the VM's mount would follow it, perhaps to the user's own
~/.claude/plugins) is refused (agent_seed_link), a link among the entries is removed,
never followed, and the opened folder is checked to be the one
checked. The temporary files a concurrent agent import or save writes
known_marketplaces.json through, regular files, stay. A folder that can't be cleaned
fails the start of a VM with that agent and warns for any other
(agent_seed_clean_failed, naming what the folder should hold).

- vm: Env.cleanSeeds, cleanSeed and seedTemp (agents.go), called
  first in bringUp with the VM's agents.
- msg: agent_seed_cleaned, agent_seed_clean_failed, agent_seed_link.
- Tests: TestCleanSeeds (0.1.0-style store, a link entry, a concurrent
  import's temporary file, no store, once only), TestCleanSeedsFails
  (a link at the store, .claude or plugins, for a VM with and without
  Claude Code; an entry that can't go); fixture_v010_plugins.txtar
  (0.1.0's app with the store's plugins as 0.1.0's import left them and
  their mount: the warning, no edit but the ssh port's, the seed's link
  to a folder without data/, nothing said again; then the store's
  plugins folder a link, and an entry that can't go, each refusing
  app's start with agent_seed_link or agent_seed_clean_failed).
- Docs: coding-agents, internals/agents, the design note's threat
  check; CHANGELOG Breaking, After you upgrade (running VMs, Linux's
  cache, plugin logins) and #56's Fixed entry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 19:59:14 -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 ea3037bc15 fix(vm): MCP servers' logins in a VM finish and survive launches (#62)
Each launch and each devvm agent login claude copied the store's VM copy
of Claude Code's OAuth login (claudeAiOauth only) over the VM's
~/.claude/.credentials.json, where Claude Code also keeps its logins to
MCP servers (mcpOAuth: their tokens and, mid-login, the PKCE verifier).
So an MCP login failed when the VM was set up again before it finished,
and a finished one was gone at the next launch.

The setup now gets the copy as claude-credentials.json (claudeSyncName),
and sync.sh's merge_claude_credentials merges it in the VM: the copy's
claudeAiOauth replaces the VM's (or takes it out when the copy has none),
every other key of the VM's file stays. It reads the VM's file with one
jq call (--slurpfile, so two JSON values or a non-object are caught) and
writes it whole, mode 600, through a mktemp file in ~/.cache, which no
history export or remake carries, then mv; a failed cat or mv removes
the temp file and fails the setup. A link, or a file that's empty, not
JSON or not one object, is replaced by the copy and said (a link removed
first, so mv never writes through it into a folder); a folder is left
and said.

With a Claude Code token (setup-token), devvm sends no copy, as before,
so the VM's file stays as it is: Claude Code prefers the token in its
environment, and a leftover login's placeholder gets the token at
api.anthropic.com and nothing at the connectors' host.

mcpOAuth stays in the VM: devvm agent save reads only settings and the
.claude.json allowlist, history export excludes .credentials.json
(HistoryExcludes) and import skips it, and a remake leaves login files
out (homeSkips), all unchanged.

Tests: TestStageClaudeOAuthMerged (the copy is staged to merge, never at
home/.claude/.credentials.json); TestClaudeSyncNamesMerged (sync.sh
merges each claudeSyncName name into its place); guest.txtar runs
merge_claude_credentials (mcpOAuth and other keys kept, claudeAiOauth
replaced or removed, a key with a \u escape, empty, not JSON, two values,
an array, a link to a file or folder, a folder, a failed move, the
warnings, mode 600, no temp left); agent_login.txtar reads the new name.

Docs: Coding agents' MCP servers' logins (real tokens the VM's code can
read, never leaving it) and its Copies, How it works' Claude Code's
login and the network page's sentences, what a VM made again keeps, the
sync.sh header, and the safety pages' claim that a VM never holds a
refresh token, narrowed to the logins devvm keeps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 13:57:45 -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 2c0a894a1c fix(vm): a project folder's VM works after a boot renumbers its disk
macOS numbers its disks' devices in the order they appear at boot, so
after a restart an unchanged project folder's identity (dev:ino:btime)
can have another device. The finder then refused its VM as made for an
earlier folder (vm_other_folder), a stopped VM's start refused it as
replaced (project_folder_changed), and the next .git check called it
replaced (git_replaced).

platform.SameFolder is now the one comparison of two folder identities:
the same ID, or at the same path the same inode and birth time on
another device. On another device the ID must also be the one read from
the folder opened at the path with no link followed (OpenNoLinks, then
fstat and fstatfs on it: openFolderID), on a file system whose IDs are
their folder's alone, so a link swapped in while the caller read the ID
can't pass a copy's (a snapshot's, a cloned disk's) off as the folder's.
A folder at another path (moved) matches only exactly.
platform.Renumbered says when the record needs the folder's ID as it is
now.

The finder's sameFolder, here.movedFrom, gitprotect's protectRepo and
the strict conversion's checks use it. A start records the project
folder's identity as it is now under the VM's state lock (renumbered, in
bringUp) before the backend mounts it by Want.ProjectID, so vz's
/.vol/<dev>/<ino> mount names the current boot's device, in the one
limactl edit; folderChanged's checks after it then compare exactly. A
.git check that accepts a renumbered .git records its current identity.
The move's check stays exact, as both its IDs are read in one run.

The structure test's folder-ids rule fails on == or != on a field named
Folder or GitID, or a call of FolderID or folderID, outside
internal/platform and tests, unless exactFolderIDs lists the function
with why: the agents' and exports' Folder paths, recordMove's
unchanged-state check and folderChanged.

Tests: TestSameFolder (platform), TestRenumberedFolder (vm),
TestReportsRenumbered (gitprotect), a renumbered vz case in
TestProjectMountByInode (lima), existing.txtar's renumbered folder, and
fixture_v010_renumbered.txtar on the frozen v0.1.0 state, through the
new renumber script command and stubtest.Renumbered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 10:12:14 -07:00
w3cjandClaude Opus 5.5 ba5613e1ed fix(project): a folder name's run of separators becomes one dash in its VM's name
A folder named x--y, "foo (copy)" or "C++ stuff" failed to get a VM
(#52): project.Slug turned each character other than a-z and 0-9 into
its own dash, and Lima's instance-name grammar refuses separators in a
row. Slug now writes one dash per run.

- vmname: the project-VM grammar refuses dashes in a row
  ([a-z0-9]+(-[a-z0-9]+)*); HasRuns recognises the names releases up to
  0.1.1-rc.3 made for such folders.
- state: a vm.json whose name HasRuns and that has no created time is
  read as no state. Only a create that Lima refused leaves one (vm.json
  is written before limactl clone), so the folder's next VM, in the same
  hash folder, replaces it, rather than every read failing as corrupt.
  One with created set is still corrupt.
- The limactl stub refuses names Lima refuses on create and clone;
  TestLimactlStubContract gains a refused clone, checked against real
  Lima.
- Tests: TestNamesLimaTakes (Lima's regex as the oracle), TestHasRuns,
  TestVMWithRuns, TestLimactlRefusesNames, name_runs.txtar (a new VM for
  x--y, and an older release's leftover state replaced).
- Docs: internals/backends.md's VM names; CHANGELOG Unreleased Fixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-16 12:39:29 -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 90a64a44d1 fix(races): lock order checked, sandboxes' own ports, pins that meet a rename, daemons' groups stopped
- state: test builds and tests check the state locks' order (state.held, CheckLockOrder): a second VM's lock, a VM's lock under the claims lock, or a lock taken again panics before waiting.
- platform: PinBeneath opens the path again when a rename takes the file away before move_mount (ENOENT), so the keeper no longer reports a false lost pin (TestPinsInNamespace's 'f lost / f pinned-again'); TestPinWhileRenamed.
- daemon: Proc.Stop signals the process group (SignalGroup), so forwarders' and link sessions' ssh masters and relays end with them; ui.UI.StopsItsOwn makes _ports and _links wait for their ssh on an outside SIGTERM.
- vm: gc --orphans and devvm space count forwarders' leftover control sockets (vmssh.ControlGlob).
- CLI tests: each sandbox claims a block of ports below devvm's range and the ephemeral range (claimPortBlock, /tmp/devvm-test-ports); free_port, the fixtures' ports and DEVVM_SSH_PORTS come from it, and the sandbox's devvm chooses from its own range (DEVVM_PORT_RANGE override). Fixtures' forwarded ports and settings ports are rewritten too (FIXTURE_PORT_<port>).
- netpolicy and vm tests: the fake proxy's stop waits for its reap, and fake daemons run until the test ends, not 30 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 22:04:31 -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 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 89f26c5771 docs(site): draw the diagrams at build time with pele, no Mermaid JS
The docs site's 18 mermaid blocks are now drawn as SVGs before Hugo
builds the site, by docs/render-diagrams.mjs with pele 1.13.0, and
inlined by a render hook, so no page loads Mermaid's 5.5 MB script.

- docs/render-diagrams.mjs: finds each mermaid block in docs/content,
  draws it with pele in Departure Mono at 14px (a measurer from the
  font's metrics), and writes <key>.svg and <key>.json (its size) to
  the git-ignored docs/.build/diagrams. pele draws edge labels,
  messages and notes at round(14 * 0.875) = 12px with no option, so the
  measurer gives that text its 14px width and the script rewrites
  font-size="12" to 14 on each small-text group (pele-edge-labels,
  -notes, -boxes, -frames); a guard fails on any such group without
  font-size="12", or small text outside them, and a self-check, run
  whenever there's something to draw, renders an edge label, a message
  and a note and fails unless pele measured them at 12 and wrote their
  group with font-size="12". It also fails on a diagram without
  accTitle and accDescr, or on an indented block. A newline after each
  </text>, outside any text element, lets the search index see labels
  as separate words; screenshots of all 18 are byte-identical with and
  without it. (Newlines between a label's tspans would move centered
  lines, so a label's own lines stay joined in the index.)
- Caching: a block's key is sha256(salt + "\n" + text)[:16], the salt
  being sha256("pele <version>\n" + the script's text)[:16], written to
  diagrams/salt. The script keeps every drawing already there, draws
  only missing ones (written to .tmp and renamed), prunes files no key
  names, and touches the folder. docs:diagrams has sources (the pages,
  the script, package.json, the lock) and outputs (the folder), so mise
  skips an unchanged run, and runs npm ci only when the lock's SHA-256
  differs from docs/node_modules/.devvm-lock-sha256. An unchanged run:
  0.45-0.75 s before, 0.02 s now (0.09 s forced); one diagram changed:
  0.09 s. CI's check job caches ~/.npm keyed on the lock; the Docs
  workflow, which publishes, keeps no cache.
- docs/package.json and package-lock.json pin pele 1.13.0
  (sha512-Ie8UKY9x00MsuR3jO6AzUwzK2Z6MIV3Tf4EDdITiuk8Uaz8K7g0R082WqsqNaSU8DdgkrRvZThzhit83mi/uiw==).
- docs/layouts/_markup/render-codeblock-mermaid.html: in place of
  Hextra's hook, reads the salt, computes the key from it and .Inner,
  inlines the SVG from assets/diagrams (hugo.yaml mounts .build/diagrams
  there), sets the wrapper's contain-intrinsic-block-size to the
  diagram's height and --devvm-diagram-width to its width, and errorf's
  when a drawing or the salt is missing. layouts/_partials/scripts/
  mermaid.html and params.mermaid go.
- custom.css: .devvm-diagram with content-visibility: auto, and pele's
  --pele-* variables from the palette (subgraphs, lifelines and notes in
  the border color). A diagram wider than the text reaches into the
  article's right padding (1.5rem, 3rem from 768px) as far as it needs,
  then into the left padding for the rest, so it never covers the table
  of contents; wider than both, it scrolls. From about 1010px no diagram
  scrolls, the four wide ones included (proxy checks 751px, agent store,
  VM states, SSH agent); at 900px five scroll. With the table of
  contents shown, the proxy checks take 48px on the right and 31px on
  the left.
- mise.toml: docs:diagrams, which docs and lint:docs depend on.
  docs.yml: the next and release jobs install node and draw the
  diagrams; the release job only when the tag has the script, so older
  tags still build.
- scripts/bump.sh: bump_pele, named only, replaces bump_mermaid: npm
  install --save-exact --ignore-scripts in docs, then mise run
  docs:diagrams, whose self-check catches a pele that changed how it
  draws small text. TestBumpCoversPins finds docs/package.json's
  dependencies (npm:NAME); bump.txtar tests --check and the install.
  The header and hextra's note say the mermaid render hook replaces
  Hextra's mermaid hook, so check it still has that name.
- Every diagram gets an accTitle and accDescr, which pele makes the
  SVG's title and desc (aria-labelledby, aria-describedby). Staying
  safe's columns are written in reading order, as pele lays subgraphs
  out from left to right. The proxy checks' description names every
  branch, and a hand-placed <br> keeps "CA)" off a line of its own.
- AGENTS.md: the one Node script; no other build script is JavaScript,
  and no other npm package is installed outside mise's tools.
  Contributing's docs, tools and
  maintaining pages describe the drawing, the caching, the margin, the
  task and the bump.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-15 19:36:28 -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 c1cf96e4b6 fix(vm): every start pins the VM's host keys, whatever its ports
A start whose VM forwarded nothing, because other programs held every
listed port or the VM was devvm ports none, never pinned its ssh host
keys: only the port forwarder (Forwards.start, which returned before
vmssh.Checked) and the ssh config pinned them, and a start that went no
further than bringUp (devvm clone fetch, rm's fetch, the clone check)
wrote no ssh config. devvm's own ssh (ownSSH, vmssh.ReadKeys) then found
no record, and devvm clone fetch failed with clone_fetch_failed.

bringUp now pins them last, once the start or the running VM has gone
through the self-check (starter.pinHostKeys, vmssh.PinHostKeys), for a
VM whose backend's ssh the review allows. A record of the current start
is kept without reading the VM; ErrNoHostKeys is skipped, as the ssh
config skips it, and other errors fail the command. A running VM without
a record of its start, as this bug left one, gets it at its next
command.

Tests: TestFetchPinsHostKeys (forwarding none, every port taken,
running without a record), and TestUp, TestUpNetworkPolicy and
TestUpTools' calls with the pin after the self-check; testscript clone_hostkeys, its ports the
script's own listeners. fixture_v010_clone passes with 3000 and 5173
held. CHANGELOG Fixed entry; design.md's host key and security.md's ssh
into VMs say when the keys are read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-14 23:15:36 -07:00