6 Commits
Author SHA1 Message Date
w3cjandClaude Opus 5.5 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]>
2026-11-19 10:02:01 -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 872c2e23c0 fix(proxy): Cursor's account services refuse more changing verbs and the cloud agents' endpoints; bridge mode stays off
cursorChanges, which refuses a method of DashboardService,
AutomationsService or BackgroundComposerService whose name starts with a
verb that changes something, now has clone, commit, generate, mute,
unmute, reindex and retry. Each was checked against all of those
services' methods in the 2026.11.17-f532c45 package (1110, 57 and 296),
read and not run. Twelve match: RetryAutomationRun,
CommitBackgroundComposer, MuteBackgroundComposers,
UnmuteBackgroundComposers, CloneGrokCollection,
CommitOrganizationNetworkBlocklistUpload,
GenerateGrokCollectionDescription, GenerateTeamGrokBotScimIdpSigningKey,
ReindexAndApplyTeamMarketplaceChanges, ReindexGrokCollectionDocument,
RetrySandMessagesPermission and RetryTeamXaiMembershipHold, and the CLI
calls none of them. cursorMints also refuses every path below
/cloud-agent/, on every Cursor host. The docs say the verbs are defence in
depth, as the bindings put the login only into the CLI's own methods, and
name changing methods they miss.

Bridge mode (api2direct.cursor.sh) isn't added to the allowlist: it is
cursor-agent worker, a self-hosted Cloud Agent worker that mints identity
tokens at /cloud-agent/identity-token/worker, runs cloud agents' work
started elsewhere, mounts the agent store, and sends Host: api2.cursor.sh
through a tunnel to api2direct, which has no bindings, so the login never
goes in. The coding-agents page says it doesn't work in a VM; the
decision is CJ's.

Test: TestCursorMints.

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

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

- CHANGELOG: Changed, the pin.

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

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

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

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

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

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

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

Co-authored-by: JB <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-12 11:49:48 -07:00