Skip to content

feat(dev): environments come with worker agents, and brightline's tier 2 patches have agent areas - #894

Merged
allisonmahmood merged 4 commits into
mainfrom
mcp/859-dev-worker-agents
Oct 23, 2026
Merged

allisonmahmood merged 4 commits into
mainfrom
mcp/859-dev-worker-agents

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #892 (ticket #858); merges with the rest of #833's stack, not alone.

What changed

A dev environment had only a builder agent, so trying a patch's agent area meant hand-building a client config each time, and the environment's own CLI couldn't publish a tier 2 repo at all. Now pnpm dev up puts two worker agent launchers beside agent: worker-claude (Claude Code, connecting through consent) and worker-codex <person> (Codex, with a connection minted by pnpm dev mcp-token). Neither loads your instructions, skills, plugins or config, and both reach Patchy only through /mcp. brightline starts with agent access on, and New Business and Spend Requests have agent areas that keep their rules.

Closes #859

Look at

1. The launchers' isolation, in scripts/dev/src/environment.ts (writeWorkers). Both start in the environment's own workers/ folder behind the builder's guard (PATCHY_API_URL is the instance, the shell's PATCHY_API_TOKEN is cleared) with a CLI state that never logs in and a temp folder per session.

  • Claude Code: --setting-sources project, the builder's claudeMdExcludes for every folder above the environment, --strict-mcp-config with one server, auto memory off, --permission-mode default. Its sign-in can only live in your ~/.claude/.credentials.json, keyed by the server's name and address, so the server name is patchy-dev-<hash of the worktree path>: one entry per worktree address, replaced by the next sign-in there. down leaves it, because your running Claude Code sessions rewrite that file when they refresh and a second writer could drop a refresh and sign you out. DEVELOPMENT says so and how to clear it (/mcp › Clear authentication).
  • Codex: CODEX_HOME is the environment's, with a config.toml naming only the door and turning off the account's apps, plugins and remote_plugin (without that, the TUI listed my ChatGPT connectors, 217 tools, and a plugin from my account). HOME is the session's temp folder, because Codex reads skills from ~/.agents/skills whatever CODEX_HOME says. Your login is linked in; Codex writes auth.json in place through the link (checked with codex login --with-api-key on a throwaway home), so a refresh lands in your one file as another session's would. The token reaches Codex's environment only: the config excludes PATCHY_MCP_TOKEN from the commands Codex runs and turns shell snapshots off (Sol's round 1 found both leaking it; a command inside Codex printed env | grep -c '^PATCHY_MCP_TOKEN=' → 1 before, 0 after, with no snapshot under CODEX_HOME).

What Codex sees, from worker-codex jordan debug prompt-input, which renders the model's prompt without a model call:

skill roots: ['<env>/worker-state/codex/skills/.system']
"agents/skills": 0   "~/.codex": 0   personal instructions: 0   token: 0

What the Claude worker reports, worker-claude -p --model haiku:

