Repository navigation
fix(dev): an environment's agent makes new patches in its workspace - #864
Conversation
Review: GPT-6.1-Sol (xhigh), two roundsRound 1, at
Round 2, at |
The agent launcher left new patches in the developer's real ~/Patchy, where `down` never looks, and a repo bound to production kept its own address because the launcher cleared PATCHY_API_URL. - The workspace gets a CLAUDE.md, "Make each new patch or page directly in this folder", written on every `up` and never over one that exists. - The launcher sets PATCHY_API_URL to the environment's instance, so a repo bound to another one refuses before anything is sent. - Each session has auto memory off and a temp folder of its own, deleted when Claude Code exits. - A trial writes this checkout's agent into both sides, so both get the same folder and guard; the adapters for older launchers go. Closes #829 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signalling the launcher's pid alone left Claude Code running once bash had deleted its temp folder. The launcher execs Claude Code again, names each session's temp folder for that pid, and a later launch deletes the folders whose process is gone. The trial section names after's launcher, and DEVELOPMENT says another checkout's .local/dev/env outranks the guard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
caed395 to
e6723b4
Compare
Acceptance: PASS with notesChecked Done means
Golden journeys
Additional evidence pnpm exec vitest run scripts/dev packages/patchy/src/Instance.test.ts packages/patchy/src/cliRepoPublish.test.ts
Test Files 15 passed (15)
Tests 91 passed (91)Repeated All direct installed-CLI calls used Rollback answers: they match the diff. A revert can leave the workspace instruction file and the newer launcher until another Not run
Notes
|
…874) ## What changed Release 16's What's new entry, written from `dd3f41f`. It covers everything merged since release 15's `through` (`9e4b0df`), and sets the `patchy` release to `0.16.0` (`packages/patchy/package.json` and `CURRENT_RELEASE`). | Change | PRs | | --- | --- | | Fixed: Revoke all machines stops logins still on their way | #867 | | Behind the scenes: `mcp` and `oauth` kept off company addresses | #863 | | Behind the scenes: read-only actions and agent tools understood and enforced before anything writes them | #868 | | Behind the scenes: logs record how long a tool's server takes to start | #865 | #814 is release 15's own entry, so it's left out. #818 and #831 are docs (Patchy is live; the Patchy MCP spec) and #864 is dev tooling, so none of them gets a line. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. #867 is the only change a person could notice. The page's button is still labelled "Revoke all machines" (Disconnect everything is the spec's future name), so the entry uses that label. - **Rollback safety, from the live commit `d77baaf` to `dd3f41f`.** No PR in the range is labelled `one-way`, and every PR answers both Release impact questions with "Yes". - #867 is the only migration: `0019_credentials_ended` adds two nullable columns, `users.credentials_ended_at` and `device_logins.confirmed_at`. At `d77baaf`, every insert into `users` and `device_logins` lists its columns, and nothing reads either table with `SELECT *`. - `rollback-rehearsal` passed on #863, #865, #867 and #868. #868's run covered #867's migration already on main: `Exercised rollback paths passed: d77baaf → ffe9988 → d77baaf`. - A rollback would reopen what #867 closes: an approved login that hasn't finished could again get past Revoke all machines. It would also let new companies take the `mcp` and `oauth` addresses (#863). No release that writes read-only actions or agent tools has shipped, so going back past #868 leaves nothing behind. ## How it was verified - `vitest run packages/core/src/whatsNew.test.ts packages/api/src/schemas.test.ts`: 14 passed. - `pnpm typecheck`: 23 of 23 tasks pass. Prettier and eslint are clean on the changed files. - The live commit was pinned from `/healthz/deep` (`d77baaf`, release 15). The Deploy run updated last succeeded, and none is unfinished. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required The changelog text plus the `patchy` version bump. A CLI installed before this deploy is told to upgrade, as with every release. - **What does a revert leave behind?** Nothing. People whose seen marker reached 16 would just see no new release. - **Does the release before it still work with that?** Yes. If this release misbehaves, roll back to `d77baafcf10c7cdf28c71bd65ea1a0009aa99ced` (release 15). Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
An agent started from a dev environment's
agentlauncher, or bypnpm dev trial, saved new patches in the developer's real~/Patchy, outside the environment, sopnpm dev downmissed them. It also clearedPATCHY_API_URL, so in a repo bound to production that repo's own address won, and launcher sessions shared auto memory and/tmp.Now, as decided on #738:
CLAUDE.md: "Make each new patch or page directly in this folder."upwrites it every time, for a finished environment too, and never over one that exists.PATCHY_API_URLto the environment's instance, so a command in a repo bound to another one is refused before anything is sent. An explicit--api-urlstill wins, and so does another checkout's.local/dev/env, which only ever names a local instance (see the review comment).${TMPDIR:-/tmp}/patchy-agent-<pid>.*. The launcher stillexecs Claude Code, and each launch deletes the folders of sessions whose process is gone.confineTemp,OldLauncher).docs/DEVELOPMENT.md, thepatchy-dev-loopandpr-evidenceskills andscenarios/README.mdsay where agent-made work goes, and that one builder agent per patch is the norm and nothing enforces it.Closes #829
Look at
Where the agent puts new work. On
pnpm dev up(team),…/agent -pon Sonnet:<env>/workspace/office-hours.htmloffice-hours.htmlin the workspace folder, per CLAUDE.md."<env>/workspace/office-snacksCLAUDE.mdasks, rather than the default~/Patchy."~/Patchygained nothing, andpnpm dev downremoved both.The guard. A copy of
office-snackswithpatchy.jsonbound tohttps://other-instance.invalid, with commands run in the launcher's environment and the shell exporting a differentPATCHY_API_URLandPATCHY_API_TOKEN:Clean sessions. With a canary memory planted in the workspace's Claude project folder ("the office secret word is PINEAPPLE"), the launcher's session answered
UNKNOWN. The same launcher without its auto-memory line answeredPINEAPPLE. The two real sessions above wrote no memory folder.How it was verified
vitest run scripts/dev/src/environment.test.ts scripts/dev/src/trial.test.ts: 15 pass. The launcher tests cover:PATCHY_API_URLset to the instance, the shell's token dropped, auto memory off;$TMPDIR(or/tmp), named for the launcher's pid (soexeckept it) and with Claude Code's exit code; a later launch deletes it, and keeps a folder whose process is alive;CLAUDE.mdwritten, and an existing one kept.Instance.test.ts(an env target that disagrees withpatchy.json) andcliRepoPublish.test.ts(refused with no request to either instance).upon the finished environment restored a deletedCLAUDE.mdand kept an edited one.pnpm dev downremoved the agent-made patches.pnpm dev trial(below), oncaed395: both sides, the before side built by main, put the page in their own workspace, and~/Patchygained nothing.@patchy/devthrough turbo, and eslint and prettier on the changed files.Release impact
Dev tooling and docs only (
scripts/dev, the dev-loop docs and skills). Nothing that ships in the server, CLI, API or schema changes.uprewrites it, and keep the workspaceCLAUDE.md, which is harmless.Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).
Trial
office-hours-pageBefore is
e838227(where this branch left main) and after iscaed395(fix/829-dev-workspace-isolation), both on theteamscenario, frompnpm dev trial.Each side gave the task to a fresh agent: after's
agentlauncher in the side's environment, Claude Code onclaude-sonnet-5-5as the scenario's publisher, with the side's release of the Patchy skill and no personal instructions or settings, run without a person within 30 turns and 10 minutes. The log keeps each tool call, commands with their exit codes, and one line per failure; not the agent's reasoning or what its commands printed. Redacted before writing: email addresses outside the scenarios' example domains; the accounts the run acts as.One run is a smell test, not a measurement.
Before answered: “The office hours page is published. Anyone signed in to the Acme Co account can open it: <origin>/acme/office-hours It's a table of Monday to Friday, 9:00 am – 5:00 pm.”
After answered: “The office hours page is published: <origin>/acme/office-hours Anyone signed in to your company (Acme Co) can open it. It isn't public.”
Before's log: 11 commands, 4 failures
After's log: 11 commands, 5 failures