Repository navigation
feat(mcp): builder agents call their agent tools locally with patchy dev agent - #875
Conversation
Review: GPT-6.1-Sol (xhigh), two roundsRound 1, on 117315e: one blocking finding, four should-fix and two nits.
Round 2, on c76773f: nothing blocking, two should-fix.
Separately, a5d8e33 fixes CI's typecheck. The Effect language service refuses |
04f3206 to
3a49456
Compare
0790e3c to
cdd420b
Compare
Acceptance: PASS with notesChecked Done means
Selected CLI evidenceColleague page before the calls: The same open page after both people's mutation and action calls: Additional risks
Golden journeys
Validation Local Rollback answers: match the diff. This layer adds a CLI command and local daemon route, with no migration or production data-format change. A revert leaves no new persistent production state requiring Not run
Notes
All instances, patch sessions and browser tabs started for this run were removed. The PR's code, branch, body and labels were left unchanged. |
3a49456 to
a89e676
Compare
cdd420b to
9c97a47
Compare
a89e676 to
fa5e9ea
Compare
… dev agent`
`patchy dev agent` prints what open_patch would answer for the running
dev binding, and `patchy dev agent <tool> [<json>|-]` calls one tool the
way Patchy MCP's door would: through Runtime's agent invocation, as the
primary dev viewer or the colleague with --colleague, with ctx.agent
{ name: "patchy dev" }. Pages open on the dev URLs update live, and the
company's agent access switch doesn't apply.
Each dev mount answers a nonce-guarded POST /~dev/agent as its own
person. The daemon checks the tool and its arguments against the version
it runs, mints a change's key (a mutation's becomes its mutation key,
kept by a retry of an unknown outcome) and never retries an action.
Answers take the door's shapes from packages/api, which gains the
unknown_tool, invalid_args and runtime refusals and the call answer the
door will share. Each answer names the server build that gave it, and
says when a failed rebuild left the last good one answering.
Exit codes follow ADR-0004: 0 for a result, 2 for any refusal the door
would give (its failure document adds from, details and
retryAfterSeconds), 1 for local problems, 3 when a started call gets no
usable answer. README, ADR-0004, DEVELOPMENT, the dev-loop skill and the
patchy-server and patchy-loop skills say how to use it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…code, and Patchy's refusals say what to do A patch may name its refusal patch_retired, which matched the CLI's lifecycle refusal first and lost from, details and retryAfterSeconds; the door's refusal now matches before any instance refusal. invalid_args names the tools the patch has now, as a publish between calls may have changed the schema. Patchy's runtime refusals name the correlation id their message points to, and an action that timed out or whose outcome is unknown says it may have partly happened. A failed rebuild now records the build that was serving, so a newer build installing ends the stale warning in the same step. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Effect language service refuses JSON.stringify in the CLI, which failed CI's typecheck; the indented text answer now comes from a module-level Schema encoder. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…happened A read-only action can't write, so its timeout no longer asks for a new change key; and Runtime's own timeout code, from a callback's deadline inside an action, now gets the warning beside handler_timeout and unknown_outcome. Co-Authored-By: Claude Opus 5.5 <[email protected]>
9c97a47 to
3b82274
Compare
Stacked on #875 (ticket #844); merges with the rest of #833's stack, not alone. ## What changed Nothing on a patch's card said what someone's own agent could do with it. Now the card of a live patch whose current version has agent tools shows **What agents can do** beside its Overview: each tool in `open_patch`'s order, its name in code with a Reads or Changes tag, its description opening in place, then "Connect your agent". With agent access off, a note naming the admins takes the connect link's place, and an admin also gets "Turn it on at Company". A patch without agent tools looks as it does today. Closes #845 ## Look at ### The card with agent tools The brightline scenario's new-business card, its version 2 published with an `agent/` folder that re-exports four of its handlers with descriptions. Before this PR the card looks like new-business in the before-and-after below: no panel. **Access on, as Jordan (member), with `addNote` opened**  **Access off, as Jordan (member):** the note names the admin in place of Connect your agent.  <details><summary>Access off, as Allison (admin): "that's you" and Turn it on at Company</summary>  </details> **Phones:** the panel drops below the card. | On, member | Off, member | Off, admin | | --- | --- | --- | |  |  |  | Playwright full-page captures of this worktree's `brightline` environment at `2821ae1`. The head `31862c3` is that commit restacked onto the stack below as it moved, so it renders the same. `pnpm dev compare` can't show these states: it starts from fresh scenario data, and scenario patches get agent areas only in #859. ### A card without agent tools looks as it does today <!-- patchy-dev:compare:jordan --> #### Before and after, as Jordan Lee (member) Before is `c76773f` (where this branch left mcp/844-dev-agent) and after is `2821ae1` (mcp/845-card-agent-panel), both on the `brightline` scenario, from `pnpm dev compare`. Every page answered 200 with no browser errors. ##### `/patches/new-business` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/patches/kudos` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /patchy-dev:compare:jordan --> ### Choices worth a look - **Where the panel sits.** As in mock C, `card-split` puts the panel beside the whole card on the Overview tab only, top-aligned with the breadcrumb; below 960 px it drops under the card. `card-split` is the one new shell piece (`packages/core/src/html.ts`, `ui-consistency`); everything else composes `side-panel`, `list-compact` rows with `details`, `tag`, `note-warn` and `btn`. - **Access off drops the connect link.** Connecting is refused while access is off, so the off note takes "Connect your agent"'s place rather than sitting beside a link that dead-ends. The spec's line for the card now says so. An admin's note says "that's you" and carries "Turn it on at Company" (`/company#agent-access`). - **"Connect your agent" links to `/machines#connect-an-agent`**, which #853 builds; until then the link lands on Your machines' top. The spec's card line now names the anchor so #853 uses it. - **Which tools:** the current version's, through #842's `agentTools`, so a rollback to a version without tools removes the panel. Retired and deleted cards have none. ## How it was verified - `PortalPages.test.ts` › *what agents can do on a socket*: a member, owner and admin each see the tools in `open_patch`'s order (page handlers left out, a read-only action as Reads), escaped descriptions and the connect link; the panel is absent on Versions; with access off a member sees the admins named and no links, an admin sees "you" and Turn it on. A second test keeps the card unchanged for a tier 2 patch without agent tools, a tier 0 page, a patch rolled back to a version without tools, and a retired patch. - `pnpm exec vitest run packages/portal packages/core packages/auth/src/CompanyPage.test.ts`: 196 passed. - `render.test.ts` › `renderAgentPanel`: each tool's kind and escaped description, the connect link while on; while off, several admins named with the viewer first as "you", escaped company and admin names, and Turn it on only for an admin. - Desktop and phone captures above, both access states, member and admin. - `pnpm verify` on `31862c3`: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, tier2-smoke and browser passed. Under load from other lanes' runs (load average about 14), two CLI tests outside this diff timed out at 30 s, `cliRepoBuild.test.ts` and `cliRepoDescriptions.test.ts`; both files pass run alone (18 tests). - Rollback rehearsal against `main`'s `e4243ff`, which has #837 and #838: `pnpm test:rollback-rehearsal --live e4243ff` passed e4243ff → 31862c3 → e4243ff in 159 s. - CI on `31862c3` is green. `clerk-live` was re-run once after the runner's Ubuntu mirror stalled during `apt` and the job was cancelled before any test ran. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required: a panel on a page, with no schema, API, CLI or configuration change. - **What does a revert leave behind?** Nothing: no migration, no stored rows, no new route. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).
## 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]>


