mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
main
21
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
9acdd0c47c |
fix(agents): history exports leave out opencode's machine key
opencode 2.4 keeps the private Ed25519 key of its home, which every machine it pairs with `opencode machine add` trusts and which it never replaces, in ~/.local/state/opencode/machine/home-key. That folder is in opencode's History, so devvm history export, and the exports devvm rm and a remake write, copied the key onto this machine, and devvm history import wrote it into other VMs, with the background service's registration (service.json and its .pty-handoff, the service's password and a handoff ticket) and the terminals' daemons (pty, their sockets and access tokens). The agents' registry gets HistoryOwn: what of an agent's history is the VM's own as a machine. HistoryExcludes() returns it after each agent's HistoryExcludes, so the export leaves it out and the import never writes it, by its paths after it unpacks too. HistoryLogins() is each agent's HistoryExcludes alone, which a remake's home copy (homeSkips) leaves out, so a remade VM, the same machine, keeps its key. The copy of opencode's database empties its machine table (opencodeLogins), the paired machines' public keys, which are the VM's own pairings. opencode's schema fixture moves to 2.4.1 (testdata/opencode-2.4.1.sql, from its release's schema.gen.ts, which matched 2.2.5's VM-printed file line for line): automation replaces schedule and is kept; machine is emptied. Tests: TestHistoryExportRuns, TestHistoryImportRuns and TestHistoryImportV010 plant the key, service.json, its handoff and pty, and fail without the fix; TestHomeSkipsEveryLogin checks each HistoryExcludes is skipped and each HistoryOwn kept in a remake; TestLists covers HistoryLogins; e2e's network section plants the key in a VM and finds it in no export. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b7178b0dc8 |
docs: the design notes move to Contributing
The design notes are for contributors: they hold each emulation's design note, its threat check and its tests, with hundreds of Go identifiers, so the page moves from How it works to Contributing (weight 8, after Writing docs), keeping its title and anchors. An alias keeps /docs/internals/design/ working, as a redirect to the new page. Every reference follows: the internals, using, safety and contributing pages' links, the page's own links to the How it works pages, the section index pages, AGENTS.md's Backends rule, contributing/docs.md's What goes where, internal/proxy/README.md and two e2e comments. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6dd965b475 |
docs: How it works names no Go identifiers; Contributing has them
The How it works pages (but the design notes) say each mechanism in plain words, and the identifiers, repo paths and test names they named move to Contributing: The packages' rows in structure.md, extending.md's How a backend plugs in, maintaining.md's pins table, and a new tests.md section, The tests behind How it works, which names the tests that the pages now describe in words. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
6e36a19058 |
docs(internals): the changes since 0.1.1-rc.3 in the docs voice
Rewrites the passages of the How it works pages that changed since v0.1.1-rc.3 into joined, plain sentences: clauses chained with colons and semicolons split or joined, trailing "too" turned into "also", "X alone" into "only X", inverted and passive sentences turned round, and design.md's broker note's "as the proxy does now" made present tense. Every fact is kept (facts.sh --all: only punctuation next to numbers and one more mention of NormHost, devvm _qemu pinned and the 17 ports). Pages: agents, backends, design, desktop, git-protection, install, lima, network, overview, ports, processes, security. _index and images needed no change. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
888078c9cd |
fix(vm): devvm agent save and import read names as the store's volume does, so a name that differs only in case never deletes a file
On a volume that ignores case, as a Mac's does by default, a store with Foo.md and a VM sending foo.md (or a home folder with foo.md, for devvm agent import) made the command rename the new file over Foo.md, which keeps its name, then move Foo.md aside as a file the folder no longer has, and delete it with the staging folder, reporting success. - pruneIn keeps what keep names as the volume reads it: every kept name's folder, or file with one name, by what it is (platform.DevIno), so the store's Foo.md that a foo.md just replaced in place stays, in save's pruneFolder and import's apply alike. A hard link is kept only by the name keep has. - storeFiles takes the VM's names and lists a store's file that the volume reads one of them as, under another name, under the VM's name, so compare shows the VM's foo.md as a change to Foo.md, never an add and a remove, and a kept name keeps its file. A hard link is never listed so, and the diff shows its names removed, more than the save takes out, never less. - storeStage.claim checks each path before the stage writes it in its staging folder, which is on the store's volume and holds only what it wrote: a part already there under no name it wrote is a name the volume reads as another of its own (nameClash), named with that one. The save stages its folders too, and checks the names it leaves out (agent_save_names_collide); the import checks its folders and files (agent_import_names_collide). Either fails before the store changes. - The save holds a VM's paths to the import's bounds, 128 folders deep and 4,096 bytes, measured from the agent's folder as the import's walk measures them (agent_save_too_much, which now lists every bound): each folder's claim, make and apply opens its path one name at a time, so a chain thousands deep cost the square of it under the store's lock. safefile's walkMaxDepth and walkMaxPath are MaxDepth and MaxPath, the one owner of both. Tests that fail without the fix: TestAgentSaveCaseOnly, TestAgentImportCaseOnly (the file was gone; a left-out PH.md shown removed), TestAgentSaveCaseOnlyHardLink (the diff showed a change and the save took out the other name), TestAgentSaveNamesCollide (two files, two folders, two empty folders, a file and a name left out), TestAgentImportNamesCollide (through the import's stage); they skip on a volume that tells case apart. TestStoreNamesByWhatTheyAre (a hard link stands in for the volume's other name, on any host) and TestReadSent's depth and path cases, each at its bound and past it. Docs: using/coding-agents.md (importing, saving), internals/agents.md; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
f80fd2df60 |
fix(vm): devvm agent save applies all or nothing under the login lock; a lock's wait and a walk end with their context; a link to the home folder counts unless only root can change it
All or nothing: - devvm agent save goes through devvm agent import's undo journal: each plan's files are written into a staging folder of the agent's store (saver.stage, newStage, the import's .devvm-import- name, swept by the next import or save), then put in place (applyPlan: each file renamed in, the one it replaces kept aside as a hard link, folders made, what a folder no longer has moved aside, seeds and kept entries left), and the .claude.json subset saved last with secrets.SaveLogins, which holds the login's lock. A failure after the first change puts every agent's store and the login back; an undo that fails too says so (agent_save_undo_failed) and keeps the staging folder. - applyStages (and stageSet) is what both commands apply through; importStage is now storeStage, pruneIn takes an fs.FS, and pruneFolder moves a folder's leftovers aside. pruneStore and applySettings go. - A file in the VM where the store has a folder, or the other way round, fails the save before anything changes (agent_save_store_folder, agent_save_store_file; sameKind), where the stage would have replaced it without the diff showing; storeFiles reads such a path as empty. Contexts: - platform.LockDir flocks a folder, polling until ctx ends as LockFile does (waitLock is their shared loop); agentlogin's lockLogin is it, so the lock is the one an older devvm's proxy takes. LockLogin, LockFolder, File.CaptureRequest, Capture, SetKey, Remove and secrets.Store.CaptureRequest take a ctx. A capture whose reply the endpoint has given is saved with agentlogin.AfterReply's context, the exchange's without its end and bounded by two minutes of its own, so the exchange's deadline never loses a rotated login while a refresh or a save holds the lock, and a stalled holder never holds it for ever (File.Capture, secrets.Store.Capture, its loginsDir included). - safefile.Walk takes a ctx and stops before each folder and batch once it ends; readSettings, followLinks and follower.copy pass theirs. - LockFolder's comment said its lock was another than a login file's in the same folder; it's the same (.claude.json's), and says so. Links while a state can't be read: - homeHops exempted every link on the way to the home folder, on the claim that no project folder can hold one, which --unsafe-folder breaks. rootOnly exempts a link only when every folder above it, up to /, is root's, has no group or other write bit and the system says you can't write it (platform.Writable, access(2), which counts ACLs and FUSE), and devvm doesn't run as root. The structure test lets internal/agentlogin import internal/platform and counts platform.LockDir in its status-lines rule. Tests that fail without their fix: TestAgentSaveApplyFailsWhole (a rename and the login failing), TestAgentSaveUndoFails, TestAgentSaveLoginLock (waits under agent_login_waiting; Ctrl-C leaves the stores as they were), TestAgentSaveKindChanged, TestAgentImportHomeBelowALink, TestCaptureOutlivesItsDeadline, TestClaudeCaptureOutlivesItsDeadline, TestWalkCancelled, TestLockLogin (synctest: a deadline and a cancel). New: TestLockDir (synctest, and a plain flock's lock), TestRootOnly, TestWritable, the status-lines rule's LockDir case. TestStoreOpsRefuseLinks checks openStoreDir in pruneStore's place. Docs: internals/agents.md (saving, the staging folder, links to the home folder), using/coding-agents.md, Contributing's CLI and structure pages; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
b04a1a9f12 |
fix(vm): agent import walks within its bounds, takes turns at the store, applies all or nothing, and refuses links while a state can't be read
The bounded walk: - fs.WalkDir read each folder whole before the import's entry bound applied, so a VM whose project folder is in an agent's folder could make the walk hold millions of entries. safefile.Walk walks as fs.WalkDir does (order, SkipDir, SkipAll, errors) but reads each folder 256 entries at a time, counting every entry it reads against a safefile.Bound, and stops with ErrTooMany before fn sees the folder; it also stops at a folder more than 128 deep or a path past 4,096 bytes, so a deep chain can't make the walk quadratic. - readSettings walks the agent's folder through the folder opened one folder at a time (h.safe), whose FS now opens folders to list them (rootFS.openDir: no follow, no blocking, the folder Lstat saw or ErrSwapped), so a link or a FIFO swapped in for a folder fails the walk. follower.copy walks each link's target the same way; the walks of all links read at most linkMaxWalked (80,000) entries in all, those left out for the bounds included. - The structure test's status-lines rule counts safefile.Walk as a walk. The store's lock: - paths.Dirs.AgentStoreLock (agents.lock in the data folder), held by lockStore, under a status line (agent_store_waiting) while it waits: devvm agent import from its staging to its logins, devvm agent save's writes, and a start's clean of a seed's folder (cleanSeeds, now with ctx), which takes it only once it finds something to take out and looks again under it. - devvm agent save plans again under the lock and saves nothing when the store changed since it showed the diff (agent_save_store_changed), rather than write over an import. All or nothing: - After staging, apply moves aside what it replaces or prunes into the staging folder's replaced folder (a file kept as a hard link, so it's still replaced in one rename), notes the folders it makes, and keeps each change's undo. The logins are saved all or none (secrets.SaveLogins, which reads each file it replaces first, puts them back on a failure, and holds each login's lock, agentlogin.LockLogin, as the proxy does while it refreshes one). - A failure after the first change undoes every agent's changes, going on past an undo that fails; each store it couldn't put back keeps its staging folder, named with it (agent_import_undo_failed). - An interrupted run's cleanup waits on the stage's mutex for an apply that started, and an apply after the cleanup took the staging folder out puts nothing in place. Links through states devvm can't read: - While any VM's state can't be read, the import leaves out every link out of an agent's folder and an agent's folder or login whose path leads through a link, but the links on the way to the home folder itself, naming the state (agent_import_link_unread_state), where before it followed them with only a warning (projectFolders.chosen, with throughVM's check). Tests that fail without their fix: TestWalkBound (fs.WalkDir as the control), TestWalkDepth, TestWalkAsWalkDir, TestWalkErrors, TestRootFSOpenSwapped (a FIFO), TestAgentStoreLock (import, save, a seed's clean), TestAgentSaveStoreChanged, TestAgentImportApplyFailsWhole (a rename and a login failing, files and folders swapping kinds), TestAgentImportUndoFails (two agents, the second's undo failing), TestAgentImportInterruptedApply, TestSaveLogins, TestAgentImportLinksUnreadState (a link out, a linked folder and its login, a login behind a link), TestAgentImportLinkWalked. TestRootFS and TestCleanSeeds* follow the new FS and ctx. paths.Dirs is allowed 63 methods (largeTypes), for agents.lock. Docs: using/coding-agents.md, internals/agents.md, using/space.md, internals/overview.md, Contributing's structure page and the owners doc, the codebase-standards guard for bounds; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
3101c85260 |
fix(vm): a failed agent import leaves the store as it was; the import's bounds count every entry and cap a file; a login's terminal is put back
devvm agent import wrote each settings file into the store as it read it, so a file that failed to read partway (changed since it was listed, or past the bounds) left the store half replaced. The import now reads and writes every agent's settings into a staging folder of the agent's store first (.devvm-import-<random>, beside the agent's folder, so no VM mounts it), and only once all of them are staged, and the run isn't interrupted, moves each file into place, prunes what the home folder no longer has and then saves the logins. A failure or an interrupt while staging leaves the store as it was: the staging folder goes, through discard, or through a cleanup for an interrupted run, which reaches it by a root of its own. A failure after that (a rename, a login) can still leave the store partly replaced, which internals/agents.md says. A killed import's leftover staging folder counts as nothing of the agent's (inStore), so it never makes the import ask, and the next import of that agent takes it out first (sweepStages). The import's bounds on an agent's own folder now match devvm agent save's: the walk counts every entry it meets, links, sockets and FIFOs included, not only the folders and files it keeps, and a file of more than 16 MiB, as listed or as read, fails the import as the 128 MiB does. Claude Code's plugin records are copied with the store's longer paths, and what the copy grows counts against the same bounds (hostAgent.grew), naming the folder, or the link a file came through, so the store never gets more than the import checked. The two handles on an agent's folder, the os.Root it lists through and the folder opened one folder at a time that it reads through, are checked to be one folder (sameFolder), failing the import otherwise. A VM state the import can't read is a warning (agent_import_states_unread), naming the file, rather than silently dropping that VM from the project-inside warnings and the link checks; the follower takes the VMs the import read at its start instead of reading them again. state.WriteFileIn and writeFileMode share one tail (finishTemp). clearKind takes the root the import opened once, rather than opening the store for every path, and pruneStore's walk is pruneIn, which the import calls on the same root. Cursor's changing verbs (proxy's cursorChanges), checked again against the 1,463 methods of DashboardService, AutomationsService and BackgroundComposerService in 2026.11.17-f532c45, read and not run. generate goes: it matched only GenerateGrokCollectionDescription, which only returns a draft, and GenerateTeamGrokBotScimIdpSigningKey, which cursorCredential refuses anyway; no other method changes between refused and passed. test stays, justified in its comment: it matches TestAutomationFilter, a dry run that only reads, but also TestTeamCustomerTelemetryDestinationConnection, which has Cursor's servers send a request with any headers to any address. park, hand, decline, replace and resend match only methods that cursorCredential refuses too (as rotate, link and invite do), and stay, justified in the comment, for the methods Cursor adds. Every cursorRoutes path the CLI's login goes to is checked against the proxy by agentlogin's TestCursorCapture (proxy can't import agentlogin, which imports it); TestCursorChangingVerbs now says so. devvm agent login on a terminal saves the terminal's state before the login (ui.Terminal, through vm.Env.Terminal, which now returns a restore) and puts it back once the login and endLogin are done, or in a UI cleanup if the run ends first, so an ssh that a signal killed in raw mode doesn't leave the host terminal raw. Tests that fail without their fix: TestAgentImportFailsWhole (a failed import leaves the store's own files and no staging folder), TestAgentImportTooMuch (rewritten: its dead want field gone; exactly 20,000 entries and 128 MiB list whole, one more entry or byte fails, a link and a FIFO count, a file of 16 MiB and a byte fails), TestAgentImportPluginsGrow, TestSameFolder (the helper, and the import with its folder swapped between the two opens), TestAgentImportStageLeftover, TestAgentImportInterrupted (the ctx check before apply, and the interrupt cleanup on its own), TestAgentImportProjectInside (beside a broken state), TestCursorChangingVerbs (GenerateGrokCollectionDescription passes), TestAgentLoginTerminal (put back once, after the login ended, interrupted included), TestTerminalRestores. Tests that pin what already held: TestNarrowNotesBesideBroken (devvm network's -g allowlists beside a VM state that can't be read), TestWriteFileIn (a failed rename leaves no temporary file), and TestCursorChangingVerbs' TestTeamCustomerTelemetryDestinationConnection. The finder now checks fst with found, so nilaway no longer reports fst's flow, and all of fst's lines in its baseline go. Docs: using/coding-agents.md, internals/agents.md, internals/network.md; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c901b920ef |
fix(agents): the agent store is written only through roots, an import is bounded, and projects overlapping agents' folders get a warning
devvm agent import and save checked each path they wrote in the store by path (storeGuard), then wrote by path (os.MkdirAll, state.WriteFileMode), so a link swapped into the store between the check and the write could lead the write elsewhere. They still check every path first, so a link fails the command, naming it, before the store changes; they now write only through the agent's folder in the store opened from devvm's config folder as a root (makeStoreDir, which makes it and the folders on its way through the config folder as a root, then openStoreDir), with state.WriteFileIn, a whole-file write through an os.Root. An import copied whatever an agent's folder held, one file at most 128 MiB, so a VM whose project folder is inside an agent's folder could fill the store that every VM with the agent mounts. Each agent's folder now gets agent save's bounds in all, 20,000 files and folders and 128 MiB: the walk stops at 20,000 (errFolderTooMany), the sizes as listed are counted (hostAgent.tooMuch), and a folder over either fails the import before anything is written, naming the folder and what to do (agent_import_too_much); the files' reads share the 128 MiB (h.read), so files that grew since the listing fail too. Before it reads anything, the import warns of each VM whose project folder is inside an agent's folder or holds it (agent_import_project_inside). A project folder that holds an agent's folder, such as ~/.pi for pi's ~/.pi/agent, let its VM put a link in the agent folder's place, which the import followed, copying whatever it led to, such as the home folder's files, into the store: the import now resolves the folder's path one link at a time (linkHops), leaves it out with agent_import_link_via_vm when a link in a VM's project folder leads it out of that folder (throughVM, shared with the link follower), its login with it (pi's auth.json), and reads the folder where the path led. Every agent's login file but Claude Code's ~/.claude.json, which was already a capped, regular-file read, was os.ReadFile by path, so a VM whose project folder held it could swap in a link to another file, a FIFO or an endless file between the check and the read: its path is now resolved once (linkHops), left out when a link in a VM's project folder leads it out of that folder (throughVM), and read where it led, through its folder opened with no link and never resolved again (openPhysical), opened without following one, a regular file of at most 128 MiB (claudeHostLogin), so a folder swapped for a link since fails the read. Tests: TestWriteFileIn, TestAgentImportTooMuch, TestAgentImportReadBudget, TestAgentImportProjectInside, TestAgentImportProjectHolds (a folder and a login led elsewhere), TestAgentImportLoginNoFollow, TestStoreOpsRefuseLinks (makeStoreDir). Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c9d0fdb270 |
feat(agents): warn about credentials in copied marketplaces
A Claude Code marketplace is a git clone that devvm agent import and save copy whole into the store's plugins folder, which every VM with Claude Code mounts, so a private marketplace's credential in its git config reached every VM without a word. Both commands now check what they copy and warn, naming the marketplace, the store's file and the keys, never the credential (a URL subsection with one shows as <url>) (marketplace_secret): - each git config below a clone's .git (a submodule's included), read by git itself (listConfigFile, beside the clone seed's listConfig), and the files it includes from inside the clone: an http.extraHeader, and a URL with a credential in a remote's or submodule's URL, a push URL, a proxy or an insteadOf's base, judged as the clone seed judges a remote (cleanURL: changed or refused while it has an @); - known_marketplaces.json's source URLs. A config git can't read is named as unchecked (marketplace_unchecked), as the VM reads the file whatever git makes of it. The copy is made as before, as CJ chose. Test: TestMarketplaceSecrets. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d939d1d870 |
fix(agents): agent import and save never write through a linked store, nor copy a link to what they leave out
devvm agent import copied a link inside an agent's folder as the file it led to wherever that was in the folder, so a link in ~/.claude/skills or ~/.claude/plugins/cache could put the history, .credentials.json or a plugin's data into the store. Such a link is now copied only when its target is one of the agent's settings (listedPath, MachineOwn included), and any other is left out, naming where it leads (agent_import_link_not_setting). Each file the import listed is read through the agent's folder opened one folder at a time without following a link (readListed), and must be the file it listed, so a VM whose project folder is in the agent's folder can't swap a link or a folder between the listing and the read; a file it can't read so is a message (agent_import_read_failed), as is one whose details can't be read while listing, which was dropped without a word. One file is read up to 128 MiB. pruneStore and clearKind opened the store by path, so a store that was a link (to ~, say) let import and save delete the files of the folder it led to. They now open it from devvm's config folder, refusing a link on the path (openStoreDir, sharing one walk, walkStore, with cleanSeed and the guard), and import and save check every path they'll write, for every agent they handle, before the first write (storeGuard, checkStore, checkPlan, saver.applyAll): a link fails the command, naming it, before the store changes (agent_store_link). Tests: TestAgentImportLinksInsideToSettingsOnly, TestAgentImportSwappedAfterListing, TestAgentImportLinkedStore, TestAgentImportLinkedStoreOfAnother, TestAgentSaveLinkedStore, TestAgentSaveLinkedStoreOfAnother, TestStoreOpsRefuseLinks. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
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]> |
||
|
|
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]> |
||
|
|
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]>
|
||
|
|
90694a414f |
feat(agent): devvm agent import follows links out of an agent's folder when allowed
A link out of an agent's folder, such as a dotfiles repo's link into ~/.claude, was always left out. Now it's copied when you allow it: config.toml's follow-links names folders whose links devvm follows without asking, and otherwise devvm names each link and its target and asks, a question --follow-links answers. Without a terminal and the flag, links out are left out with a warning naming --follow-links. - The store gets copies only: a linked file as a file, a linked folder as a folder of files; the next import replaces them, a folder that became a file included, and prunes them once the link is gone. - Each link is resolved one name at a time (linkHops), then read through its allowed folder as a safefile.Root opened one folder at a time from / (openPhysical); a link inside is read only to a file in that root. - Always refused: the home folder or a folder holding it, devvm's config, data and Lima folders, ~/.ssh, ~/.gnupg, ~/.aws, ~/Library/Keychains, ~/.config/devvm, ~/.netrc, ~/.config/gh, ~/.docker, ~/.kube, and every agent's logins and history, compared by name and identity (isIn); a follow-links folder in or holding one fails the import. - A target in a VM's project folder warns, naming the VM; a chain through a link in a VM's folder to a place outside it is refused. - Bounds: devvm agent save's, 20,000 entries, 128 MiB and 16 MiB a file, across one import. - A settings file must link to a file and a settings folder to a folder. Messages: agent_import_link_not_followed, agent_import_link_refused, agent_import_link_too_big, agent_import_follow, agent_import_link, agent_import_link_followed, agent_import_link_project, agent_import_link_via_vm, agent_import_root_refused, follow_links_invalid. Tests: TestAgentImportFollowsLinks, TestAgentImportNestedLinks, TestAgentImportRefusedPlaces, TestAgentImportRefusedRoots, TestAgentImportProjectFolderLinks, TestAgentImportLinkThroughProject, TestAgentImportRefusedOtherCase, TestAgentImportLinkBounds, TestLinkSourceGrown, TestAgentImportLinkKinds, TestAgentImportLinkPrune, TestAgentImportLinkedAgentFolder, TestLinkHops, TestOpenPhysical, TestFollowLinks; testscript agent_import_links; e2e project section. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
c597c21e85 |
fix(history): an export packed with macOS's tar imports
devvm history import refused an export made with macOS's tar (bsdtar): for each file with extended attributes, such as the com.apple.provenance that recent macOS puts on new files, bsdtar adds an AppleDouble ._ file beside it, and ._.claude, at the top, is outside the agents' history. bsdtar's own listing hides those entries; GNU tar's, which the VM checks, shows them. e2e's from section packs its Alpine export on the host, so it failed on the mini (macOS) and passed on fedora (GNU tar). The import script is unchanged since before the agents stack, so this isn't a regression from it. - historyImport leaves a name whose last part starts with ._ out of the path check (appleDouble), and never unpacks one (--exclude=._* and */._*); what's below a folder so named is still checked. - TestHistoryImportRuns (GNU tar, so Linux): an export laid out as macOS's tar writes it imports without its ._ files (it failed before the fix on fedora), ._.claude/a is still refused, and an export that devvm history export writes imports whole (a round trip). - The agents' golden scripts, internals' Coding agents and the CHANGELOG. Co-Authored-By: Claude Opus 5.5 <[email protected]> |
||
|
|
d349868c31 |
feat(agents): one definition per coding agent, and Cursor's CLI
Every list of the coding agents now derives from internal/agents' registry, one Def each, and Cursor's CLI (cursor-agent) is a fifth agent. The registry: - each agent's login command, login formats and capture on its Def; one message for every agent where each had its own - the agents' table, the README's list and the docs' history lists are generated from the registry (cli.DocBlocks, TestDocBlocks); scripts and Go tests take their lists from it too - each agent's own code lives in a file named for it; the structure test lets only an agent's own files choose by its name, following constants named after an agent - a VM remade by clone on/off keeps no agent's login files (agents.LoginFiles from every Def.Logins; Claude Code's .claude.json stays, as it is also history) Cursor's CLI: - `devvm --agents cursor`, `devvm agent login cursor`, history import and export of ~/.cursor/chats - the proxy captures its login at a GET endpoint, guards a shared host by path, and puts the login in only where the CLI sends it, bound to the CLI's 57 methods - account changes and the agent store are refused in a VM; Cursor's headers and trailers are scanned for tokens - e2e: Cursor's CLI in the network section, its poll behind the fake company proxy Docs: the agents' pages lead with commands, with a How it works page for the agents. Co-authored-by: JB <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> |