skills:        dataviz, update-config, keybindings-help, code-review, simplify, … (Claude Code's bundled ones; its code-review is the bundled one, not mine)
instructions:  NONE
MCP servers:   patchy-dev-04bc0n

2. The env CLI publishes tier 2, a separate commit (fix(cli)). The CLI resolved workerd beside its own install, so the environment's bin/patchy (and any global patchy) failed every tier 2 publish and patchy dev. A tier 2 repo pins the exact workerd the CLI checks for, so publish and the dev runtime now run the repo's own, as they already run its vite and tsc. startWorkerd/Inspection take an optional workerdFrom; the server never passes it.

# before (base), in <env>/workspace/new-business
$ patchy publish --json
{"ok":false,"error":"Could not inspect the server bundle. Its modules must load and export only valid handlers.","kind":"local","code":"invalid_manifest"}
# after
$ patchy publish --json
{"ok":true, …, "versionNumber":2, "warnings":[]}
$ patchy dev --json        → {"ok":true,"url":"http://127.0.0.1:<port>/dev/…"}
$ patchy dev agent listRequests '{"status":"submitted"}' --json
{"result":{"total":0,"requests":[]},"version":1}

3. brightline's agent areas reuse the patches' rules rather than restating them: move, addNote, team.people, approve and reject are re-exported from server/ with descriptions added there; addLead and submitRequest are tools of their own, with the shared insert moved to helpers/leads.ts and helpers/requests.ts. addLead requires a next step, which the page leaves optional; submitRequest takes no receipt, so the patch's own receipt_required stops anything from $500. listDeals and listRequests answer 50 at a time with total and next, which from continues (checked with 55 requests: 50 + next 50, then 5 + next null). The seed turns agent access on as the publisher only while nobody has touched the switch, so turning it off at Company survives restarts.

Done means: Codex adds a lead to New Business through /mcp

pnpm dev up brightline, then <env>/worker-codex jordan exec --skip-git-repo-check --json -c '…change_patch.approval_mode="approve"' "Add a lead to New Business: Lumen Labs wants a website refresh, a referral from their CEO. Next step: intro call on Tuesday. Leave the value and owner empty." < /dev/null. Results cut.

agent: I'll find New Business and add Lumen Labs with the referral and next step, leaving value and owner empty.
find_patches {"search":"New Business"}  → {"actingFor":{"person":"Jordan Lee","company":"Brightline Studio"},"total":1,"patches":[{"name":"new-business",…,"tools":["addLead","addNote",…]}]}
open_patch {"patch":"new-business"}     → {"name":"new-business",…,"tools":[{"name":"addLead","kind":"change",…}]}
change_patch {"patch":"new-business","tool":"addLead","key":"lumen-labs-website-refresh-20261023",
  "args":{"title":"Website refresh","client":"Lumen Labs","source":"Referral","service":"Website","nextStep":"Intro call on Tuesday"}}
                                        → {"result":{"id":"01a165b6-…","stage":"lead","owner":null,"value":null,…},"version":2}
change_patch {"tool":"addNote","args":{"deal":"01a165b6-…","note":"Referral from Lumen Labs' CEO."}} → {"result":{…,"kind":"note"},"version":2}
agent: Added Lumen Labs — Website refresh to New Business as a lead, with a CEO referral note and "Intro call on Tuesday" as the next step. Value and owner are empty.

The patch's log, as its owner (patchy logs --limit 2 in the repo):

… · v2 · agent.addNote (mutation) · success · 84 ms · Jordan Lee via Codex
… · v2 · agent.addLead (mutation) · success · 471 ms · Jordan Lee via Codex

A patch rule, met through the door (Codex as Jordan, "move the Lumen Labs website refresh to Proposal"):

change_patch {"tool":"moveDeal","args":{"deal":"01a165b6-…","stage":"proposal"}}
  → {"code":"needs_value_and_owner","from":"patch","details":{"stage":"proposal","missing":["value","owner"]}}

Interactive too: worker-codex marcus, then "Which deals are in Negotiation in New Business?" called find_patches, open_patch and read_patch, and /mcp listed only patchy-dev-04bc0n and Codex's built-in codex_worktrees.

Done means: the Claude Code launcher connects through consent

<env>/worker-claude --model haiku in a terminal, /mcp › patchy-dev-04bc0n › Authenticate. Its browser URL was answered as Jordan in a throwaway Playwright browser (personas sign-in, then Allow):

Consent as Jordan

❯ /mcp
  ⎿  Authentication successful. Connected to patchy-dev-04bc0n.
❯ In Spend Requests, which requests are waiting for a decision? Approve the smallest one that someone else submitted, with the note: fine by me.
  (Claude Code asked before each call; each answered Yes)
  find_patches {search: "Spend Requests", detail: "tools"} · open_patch {patch: "spend"} · read_patch {tool: "listRequests"}
  change_patch {tool: "approveRequest", args: {id: "01a165b0-…", note: "fine by me"}, key: "approve-saltwater-hotel-priya-2026-10-23"}
● I approved the smallest pending request that someone else submitted: Priya Shah's hotel for the Saltwater site visit (2 nights), $438.20, with the note "fine by me."
  … I skipped the two you submitted yourself (the $2,850 photographer and the $1,800 copywriter), since approving your own request isn't allowed.

How it was verified

  • Neither launcher reads your instructions or touches ~/Patchy. Over all the runs above: ~/Patchy's listing is unchanged; ~/.codex/config.toml and ~/.codex/AGENTS.md hash the same and ~/.claude/settings.json and ~/.claude/CLAUDE.md keep their mtimes; no token-shaped string (pw[ar]_…) appears anywhere in the environment folder or .local/dev, dev.log included; no Codex or Claude process with the environment's paths outlived its session. What the runs did add outside the environment: Claude Code's patchy-dev-04bc0n sign-in in ~/.claude/.credentials.json, and its trust of <env>/workers in ~/.claude.json, both Claude Code's own writes.
  • scripts/dev/src/environment.test.ts: the Claude launcher's guard, worker CLI state, its one server and the excludes; the Codex launcher mints for the named person in this worktree, hands the token only to Codex (the launcher prints nothing of it), runs on its own CODEX_HOME and HOME, links your login, drops a stale link when you have none and leaves the login alone when started from a shell already on that home, writes the door, the apps/plugins switches, the snapshot switch and the token's shell exclusion into config.toml, and starts no Codex when minting fails.
  • scripts/dev/src/scenario.test.ts: seeding brightline turns agent access on as the publisher, and a later off survives a reseed. Red without each half of the seed change.
  • packages/execution/src/Inspection.test.ts: inspection runs the workerd where it's told, and refuses one of another version found there. Red with the resolver reverted.
  • Both agent areas typecheck and publish with no warnings; their 9 tools are listed in publish's handlers.
  • pnpm verify on 33b5445: everything passed except test/browser-tier1/csv.spec.ts (instance-side inspection timed out at load ~15); it passed alone, and CI's browser job passed on the same head.
  • Targeted: vitest run scripts/dev packages/execution/src/Inspection.test.ts packages/patchy/src/devServerWatch.test.ts, 104 passed; turbo typecheck of execution, the CLI and the dev runner; tsc -p tsconfig.test.json; eslint and prettier on the changed files.
  • Not exercised: Claude Code's own consent in a real browser of yours (Playwright answered it), and macOS.
  • The vitest template is unchanged: it applies applyDevSeed, which this doesn't touch; the scenario seed isn't part of it.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

Dev tooling, scenario data and docs, plus one CLI fix: a patchy installed outside a tier 2 repo now builds it with the repo's pinned workerd instead of failing. No schema, API or wire change.

  • What does a revert leave behind? Environments already up keep the worker launchers until their next up; Claude Code sign-ins already made stay in that developer's credentials file, harmless. A global CLI goes back to refusing tier 2 repos.
  • Does the release before it still work with that? Yes. Nothing it reads changes.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:xl Over 1,000 changed lines; review in multiple passes labels Oct 22, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Review: GPT-6.1-Sol (xhigh), two rounds

Round 1 (on 33b5445): 1 blocking, 2 should-fix, 1 qualification.

  1. Blocking: Codex could persist the minted token. Codex 0.163 hands token-named variables to the commands it runs and snapshots their shell under CODEX_HOME. Confirmed on a real session: a command inside Codex counted PATCHY_MCP_TOKEN (1) and a snapshot existed during the session. Fixed in 50f3ab9: [shell_environment_policy] exclude = ["PATCHY_MCP_TOKEN"] and shell_snapshot = false. The same check then printed 0 and 0, and find_patches still answered through the door.
  2. Should-fix: worker-codex from a shell already on the environment's CODEX_HOME linked auth.json onto itself. Fixed with an -ef guard; a test covers it, red without the guard.
  3. Should-fix: listDeals and listRequests stopped at 50 with no continuation and read only 1,000 rows. Fixed: both page through every row, count every match in total, and return next for from. Checked by hand with 55 requests: 50 and next: 50, then 5 and next: null. No committed test: scenario patches run only inside a dev environment's repos, and the repo has no harness for their handlers (Sol agreed in round 2).
  4. Qualification: Claude Code keys its sign-in by server name and configuration. Fixed: the docs and comment say the entry is keyed by name and address.

Round 2 (on 50f3ab9): nothing blocking; round 1's fixes confirmed; 2 should-fix.

  1. Inherited BASH_ENV/ZDOTDIR could still load the developer's shell startup files past the session's HOME. Fixed in 1019d93: the launcher clears BASH_ENV, ENV and ZDOTDIR before Codex starts.
  2. An inherited SHELLOPTS=xtrace made bash print the minted token on stderr. Fixed: set +x before minting. The Codex launcher test now runs with SHELLOPTS=xtrace, BASH_ENV and ZDOTDIR set and asserts that stderr carries no token and Codex sees neither variable. It is red without each fix.

Round 2 also confirmed, for the standing questions: the door and the minting stay on this checkout's instance and database; only auth.json is shared with the developer's Codex state; no normal path puts the token in the card, files or logs; leaving Claude Code's sign-in in the shared credentials file after down is sound. It flagged again that ordinary CLI commands can follow another checkout's .local/dev/env, which #829 documented in DEVELOPMENT.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 1019d936230f4af3b75b5db283ce4682fc310c77 (base fbc2de39a86c63d604d361a1a41fbc9779c73463, the stacked PR's base) on fresh brightline data in a throwaway checkout, by GPT-6.1-Sol (xhigh) in the Codex harness on T3 Code.

Done means

  • Codex adds a lead through /mcp: passed. The generated worker-codex jordan called find_patches, open_patch, then change_patch/addLead. New Business returned Acceptance Lantern Labs / Website refresh in lead, with owner: null, value: null, and nextStep: "Intro call on Tuesday". The lead also appeared on the open board.

  • Claude Code connects through consent: passed. Started the generated launcher, chose Authenticate, signed in as scenario Jordan, and clicked Allow in the browser. Claude reported Authentication successful. Connected to patchy-dev-<worktree>. A subsequent worker session found Spend Requests, opened it and called read_patch/listRequests successfully.

  • Personal instructions and workspace isolation: passed. Codex's rendered prompt contained none of the personal instruction phrases or personal skill roots; Claude's init listed only the worktree MCP server, its four tools and bundled skills. Claude reported no personal/project instruction files. Hashes of the personal Codex config/instructions and Claude settings/instructions, and the ~/Patchy listing, were unchanged. Codex's child shell printed only:

    PATCHY_MCP_TOKEN=0
    BASH_ENV=0
    ZDOTDIR=0
    

    No shell snapshots or token-shaped credentials were found in the environment or instance files. The launcher tests also passed the inherited xtrace/startup-variable checks. Cleared this run's Claude MCP authentication after checking it.

Golden journeys

  • Publish a tier 2 repo: passed. The environment's installed CLI published New Business as version 2 with warnings: []; patchy dev started successfully, and patchy dev agent listDeals '{}' --json returned {"result":{"total":0,"next":null,"deals":[]},"version":1} over the local runtime.
  • Find and open a tool: passed. Jordan searched Home for kudos and opened the result in its frame.
  • Tier 1 live tool: passed. Jordan sent kudos to Priya; the message appeared on Priya's already-open page without reloading.
  • Tier 2 live tools and rules: passed. Jordan created a deal through the page, moved it Lead → Discovery → Lead, and Allison's open board followed both moves. A page-created spend request appeared live for Allison. MCP refused self-approval/rejection, a $500 request without a receipt, non-admin approval of a large request, an empty next step, an unknown owner, Proposal without value/owner, and unauthorized closed-stage moves. A colleague approved $499.99; an admin approved the large request and could mark a deal Lost and reopen it. Replaying a lead's change key returned the same lead.

Additional risks checked

  • Both agent lists continued beyond 50: deals returned 50 + 5, total 55; requests returned 50 + 21, total 71, including all 55 inserted requests, with no duplicate IDs.
  • Turning agent access off refused calls with agent_access_off and named Allison. It stayed off after stopping and restarting with pnpm dev up brightline; turning it back on restored calls.
  • Targeted tests: 15 files, 104 tests passed (scripts/dev, execution inspection, and CLI dev-server watching).
  • CI on this head: lint, all three Node test jobs, both CLI smoke jobs, tier 2 smoke, Postgres concurrency, Clerk live, image and rollback rehearsal passed. The browser job was still running at this verdict.

Rollback answers: match the diff. No migration, wire-format change or destructive data operation is introduced. Existing launcher files and Claude authentication are the documented leftovers; the previous code can still read the data. The rollback rehearsal passed. No additional one-way label is needed for this PR's diff.

Not run

  • macOS launchers: this acceptance machine is Linux.
  • Full local pnpm verify: used the targeted suites, direct journeys and head CI above; the browser CI result remains pending.

Notes

  • No behavioral defect found. This verdict is relative to the stacked base, not approval to merge this layer independently of its stack.
  • Browser CI must finish successfully before calling the PR ready to merge.

@allisonmahmood
allisonmahmood force-pushed the mcp/859-dev-worker-agents branch from 1019d93 to b4dba65 Compare October 23, 2026 02:09
@allisonmahmood allisonmahmood mentioned this pull request Oct 23, 2026
Base automatically changed from mcp/858-agent-idle to main October 23, 2026 16:58
… it with the repo's workerd

The CLI resolved workerd beside its own install, so any patchy that isn't the
repo's pinned one, such as a dev environment's or a global install, failed
every tier 2 publish and `patchy dev` with invalid_manifest "Could not inspect
the server bundle". A tier 2 repo pins the exact workerd the CLI checks for,
so publish and the dev runtime now run the repo's own, as they already run its
vite and tsc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r 2 patches have agent areas

`pnpm dev up` writes two worker agent launchers beside the builder `agent`:
`worker-claude`, Claude Code connecting through consent, and
`worker-codex <person>`, Codex with a connection minted by
`pnpm dev mcp-token`. Both start in the environment's own `workers/` folder
behind the builder's guard, with a CLI state that never logs in, a temp folder
per session and only the environment's door as their MCP server. Neither loads
the developer's instructions, skills, plugins or config: Claude Code runs on
project settings only, with ancestor instruction files excluded; Codex runs on
the environment's CODEX_HOME, with the account's apps and plugins off, and the
session's temp folder as HOME, its login linked in.

brightline turns its company's agent access on in its seed, once, and New
Business and Spend Requests gain agent areas that keep their rules: list
deals, add leads that say what happens next, move deals and add notes; list
spend requests, submit ones that need no receipt, approve and reject.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…line lists continue past 50

Codex 0.163 hands token-named variables to the commands it runs and snapshots
their shell to disk, so the worker's PATCHY_MCP_TOKEN reached its shell and a
snapshot under CODEX_HOME for the session's life. The worker's config now
excludes the variable from shell environments and turns shell snapshots off.
Starting worker-codex from a shell already on the environment's CODEX_HOME no
longer links its login onto itself. listDeals and listRequests read every row,
count every match and return `next`, which `from` continues. The docs say
Claude Code keys its sign-in by the server's name and address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tup files

An inherited SHELLOPTS=xtrace made bash print the minted token on stderr, and
BASH_ENV, ENV and ZDOTDIR point shells at the developer's startup files past
the session's own HOME. The launcher turns tracing off before minting and
clears those variables before it starts Codex.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the mcp/859-dev-worker-agents branch from b4dba65 to 9375347 Compare October 23, 2026 16:58
@allisonmahmood
allisonmahmood merged commit fecac16 into main Oct 23, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the mcp/859-dev-worker-agents branch October 23, 2026 17:19
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
…896)