Stacked on #873 (ticket #844); merges with the rest of #833's stack, not alone.
What changed
In the skill test, no builder agent could call its own agent tools before publishing, so each told its person the tools were untested. Now
patchy dev agentlists a patch's tools as a worker agent sees them, andpatchy dev agent <tool> [<json>|-]calls one the way Patchy MCP's door will, against the runningpatchy devsession, as the dev viewer or the colleague (--colleague). Open dev pages update live.Closes #844
Look at
1. One call path, the door's shapes (
packages/patchy/src/devAgent.ts,packages/api/src/agentTools.ts). Each dev mount answers a nonce-guardedPOST /~dev/agentas its own person. The daemon reads the binding once, checks that the tool exists and that its arguments fit the schema on that version, and callsInvocation.callAgent(#843) withctx.agent{ name: "patchy dev" }. A change gets a fresh key: a mutation's becomes its mutation key, which the daemon reuses on a retry ofunknown_outcome. An action is never retried. Answers come from the shared module, which gainsunknownToolRefusal,invalidArgsRefusal,runtimeRefusalandcallAnswer, so the door (#854) shows agents the same words. The agent access switch is never read.2. The CLI contract (
devLifecycle.ts,CliError.ts, ADR-0004). These follow the ticket's exit codes:from,detailsandretryAfterSeconds.not_running,no_agent_tools, or arguments that aren't one JSON object.3. Naming the binding (
devServer.ts,devResources.ts). Server builds are counted per session, and a call'sversionis its build.dev.lognow saysServer build N ready. When the latest rebuild failed, the answer says the last good build answered, inwarningsunder--json.A live run on this worktree's dev instance, with a starter tier 2 repo and two tools in
agent/notes.ts:The colleague's dev page was open throughout. Before and after
patchy dev agent addNote '{"title":"Book the venue for Friday"}'ran as the primary viewer, with no reload in between:How it was verified
devAgent.test.tsruns on supervised workerd and PGlite, throughDevResourcesaspatchy devbuilds it. It checks:open_patch's answer;ctx.agentand the person;invalid_argsandunknown_tool(the page's own handler isn't a tool), andhandler_failed;no_agent_toolsfor tier 2 without tools and for tier 1.cliDevAgent.test.tsruns the bundled CLI against a stub daemon. It checks the request, both outputs,-and--colleague, the stale build, and exits 0, 2 (withfrom,details,retryAfterSeconds), 1 (arguments,no_agent_tools,not_running) and 3 (a 500, an unreadable reply).pnpm dev, including the open page.agentTools.test.tscovers the shared refusals andcallAnswer.devServer,devServerWatch,devExecution,devLifecycle,devLogand all ofpackages/apipass.pnpm typecheck:testsand eslint pass, anddocs/API.mdis re-rendered.pnpm verifyon cdd420b passes all nine steps: format, lint, typecheck, synth, test (2,090 tests), postgres-concurrency, cli-smoke, tier2-smoke and browser. CI is green on cdd420b.clerk-livehit its 10-minute job cap twice on slow runners and passed on the third run.pnpm test:rollback-rehearsal --live dd3f41fpasses. dd3f41f is themaincommit with Tier 2 readers accept handler descriptions, read-only actions and agent tools, and enforce them #837 and Deactivation and Disconnect everything end pending device logins and record when a person's credentials ended #838; the run was dd3f41f → cdd420b → dd3f41f. This PR adds no migration.Release impact
A new CLI subcommand and a new route on the local dev daemon. It adds no migration and no instance route. The one changed log line is
Server binding ready→Server build N readyindev.log, and nothing parses it.Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).