Stacked on #894 (ticket #859); merges with the rest of #833's stack, not
alone.

## What changed

The [skill test on the
prototype](#740 (comment))
shaped `patchy-server`'s "The agent area", but it couldn't exercise the
`agent/` folder, read-only actions, change keys, `patchy dev agent` or
the result caps. This repeats it on the stack's own build. There were
six builder runs, Claude Sonnet 5.5 and Opus 5.5 on the same three
requests, and a Sonnet 5.5 worker agent used each published patch
through `/mcp`.

Every builder made a working agent area from the skills alone, and every
worker task succeeded. Three things in the text were wrong or missing,
and the skill now fixes them:

- It never said publish warns when agent access is off. All six builders
told their person an admin still had to turn it on, though it was
already on.
- The result-size facts sat at the end of a long section. One Sonnet
builder read the section in pieces, stopped before them, and shipped an
unpaged read.
- It had dropped the spec's fact that clients decide whether to ask
before a change.

Closes #860

## Look at

**1. The three edits**, all in
`packages/sdk/skills/patchy-server/SKILL.md` › The agent area. The
section goes from 708 to 825 words. The last two rows came after
acceptance (see below). The global skill and `patchy-loop` are
unchanged, so `skills-lock.json` is too.

| Was | Now | Why |
|---|---|---|
| "Agent access is a company switch, off until an admin turns it on at
`<instance>/company`." | "Agent access is a company switch an admin
turns on at `<instance>/company`; a publish with agent tools warns while
it is off, and says nothing when it is on." | All six builders told
their person that an admin had to turn agent access on, and all three
Sonnet builders wrote a literal `<instance>/company`. Access was already
on, and publish (`PatchesApi.agentAccessWarnings`) warns only while it
is off. The fact they were missing was how to tell. |
| The limits paragraph opened with "300 calls a minute … Read results
over 100,000 characters are refused, so large reads need paging. The
agent reads every result in full; a row result carries `id`, `createdAt`
and `updatedAt` …" | Those facts now follow "The ids it holds come from
earlier results or from the person." in the descriptions-and-schemas
paragraph, now reading "A read result over 100,000 characters is
refused, counting every row's text in full: 50 rows holding 2,000
characters of text each reach it. A read that grows with its table, in
rows or in text, needs paging." The limits paragraph keeps in-flight
calls, the first call's wait, `retryAfterSeconds` and change keys. |
Claude Code saves a long `cat` to a file and shows only a preview. Opus
read the saved file whole, but Sonnet read line ranges. `sonnet-r1` read
lines 340–400 of the skill and stopped at the end of the descriptions
paragraph, one paragraph before the result facts. Its `listCalls`
returns up to 1,000 whole rows with no paging, at about 370 characters a
row. That passes 100,000 characters at around 270 logged calls. In the
prototype, a facts-only Sonnet run also returned whole rows. |
| (none) | "A refusal reaches the agent with its code and details only
as a `HandlerError` whose code is in `errors`; anything else a tool
throws is `handler_failed`, with its message left in the patch's log." |
The second acceptance's Sonnet validated with a plain `throw new
Error(...)`. Its worker got a bare `handler_failed` with a correlation
id instead of the entry-by-entry refusal its description promised.
"Results and failures" says undeclared codes become `handler_failed`,
but the agent area never said a plain throw hides its message from the
agent. The other five Sonnet builds, four of mine and the first
acceptance's, all used a declared `HandlerError`. The descriptions
paragraph is now split in two: what an agent knows, then the build
rules. |
| (none) | "To agents, a query or read-only action is a read and
anything else is a change, so Postgres and PostHog reads count as reads
only from a read-only action. Clients decide whether to ask the person
before a change, and most ask every time." | The spec's "What the skills
say" lists both facts for this section, and the stack's text had dropped
them; the connection-read fact survived only in "Choose a kind", where
both sales builders found it. No builder tripped on their absence. It
restores facts the spec requires (the connection-read half came from
Sol's review). |

**2. The runs.** Each run records the ticket's list. Kinds are what
`open_patch` reports. Sizes are UTF-8 characters of the door's answers.

| Run | Tier | Agent tools (kind) | Says what it does / changes / when
it refuses | List tool | Stricter than the page, in the schema | Result
sizes | `patchy dev agent` before publish | Turns · min · $ |
|---|---|---|---|---|---|---|---|---|
| sonnet-r1, call log | 2 from `init` | `listCalls` (read), `logCalls`
(change), both re-exported from `server/` | Yes / yes / yes
(`invalid_calls`: all or nothing, by position; duplicates skipped) |
`logCalls`, up to 100 calls | No | `open_patch` 3.1 K; `logCalls` 57.
**`listCalls` returns up to 1,000 whole rows, unpaged** | Yes: listed
tools, logged a batch, sent a bad date, filtered | 34 · 2.2 · 0.46 |
| sonnet-r2, loans | 2 from `init` | `listAvailableEquipment` (read),
`lendEquipment` (change), its own | Yes / yes / mostly (`already_out`
and the date are said; `no_such_item` isn't) | No | **Due date
required**, as `YYYY-MM-DD` text; the page's is optional | `open_patch`
2.7 K; list 866 (5 whole rows); loan 296 | Yes: missing, invalid and
blank dates | 35 · 2.4 · 0.52 |
| sonnet-r3, sales | 2 from `init` | `salesSummary` (read), a
**read-only action** re-exported from `server/` | Yes / reads only /
declares `bad_range` but doesn't say when | n/a | n/a | `open_patch` 2.6
K; summary 1.5 K (top 10, fixed) | Yes: last month, last quarter, a
reversed range | 33 · 3.3 · 0.56 |
| opus-r1, call log | 2 from `init` | `findCustomerCalls` (read),
`logCustomerCalls` (change), `updateFollowUp` (change), its own | Yes /
yes / yes, with codes | `logCustomerCalls`, up to 200 calls | No |
`open_patch` 7.1 K; log 506; **reads page 50 rows with a cursor**, about
23 K a page | Yes, as both viewers: a batch, its resend, bad entries,
200 calls | 64 · 5.8 · 2.64 |
| opus-r2, loans | 2 from `init` | `listFreeEquipment` (read),
`recordLoan` (change), its own | Yes / yes / yes, every code | No |
**Due date required**, as `YYYY-MM-DD` text; also refused for agents in
the shared helper | `open_patch` 2.1 K; list 471 (compact); loan 180 |
Yes, as both viewers: no date, 2026-02-30, an item already out | 45 ·
5.4 · 1.74 |
| opus-r3, sales | 2 from `init` | `salesSummary` (read), its own
**read-only action** beside the page's | Yes / "Read-only." / yes
(`invalid_range`) | n/a | n/a | `open_patch` 5.9 K; summary 2.0 K (top
1–50) | Yes, as both viewers: periods, edges, bad ranges | 45 · 4.6 ·
2.17 |

Across runs:

- **Tier.** All six ran `patchy init --tier 2` first. The prototype's
Sonnet started the call log at tier 1, before the global tier line said
agents need tier 2.
- **`patchy dev agent`.** Every builder called its own tools before
publishing. The three Opus runs also called them as the colleague.
- **Asking.** No builder asked first. All six built, then listed their
choices in the report.
- **Change keys.** Both call logs also skip duplicate calls themselves,
so a resent day is safe even with a new key.
- **`ctx.agent`.** Builders tag agent writes (sonnet-r1, sonnet-r2,
opus-r1, opus-r2) and log agent reads with `ctx.log` (both sales runs).
- Two runs (sonnet-r2, opus-r2) also refuse `ctx.agent` in page handlers
no tool exports. No agent reaches those, and Opus called it a backup. It
does no harm, so I left the text alone.
- opus-r1 also `ctx.log`s its own changes, which Patchy logs already.
That's one run in six, against two of eight in the prototype; no edit.
- **Outside this text:**
  - opus-r1 cast a call id read as `t.text()`; that's #832.
- sonnet-r2 couldn't add rows in dev without a browser, so it never
tested a successful loan. opus-r2 drove its dev page instead.

**3. The worker checks.** Each was a Sonnet 5.5 worker from the
environment's `worker-claude`, signed in as Ben (a member) through
consent, with no built-in tools. The task named the patch.

| Run | Task | Door calls | Result |
|---|---|---|---|
| sonnet-r1 | Log a day of 8 pasted calls | `find_patches`,
`open_patch`, `change_patch` | All 8 in one `logCalls`, relative
follow-ups resolved |
| opus-r1 | Same | `find_patches`, `open_patch`, `change_patch` | All 8
in one `logCustomerCalls` |
| sonnet-r2 | Borrow the camera until Friday; which laptops are free? |
`find_patches`, `open_patch`, `read_patch`, `change_patch` | Loan due
2026-10-30, using the id from the list; three laptops named |
| sonnet-r2 | Mark my camera returned | `find_patches`, `open_patch` |
Declined: no tool for it, so it pointed to the page and the owner |
| opus-r2 | Borrow the camera until Friday; which laptops are free? |
`find_patches`, `open_patch`, `read_patch`, `change_patch` | Same as
Sonnet's |
| opus-r2 | Mark my camera returned | `find_patches`, `open_patch` |
Declined, same as Sonnet's |
| sonnet-r3 | Revenue by region in September 2026 and the top three
customers | `open_patch`, `read_patch` | Matches SQL over the source
exactly: $313,425.00, five regions, top three |
| opus-r3 | Same | `open_patch`, `read_patch` | Same figures; also
reported the refunds it left out and the pending orders it counted |

Every worker needed nothing outside the door. The ids it used came from
the patch's own list. It said how it read "Friday" (the 30th, a week
out). Twice, Claude Code itself answered the first `open_patch` with "No
such tool available" before loading the tool; that was the client, not
Patchy.

## After acceptance

The [first acceptance
run](#896 (comment)),
at df79c67, was a **FAIL**. Acceptance's Sonnet built the call log's
read as up to 200 whole rows with no cursor, and its handler accepts
summaries of up to 2,000 characters. With 58 such valid calls the read
was `too_large` (120,012 characters).

95ea886 then made two facts concrete: that the cap counts every row's
text, with 50 rows of 2,000 characters reaching it, and that publish
says nothing when access is on. Sonnet ran request 1 twice more on that
text:

- **retest-a** stopped before building. It saw the signed-in account's
email, which Claude Code puts in its context, differ from the CLI's
login, and started a login handoff. That came from the launcher's
environment, not the text.
- **retest-b** read the whole agent area and built `findCalls`: the
newest 100 whole rows with no cursor, summaries capped at 1,000
characters, and "Returns at most 100." in its description. After 300
realistic calls (about 100-character summaries), the read returned 100
rows in 38,684 characters. At 100 summaries near their 1,000-character
maximum it would pass 100,000. On access, it said publish gave no
warning, "so it may already be on".

Stating the facts doesn't get Sonnet to size a read for its longest
valid rows. The chief of staff's call, which Allison can overturn, is
that the text stays facts with no recipe sentence. Builder reads that
pass the cap under worst-case rows are a known limitation tracked in
#897, with the candidate fixes listed there.

The [second
acceptance](#896 (comment)),
at 95ea886, was also a **FAIL**, on a different defect in its Sonnet
call log. Validation used a plain `throw`, so a worker sending an
impossible date got `handler_failed` and a correlation id, not the
refusal the description promised. The `too_large` check passed as the
#897 limitation: the refusal named the cap and the owner, and said
paging is the fix. Everything else passed, including the worker tasks,
change keys, consent and endings, the access switch and the rehearsal.
The refusal fact above is the fix.

The [third
acceptance](#896 (comment)),
at 0ce7c1c, is a **PASS with notes**. It classified each defect in a
generated patch as a fact gap in the text or a builder slip despite the
fact. It found no fact gap and no Patchy defect. Sonnet's batch mutation
now refuses a bad date with its declared code (`invalid_call`, `from:
patch`, with the entry's index and reason). The builder slips it noted:

- Sonnet's read is still unpaged, which is #897. Patchy's `too_large`
names the cap and the owner, and says paging is the fix.
- Sonnet's batch mutation returns every inserted row. Sixty calls with
2,000-character summaries passed the 64 KiB mutation-result limit the
skill states, and failed as `handler_failed`. Batches of 20 succeeded.
- Sonnet still told its person an admin had to turn access on, though
its publish showed no warning.

## How it was verified

**Method.** Both phases ran on this branch at 33b5445, with each model
on a fresh `pnpm dev up` (`team`, so no other company's patches beside
them). Ada (admin) turned agent access on and connected
`postgres/orders`. That's a throwaway database in a non-production Neon
project: 40 invented customers and 1,500 invented orders, read through a
new read-only role. The instance accepts only public TLS sources, so a
local Postgres couldn't stand in.

- **Builders.** `<env>/agent -p --model claude-{sonnet,opus}-5-5
--no-session-persistence "<request>"`. That's the launcher's isolation
from #829 (no ancestor instruction files, no memory,
`--strict-mcp-config`). A probe found only the workspace's `CLAUDE.md`,
the Patchy skill and Claude Code's built-in skills. To match the
prototype, I added its extra allowed commands: `cd`, `cp`, `mv`, `curl`,
`echo`, `sleep`, `timeout`, `chromium`, `python3` and `sed`. Two
builders ran at a time, R1 and R2 together, then R3.
- **Requests**, the prototype's own minus "in this folder", since the
workspace's `CLAUDE.md` says where:
1. "Make a patch where our team logs customer calls: who called, the
customer company, a short summary and a follow-up date. People's agents
should be able to log calls for them; they'll often paste in a whole day
of call notes at once. Publish it when it works."
2. "Make a small patch for equipment loans. People borrow laptops,
cameras and mics and give them back. Our agents should be able to see
what's free and record a loan for their person, but an agent must always
give a due date, which people can leave blank. Only a person can mark
something returned. Publish it when it works."
3. "Make a patch that summarises our sales from the company's order
database: revenue by region and by product for a date range, and the top
customers. People's agents should be able to get the same summary for
their person, say for last month or a quarter. Publish it when it
works."
- **Seeding.** Before each loans worker check, I added the prototype's
five items through the patch's own page as Ada.
- **Sizes.** `open_patch` was recorded through the door with a minted
connection.
- **Aborted run.** The first sonnet-r3 run was stopped partway when the
machine was needed for a demo, then rerun from scratch. The aborted run
published nothing.

**Safety.**

- Every publish went to the local instance.
- **`~/Patchy` and `~/.patchy`.** I checked both before the first run
and around each run. Each run's before and after listing of `~/Patchy`
(outside `node_modules`) matched.
- Over the whole session, one new repo bound to production appeared, and
`~/.patchy`'s skill copy was rewritten. Both happened at 01:10–01:14,
during the pause for the demo, while none of my runs was going.
- TypeScript's files inside `~/Patchy`'s `node_modules` changed size
during one run. They are hard links into the shared pnpm store, which
another install's Effect language-service patch rewrote.
- **Neon.** The Neon database and role were dropped at the end, and the
catalogue shows neither.
- **Transcripts.** Claude Code put the signed-in account's email in
builders' and workers' context, and several repeated it. Nothing here
quotes a transcript unscrubbed.

**Tests.**

- `vitest run packages/limits/src/limits-md.test.ts
packages/patchy/src/skillLock.test.ts` passed (the generated limits
block and the global skill's lock), and so did `vitest run
packages/sdk/src`, which includes generation.
- Prettier passes.
- `pnpm verify` passed at 50d7d63: format, lint, typecheck, synth, test,
postgres-concurrency, cli-smoke, tier2-smoke and browser. 05c35d5 adds
one sentence to the skill. I re-checked it with the limits and lock
tests and Prettier, and CI is green on it.

**Not done.** The edited text wasn't put through a second round of
builders; the ticket's scale is two models × three requests. All three
edits add or move facts the runs showed were missing; none removes one.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Skill text only: the project skill a tier 2 repo gets at `init`,
`refresh` and dev start.

- **What does a revert leave behind?** Repos that refreshed in between
keep the new text until their next refresh.
- **Does the release before it still work with that?** Yes. Nothing
reads the skill but agents.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and
accepted by GPT-6.1-Sol (xhigh).
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
## What changed

This PR adds release 17's What's new entry, written from `5dd94f3`. It
covers everything merged since release 16's `through` (`dd3f41f`), and
it sets the `patchy` release to `0.17.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`. With this release,
people's agents can use their company's patches through Patchy MCP
(#833).

| Change | PRs |
| --- | --- |
| New: Your AI agent can use your company's tools | #873, #878, #880,
#881, #882, #883, #884, #886, #887 |
| New: Admins choose whether agents can use the company's tools | #871 |
| Improved: Your machines shows your agents too (Revoke all machines is
now Disconnect everything) | #885, #879 |
| New: See what agents can do with a tool | #876 |
| New: The log says when an agent made a change | #888 |
| New: Your agent can make a tool ready for agents | #869, #870, #872,
#875, #896 |
| Behind the scenes: agents' calls have their own limits, and a server
only an agent uses rests a minute after its last call | #889, #892 |
| Behind the scenes: New and Improved changes are public, for
patchyhq.com | #893 |
| Behind the scenes: library updates | #899 |

Five merged PRs get no line:
- #874 is release 16's own entry.
- #894 is dev tooling: worker agent launchers and scenario data. Its one
CLI fix lets a `patchy` installed outside a tier 2 repo publish it. The
skills have agents use the repo's pinned `pnpm patchy` instead, so that
path is off the documented one.
- #900 is CI.
- #901 rewords an internal skill.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- It names only Claude Code and Codex. Both have connected through real
consent against dev instances. Hosted clients (Claude.ai, ChatGPT) are
checked in production only (`docs/product.md` › Patchy MCP ›
Acceptance).
- Its labels are the pages' own: Agent access on Company, Your machines,
What agents can do, Disconnect everything, and "Jordan Lee via Claude".
- **Rollback safety, from the live commit `e4243ff` to `5dd94f3`.**
- No PR in the range is labelled `one-way`, and every PR answers both
Release impact questions with "Yes".
  - Migrations 0020–0025 are all additive:
    - three defaulted or nullable columns on `companies`;
- `agent_name` on the runtime log, with a widened `credential_kind`
check;
    - the agent connection tables, `agent_consents` and `change_keys`;
    - two columns on execution bindings.

The new tables reference `users` without a cascade, but no release
deletes users or companies. Release 16 reads the runtime log only for
credential kinds it knows, so rows from agents can't break it.
- `rollback-rehearsal` on #892 rehearsed the whole stack, since #892
adds the last migration and the rest of the stack sits below it:
`Exercised rollback paths passed: e4243ff → c8bede4 → e4243ff → c8bede4,
in 238s.` #896's run skipped, because it changes no migration or handler
descriptor.
- #883 turns on the load balancer's host header preservation, which the
Deploy workflow's app stack deploy applies. A rollback leaves it on.
That's harmless, because release 16's server never reads `Host`.
- A rollback takes `/mcp` and `/whats-new.json` away. Connected agents
get a 404 until this release returns, and then their connections work
again, unless one ended in between. Agent tools published in between
stay refused to pages, because #837 already shipped in release 16.

## How it was verified

- `pnpm check` on `2d528b1`: format, lint, typecheck and synth passed.
In the test step, 2,300 of 2,301 tests passed. The one failure was
`packages/sdk/src/install.test.ts` › "says how to reach patchy when the
prefix's bin is not on PATH", which timed out at 180 s while the shared
machine was loaded. Rerun alone, that file passes all 7 tests in 62 s.
The release's own tests pass too: `whatsNew.test.ts`, `schemas.test.ts`
and `WhatsNewPages.test.ts`.
- The live commit was pinned from `/healthz/deep`: `e4243ff`, release
16. The Deploy run updated last succeeded, and none is unfinished.
- Each PR in the range was read with `gh pr view`, including its Release
impact answers.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

This PR changes only the changelog text and the `patchy` version. As
with every release, a CLI installed before this deploy is told to
upgrade.

- **What does a revert leave behind?** Nothing. People whose seen marker
reached 17 would just see no new release.
- **Does the release before it still work with that?** Yes.

If this release misbehaves, roll back to
`e4243ff54d2acbbc88b60eeb0cf9b82a26dc9d5d` (release 16).

Prepared by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev environments come with worker agents and patches that have agent areas

1 participant