Skip to content

feat(mcp): worker agents find their company's patches and open one - #884

Merged
allisonmahmood merged 2 commits into
mainfrom
mcp/852-find-open
Oct 23, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
mcp/852-find-open

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

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

What changed

A person's agent can now find their company's patches through Patchy's MCP and open one to see its agent tools. find_patches lists exactly the patches the person can open in the portal; open_patch answers one patch's own document. While the company's agent access is off, every tool call is refused and names the admins.

Closes #852

Look at

  1. Visibility reuses the portal's rule. Catalogue.visible is Patches.read({ state: "live" }) through Patches.Openability, the same call the portal's All patches makes, then one new query, Patches.agentToolSummaries, for the current versions' tool marks and words. It doesn't load whole manifests and starts nothing. apps/server/src/McpDoor.test.ts checks it against the portal's own rendered list. It publishes through the API across sharing scopes (company, public), lifecycle states (live, retired, deleted, operator-disabled), a deactivated owner and a second company. Then it compares /patches with find_patches for an owning admin, a non-owning admin, a member and a member who owns only off patches. Every listed patch opens. Every other one, by name, id or address, gets the same refusal, and searching its name finds nothing. Making the door list off patches fails it, and four catalogue tests.
  2. Choices within the spec's words, for Allison to see:
    • search matches when every word appears in the name, title, description or owner's name, ignoring case.
    • The cursor is base64url JSON { after: { tools, name, id }, search?, detail? }: a keyset position, so a publish or retire between pages never repeats or skips one. It carries its search and detail, so { cursor } alone continues a walk; a cursor sent with a different search or detail is refused invalid_args. A forged cursor only positions within the person's own list: pointing it at a hidden patch, another company's, or none gives the same page.
    • patch resolves an id first (ids never change), then a name through Patches.resolveName, so a former name follows its rename as the address does. An address must have this instance's origin and the person's company handle. Every miss is one not_found in the same words.
    • actingFor is { person, company }, each cut at 200 characters. A find page is measured as it grows, so its compact JSON never passes 100,000 characters; a patch whose tools alone would pass it (only a version that skipped the publish check could) is listed with their names, or without them. open_patch refuses too_large past 64 KiB, which only a version that skipped the publish check could reach.
    • The agent_access_off refusal names where an admin turns it on and the active admins by name, nothing else.
  3. Events gain patchRef, catalogueTotal, catalogueListed, catalogueEndedEarly, catalogueSearched, catalogueDetail and catalogueContinued, beside patchId, versionId and resultBytes. Never the search words or the cursor.

How it was verified

Real clients against a dev instance, transcripts

A pnpm dev up team environment (Acme Co: Ada Park, admin; Ben Ortiz, member) with deal-desk, a tier 2 patch whose agent/deals.ts exports listDeals and moveDeal, and 55 static pages, standup-week-01 to -55, all published by Ada. Every client ran as Ben from a temp dir outside $HOME, with only that invocation's MCP config. Tool results are cut to 220 characters here.

Claude Code 2.1.308 through real consent

claude --setting-sources project --strict-mcp-config --mcp-config ./mcp.json, then /mcp › Authenticate. A stub xdg-open on its PATH recorded the authorize URL instead of opening a browser. A headless Playwright browser signed in as Ben (/dev/[email protected]&return=<authorize>), saw the consent page below and pressed Allow:

consent <instance>/oauth/authorize — Connect Claude Code to Acme Co?
returned to http://localhost:63680/callback?code=…&state=…&iss=<instance>
Authentication successful | You can close this tab and return to Claude Code.

❯ /mcp
  ⎿  Authentication successful. Connected to patchy-dev-852.

Connect Claude Code to Acme Co? as Ben Ortiz

Then claude -p with the same config:

tool_use mcp__patchy-dev-852__find_patches({})
  -> {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/…
tool_use mcp__patchy-dev-852__find_patches({"cursor": "eyJhZnRlciI6eyJ0b29scyI6ZmFsc2UsIm5hbWUiOiJzdGFuZHVwLXdlZWstNDkiLCJpZCI6IjhwdXU4d3FqbXhzbSJ9fQ"})
  -> {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"standup-week-50","description":"Team standup notes for week 50: what shipped and what is next.","owner":"Ada Park","address":"<instance>/…
tool_use mcp__patchy-dev-852__open_patch({"patch": "deal-desk"})
  -> {"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/acme/deal-desk","tools":[{"name":"listDeal…
assistant: Acme Co has **56 patches**, and listing them took **2 pages**. I'm acting for Ben Ortiz.

- **Page 1:** 50 patches, which were `deal-desk` and `standup-week-01` through `standup-week-49`. It returned a `next` cursor.
- **Page 2:** 6 patches, `standup-week-50` through `standup-week-55`. It had no `next`, so that was the end.

That adds up to the server's reported total of 56: one `deal-desk` plus 55 weekly standup notes.

**Only one patch has agent tools: `deal-desk`**, owned by Ada Park. It tracks the sales team's open deals and moves them through stages. None of the 55 `standup-week-*` patches (also Ada Park's) have any agent tools, so I can't read or change them through Patchy. Ada Park would need to add tools for that.

### `deal-desk` tools

1. **`listDeals`** (read)
   - Lists the team's deals, newest first.
   - You can pass an optional `stage` to see only deals in that stage: `lead`, `proposal`, `negotiation`, `won` or `lost`.
   - Each deal comes back with its `id`, `company` (the customer), `stage`, `amount` (value in euros), `createdAt` and `updatedAt`.

2. **`moveDeal`** (change)
   - Moves one deal to a different stage and returns the updated deal.
   - It returns `null` if no deal has that id.
   - It needs both an `id` (taken from `listDeals`) and a target `stage` (same five options).
   - Any move is logged as Ben Ortiz, made through me.

I only opened the patch. I haven't listed any deals or moved anything.

With agent access turned off at Company by Ada:

tool_use mcp__patchy-dev-852__find_patches({})
  -> error: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admin is Ada Park; tell the person to ask them.
assistant: The `find_patches` call didn't list any patches. It returned an error. Here is the exact text:

> Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admin is Ada Park; tell the person to ask them.

Acme Co's agent access is turned off, so Patchy blocks every agent request until it's switched on. You'll need to ask Ada Park, Acme Co's admin, to turn it on at that URL. After that, I can run the call again and list the patches.

Claude Code's stored token for the dev server was cleared afterwards (/mcp › Clear authentication).

Codex 0.163.0 with a minted token

pnpm dev mcp-token ben --client Codex, then codex exec --ephemeral --ignore-user-config -s read-only -c 'mcp_servers.patchy.url="<instance>/mcp"' -c 'mcp_servers.patchy.bearer_token_env_var="PATCHY_MCP_TOKEN"'.

With agent access off, before Ada turned it on (on the first head, before the singular "admin is" fix):

agent: I’ll find the Patchy MCP tool and return its answer exactly.
mcp_tool_call patchy.find_patches({}) -> failed: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admins are Ada Park; tell the person to ask one of them.
agent: Agent access is off at Acme Co, so Patchy refuses every agent until an admin turns it on at <instance>/company. Acme Co's admins are Ada Park; tell the person to ask one of them.

On, at Codex's default revision (2025-06-18), asked: "Using the patchy MCP server: list every patch my company has, following next until there are no more pages. Tell me how many there are in all, how many pages it took, and which ones have agent tools. Then open the one with agent tools by its address and tell me what each of its tools does."

agent: I’ll use the Patchy tools to list every page of patches, then open the patch with agent tools and inspect what they do.
mcp_tool_call patchy.find_patches({}) -> completed: {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/…
mcp_tool_call patchy.find_patches({"cursor": "eyJhZnRlciI6eyJ0b29scyI6ZmFsc2UsIm5hbWUiOiJzdGFuZHVwLXdlZWstNDkiLCJpZCI6IjhwdXU4d3FqbXhzbSJ9fQ"}) -> completed: {"actingFor":{"person":"Ben Ortiz","company":"Acme Co"},"total":56,"patches":[{"name":"standup-week-50","description":"Team standup notes for week 50: what shipped and what is next.","owner":"Ada Park","address":"<instance>/…
mcp_tool_call patchy.open_patch({"patch": "<instance>/acme/deal-desk"}) -> completed: {"name":"deal-desk","description":"Track the sales team's open deals and move them through stages.","owner":"Ada Park","address":"<instance>/acme/deal-desk","tools":[{"name":"listDeal…
agent: The Patchy MCP connection is acting for **Ben Ortiz at Acme Co**. I followed `next` until it was absent: **56 patches across 2 pages** (50 + 6).

All patches are owned by Ada Park:

- **`deal-desk`** — the only patch with agent tools.
- **`standup-week-01` through `standup-week-55`**, inclusive — 55 standup patches with no agent tools.

I opened [deal-desk](<instance>/acme/deal-desk) by its address. Its tools are:

| Tool | Kind | What it does |
|---|---|---|
| `listDeals` | Read | Lists deals newest first, optionally filtered by stage. Returns each deal’s ID, customer, stage, value in euros, and creation/update timestamps. |
| `moveDeal` | Change | Takes a deal ID from `listDeals` and a target stage, moves the deal, and returns the updated record. Returns `null` if the ID doesn’t exist. |

Both tools accept these stages: `lead`, `proposal`, `negotiation`, `won`, `lost`.

With --enable mcp_2026_07_28 it made the same three calls, with the same answer.

The door's request events for the final runs

Status Client Era / version Method Tool Code or patchRef Catalogue
200 Codex legacy 2025-06-18 tools/call find_patches — Total=56, Listed=50, EndedEarly=False, Continued=False
200 Codex legacy 2025-06-18 tools/call find_patches — Total=56, Listed=6, EndedEarly=False, Continued=True
200 Codex legacy 2025-06-18 tools/call open_patch name —
401 — — — missing_token —
200 Claude Code modern 2026-07-28 server/discover — — —
200 Claude Code modern 2026-07-28 tools/list — — —
200 Claude Code modern 2026-07-28 server/discover — — —
200 Claude Code modern 2026-07-28 tools/list — — —
200 Claude Code modern 2026-07-28 tools/call find_patches — Total=56, Listed=50, EndedEarly=False, Continued=False
200 Claude Code modern 2026-07-28 tools/call find_patches — Total=56, Listed=6, EndedEarly=False, Continued=True
200 Claude Code modern 2026-07-28 tools/call open_patch name —
200 Codex legacy 2025-06-18 initialize — — —
202 Codex legacy 2025-06-18 notifications/initialized — — —
200 Codex legacy 2025-06-18 tools/list — — —
200 Codex legacy 2025-06-18 tools/call find_patches — Total=56, Listed=50, EndedEarly=False, Continued=False
200 Codex legacy 2025-06-18 tools/call find_patches — Total=56, Listed=6, EndedEarly=False, Continued=True
200 Codex legacy 2025-06-18 tools/call open_patch address —
200 Codex modern 2026-07-28 server/discover — — —
200 Codex modern 2026-07-28 tools/list — — —
200 Codex modern 2026-07-28 tools/call find_patches — Total=56, Listed=50, EndedEarly=False, Continued=False
200 Codex modern 2026-07-28 tools/call find_patches — Total=56, Listed=6, EndedEarly=False, Continued=True
200 Codex modern 2026-07-28 tools/call open_patch address —
200 Claude Code modern 2026-07-28 server/discover — — —
200 Claude Code modern 2026-07-28 tools/list — — —
200 Claude Code modern 2026-07-28 tools/call find_patches — Total=56, Listed=50, EndedEarly=False, Continued=False
200 Claude Code modern 2026-07-28 tools/call find_patches — Total=56, Listed=6, EndedEarly=False, Continued=True
200 Claude Code modern 2026-07-28 tools/call open_patch name —
200 Claude Code modern 2026-07-28 server/discover — — —
200 Claude Code modern 2026-07-28 tools/list — — —
200 Claude Code modern 2026-07-28 tools/call find_patches agent_access_off —

Release impact

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

No migration and no stored data: the catalogue only reads.

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: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 rounds (GPT-6.1-Sol, xhigh)

Round 1, on 26bbeac: nothing blocking, three should-fix findings, all fixed in 90262f1.

# Finding Outcome
R1.1 The find cap could be passed: the first entry skipped the check and actingFor.person had no bound, so a 100,000-character name returned 100,186 characters. Fixed. actingFor cuts the person's and company's names at 200 characters. An entry too large to fit alone is listed with only its tools' names, or with no tools. A new test covers a 100,000-character person and company name and 60 tools of 2,000 characters each, recorded past the publish check.
R1.2 open_patch loaded every visible patch's tool summaries and used none of them. Fixed. visible returns rows only; withTools loads summaries for find_patches alone. open_patch resolves against rows and loads one manifest.
R1.3 The decoders enforce lengths that tools/list didn't advertise, so schema-valid input could get invalid_args. Fixed. Tools.SEARCH_CHARS, CURSOR_CHARS and PATCH_CHARS feed both the decoders and the advertised maxLength (and minLength: 1 on patch). Door.test.ts asserts them.
note The portal comparison didn't cover a live patch denied through Openability. Covered. A new catalogue test narrows Patches.Openability and checks find, total, and open by name, id and address.

Also fixed after the Codex run: one admin is named as one ("Acme's admin is Ada Lovelace; tell the person to ask them.").

Round 2, on 90262f1: PASS, nothing blocking and no new findings. It checked R1.1–R1.3, the six threat areas (visibility through search, cursors, total, ordering and refusal wording; cross-instance and cross-company addresses; cursor tampering; both caps; catalogue cost and never starting a patch; the agent access refusal), the mirrored surfaces and the Effect service conventions. 95 targeted tests passed.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS

Checked 90262f1a8b6a47a2952c06c54632a208c65d93f2 (stacked base 26e2aef4ac988190eeabfacf23f7aa832cf276a6, #883) on a fresh brightline instance, by GPT-6.1-Sol (xhigh) in the Codex harness on T3 Code. The fixture adds one agent query to New Business and 51 static pages: 55 patches altogether.

Done means

  • Real clients find, page and open: passed. Claude Code 2.1.309 completed real browser consent as Jordan; Codex 0.163.0 used minted dev tokens. Both completed member and admin walks: 50 + 5 unique patches, then no cursor, and opened new-business by address or name. Codex exercised legacy and modern revisions. Each opened document exposed listDeals as a read with its argument and result schemas.
  • Visibility matches the portal: passed. Independent requests compared /patches with both MCP pages for the owner/admin and member: exactly 55 names each. The passing whole-server test additionally compares owning/non-owning admins and members across company/public scope, live/retired/deleted/disabled patches, a deactivated owner and another company. Every listed entry opens; excluded entries have identical refusals by name, id and address and disappear from search. The narrower Openability test passed too.
  • Access off names the admins: passed. Every one of the four tool calls refused agent_access_off for member and admin, naming Allison Mahmood; tools/list still returned four tools. Both real clients surfaced the refusal without reconnecting. Switching on again let the same connection list all 55 patches.

Golden journeys

  • Find and open a tool: passed. Jordan's Home search found Kudos and opened its working frame; New Business opened with its seeded pipeline (12 open deals). The MCP walks above found and opened the agent area.
  • Publish/lifecycle: passed. The pinned repo CLI published the agent-tool fixture. CLI retire/delete removed a static page from find/search and made open refuse; restore brought it back each time.
  • Share and unshare: passed. The signed-out kickoff reader received 200 when public and 401 after company scope was restored.
  • Tier 1/2 live behavior: passed in checked-head CI. The browser suite and packed tier 2 journey are green. These full journeys were not repeated locally.

Other risks: passed. The local catalogue/door/shaper/patches/server suites exercised keyset pagination across publish/retire, detailed-page caps, the 64 KiB open cap, bad arguments, forged cursors, search privacy, current-version tool summaries, former-name resolution and foreign-address refusals. Catalogue code reads metadata/manifests without invoking Runtime.

pnpm exec vitest run packages/mcp packages/api/src/agentTools.test.ts \
  packages/patches/src/Patches.test.ts apps/server/src/McpDoor.test.ts

Test Files  7 passed (7)
     Tests  114 passed (114)

All 14 PR checks passed on the checked head, including Node 22/24/26 tests, CLI, concurrency and live Clerk. Full-suite validation uses those CI results rather than a duplicate local pnpm verify run.

Independent real-client transcript (sanitized)
Real-client calls against the checked head; only scenario data below.
Claude Code 2.1.309, Jordan/member, real consent:
  find_patches -> total 55, page 50, next present; next -> page 5, no next.
  open_patch -> new-business; listDeals (read), closed args schema, deal-row result schema.
Codex 0.163.0, Jordan/member, minted token, legacy:
  find_patches -> total 55, page 50, next present; next -> page 5, no next.
  open_patch -> new-business; listDeals (read), closed args schema, deal-row result schema.
Claude Code 2.1.309, Jordan/non-owning admin, same consent connection:
  find_patches -> total 55, page 50, next present; next -> page 5, no next.
  open_patch -> new-business; listDeals (read), closed args schema, deal-row result schema.
Codex 0.163.0, Allison/admin, minted token, modern:
  find_patches -> total 55, page 50, next present; next -> page 5, no next.
  open_patch -> new-business; listDeals (read), closed args schema, deal-row result schema.
Claude Code with agent access off -> refused; names Allison Mahmood and Company; no reconnect requested.
Codex modern with agent access off -> refused; names Allison Mahmood and Company; no reconnect requested.

Consent displayed “Connect Claude Code to Brightline Studio?” as Jordan Lee. After Allow, Claude Code reported “Authentication successful. Connected to patchy-acceptance-884.”

Independent HTTP/CLI checks
owner/admin: portal = MCP = 55 patches; pages 50+5; agent tools first.
member: portal = MCP = 55 patches; pages 50+5; agent tools first.
Resolution/search: name opens; foreign instance/company/missing return not_found; owner+name search and malformed cursor behave correctly.
retire: absent from find/search; open refuses not_found.
restore: listed and opens again.
delete: absent from find/search; open refuses not_found.
restore: listed and opens again.
Share/unshare: signed-out kickoff reader gets 200 when public, 401 after company scope is restored.
Agent access off: all four calls refuse agent_access_off and name Allison Mahmood, for member and admin; tools/list still returns four tools.
Agent access on again: the same connection immediately lists all 55 patches.

Rollback answers: match the diff. There is no migration, data rewrite/deletion or infrastructure change. The catalogue only reads; turning access on/off uses fields already present on the base. Reverting returns the two catalogue tools to not_built, with existing data still readable by #883. No one-way label is needed. rollback-rehearsal is green; this diff does not trigger its migration rehearsal.

Surfaces: shared tool/wire shapes and API docs, dev-loop guidance, MCP vocabulary and reverse states apply and are covered. No new CLI flags/exit codes, migration, company-database caller, served-page implementation or package-layout change.

Not run: none of #852's required dev-instance acceptance checks were skipped.

@allisonmahmood allisonmahmood mentioned this pull request Oct 23, 2026
Base automatically changed from mcp/851-door to main October 23, 2026 15:15
find_patches lists the live patches the person can open, starting from
the portal's own read and openability rule: those with agent tools
first, then by name, up to 50 a page and ending early under the
100,000-character read cap. Its opaque cursor carries the find's search
and detail, and search matches every word in the name, title,
description or owner. detail: "tools" adds each tool's kind and words.

open_patch answers a patch's own document through the shared shaper,
within 64 KiB. patch is an id, a name (a former one follows its rename)
or an address on this instance under the person's company; anything
else, a patch they can't open included, is one not_found refusal.

Every tool call is refused agent_access_off, naming the active admins,
while the company's agent access is off. Bad arguments are invalid_args
tool results. Catalogue calls read manifests only, through a new
Patches.agentToolSummaries, and request events gain the catalogue
fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…h's tools, and the tools advertise their limits

A find's actingFor cuts the person's and company's names at 200
characters, and a patch whose tools alone would pass the read cap is
listed with their names, or without them, so no page passes 100,000
characters. open_patch resolves against the visible patches without
loading every patch's tool summaries. tools/list advertises the length
limits the catalogue enforces, from one set of constants. One admin is
named as one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 9d8ac4e into main Oct 23, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the mcp/852-find-open branch October 23, 2026 15:32
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
… agents you've connected (#885)

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

## What changed

Your machines now opens with how to connect an agent: a tab per agent
(Claude, Claude Code, Codex, ChatGPT, Another agent), each a plain link,
showing only that agent's steps with Patchy's address in a copy line.
Below it, the person's agent connections are listed beside their
machines. Each shows its client and site, when it connected and was last
used, and Disconnect. A connection unused for a week says when it ends
on its own and that a reconnect leaves it behind. "Revoke all machines"
becomes **Disconnect everything**, under "Lost a laptop?", and it shows
even when nothing is listed.

Closes #853

## Look at

1. **Release notes: the rename.** Production's button says "Revoke all
machines"; from this release it says **Disconnect everything** and ends
agents too. It is now always on the page, so an approval nobody has
collected can still be cancelled. The What's new entry for the stack's
release should name the rename. The form still posts to
`/machines/revoke-all`, the route the rollback rehearsal presses.
2. **Choices within the spec's words:**
- With no `?agent=`, or an unknown one, the Claude tab is open. Tab
links carry `#connect-an-agent`, the id the card's "Connect your agent"
link (#845) lands on.
- Codex's first step holds both commands as copy lines. Claude Code's
`/mcp` stays inline code, because it's typed inside Claude Code.
- ChatGPT gets no menu path, only "Only some ChatGPT plans can add
custom connectors."
- Step 3 is a generic "Ask for something", not a patch-specific example.
- A connection never called says Last used "Not yet". The leftover line
counts from the last call, or from connecting when there was none. Its
"ends on its own" date comes from the new `AgentConnections.list`, using
the same SQL as the 30-day ending itself, so the two can't disagree.
- Dates carry the year ("13 Oct 2026"), as the mock does; the spec's
example drops it.
- The reverse state is said once, in the Agents intro: "A disconnected
agent can't be brought back: connecting it again makes a new
connection."
- The page moved out of `DevicePages.ts` into `MachinesPage.ts`. Device
login keeps its own module.

### Your machines, access on

A member with a fresh Claude Code connection, made through consent, and
a week-unused one from before a reconnect (minted with `pnpm dev
mcp-token`, its last use moved back in the dev database):

![Ben, access on, two
agents](https://github.com/user-attachments/assets/3e26ca07-581b-4a19-a1b3-875c08009cec)

An admin with a machine and an agent (minted with `pnpm dev mcp-token`,
so its site is the dev host); then the same page after Disconnect
everything, with both lists empty and the button still there:

| Before Disconnect everything | After |
| --- | --- |
| ![Ada, access on, a machine and an
agent](https://github.com/user-attachments/assets/b3f237ac-c6ef-450d-931e-e622e713cc2c)
| ![Ada after Disconnect
everything](https://github.com/user-attachments/assets/81ef39e4-8765-4ec9-8a30-ac0f7a5c5f8e)
|

### Access off, as a member and as an admin

| Member: the admins are named | Admin: Turn it on at Company |
| --- | --- |
| ![Ben, access
off](https://github.com/user-attachments/assets/947e9907-9164-4e4b-916b-5a3aea52e0f0)
| ![Ada, access
off](https://github.com/user-attachments/assets/c52c99bd-41c9-476a-9929-997a8ccf4e6b)
|

### Phones (390 px)

| Member, two agents | Admin, Codex tab | Member, access off | Admin,
access off | After Disconnect everything |
| --- | --- | --- | --- | --- |
|
![](https://github.com/user-attachments/assets/ec97febb-991e-461c-ae4c-134dc82721c7)
|
![](https://github.com/user-attachments/assets/d86faaa5-08b5-4a6a-991d-a59ebe677454)
|
![](https://github.com/user-attachments/assets/6c5e5ad2-3021-407b-9510-9e100b1a00f4)
|
![](https://github.com/user-attachments/assets/14dbc471-0ff8-4c4c-a619-3f592c31fc87)
|
![](https://github.com/user-attachments/assets/f7fa62c9-a58e-4618-95b9-22035d96b4f0)
|

No page scrolls sideways at 390 px. None logged a console error.

## How it was verified

**Done means, with a real Claude Code (2.1.308)** against `pnpm dev up
team` on this branch. The run used a throwaway `CLAUDE_CONFIG_DIR` in a
temp dir outside `$HOME`, so `~/.claude.json` and `~/.claude/` gained
nothing. Consent was driven in a throwaway Playwright context signed in
as Ben (member), with agent access turned on at Company by Ada.

<details><summary>Connect, see it listed, disconnect, 401</summary>

The command came from the Claude Code tab's copy line. `claude mcp
login` is the CLI form of `/mcp` › Authenticate, since the interactive
TUI can't run here.

~~~text
$ claude mcp add --transport http patchy
http://<env>.localhost:<port>/mcp
Added HTTP MCP server patchy with URL: http://<env>.localhost:<port>/mcp
to local config
$ claude mcp login patchy --no-browser
Visit this URL to authorize:
http://<env>.localhost:<port>/oauth/authorize?…&client_id=https%3A%2F%2Fclaude.ai%2Foauth%2Fclaude-code-client-metadata…
(Ben, in the browser: the consent page, then Allow →
http://localhost:<port>/callback?code=…&state=…&iss=…)
Authenticated with "patchy". Its tools are now available in Claude Code.
$ claude mcp get patchy
  Status: ✔ Connected
~~~

Your machines, as Ben: `Claude Code CLAUDE.AI · Connected 22 Oct 2026 ·
Last used just now · Disconnect`. Ben pressed that row's Disconnect, and
the next call failed:

~~~text
$ claude mcp get patchy
  Status: ! Needs authentication
~~~

The server's events for Claude Code's requests, in order:

| Request | Status | Code | |
| --- | ---: | --- | --- |
| POST /oauth/token | 200 | | code exchange |
| POST /mcp | 200 | | `server/discover` |
| POST /mcp | 200 | | `tools/list` |
| POST /mcp | 401 | `invalid_token` | after Disconnect |
| POST /oauth/token | 400 | `invalid_grant` | its refresh, after
Disconnect |

</details>

- `MachinesPage.test.ts`, through the page's routes over a migrated
database:
  - each tab's own steps and copy lines, with no inline script;
  - an unknown `?agent=` opening Claude;
- access off naming the admins (an escaped name) to a member, and
offering an admin "Turn it on at Company";
- the person's own agents only, with "Not yet" and the leftover line on
the week-unused one alone;
- Disconnect ending that connection's next call and nobody else's, and
404 for someone else's connection;
  - machines (moved from `DevicePages.test.ts`);
- Disconnect everything shown with nothing listed, ending both kinds,
and leaving both lists empty.
- `AgentConnections.test.ts`: `list` returns live connections only,
newest first, with `endsAt` 30 calendar days after the last call, or
after connecting.
- `DevicePages.test.ts`: a cross-origin or origin-less POST to
Disconnect is refused 403 and leaves the connection working.
- `pnpm verify` passed on 8153299: 2,244 tests and 81 browser tests,
"All passed."
- Rollback rehearsal: CI's check skips itself because no migration
changed. This PR changes the page the rehearsal presses
(`form[action="/machines/revoke-all"]`), so it was run locally against
`e4243ff`, a `main` commit with #837 and #838: "Exercised rollback paths
passed: e4243ff → 8153299 → e4243ff → 8153299".
- Review: GPT-6.1-Sol, two rounds (comment below). Round 1's one
should-fix, the server skill not saying where people connect, is fixed
in 8153299. Round 2 found nothing.

## Release impact

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

No migration, no API change; one new read (`AgentConnections.list`) and
one new page route.

- **What does a revert leave behind?** Nothing stored. The page goes
back to machines only, with "Revoke all machines" shown only while a
machine is listed. Disconnects already made stay made.
- **Does the release before it still work with that?** Yes. The routes
it keeps are unchanged, and the stack ships as one release.

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

<!-- patchy-dev:compare:member -->

#### Before and after, as Ben Ortiz (member)

Before is `90262f1` (where this branch left mcp/852-find-open) and after
is `f72f04e` (mcp/853-your-machines), both on the `team` scenario, from
`pnpm dev compare`.

Every page answered 200 with no browser errors.

##### `/machines`

**1280px, after**

![After: /machines at
1280px](https://github.com/user-attachments/assets/abc921b6-78f6-46fe-a197-9465d218b80b)

<details><summary>1280px, before</summary>

![Before: /machines at
1280px](https://github.com/user-attachments/assets/ab3942ae-59e4-4308-9d99-1eab2bf089db)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /machines at
390px](https://github.com/user-attachments/assets/c613dd26-56bf-4ffa-8d68-90a511252f75)
| ![After: /machines at
390px](https://github.com/user-attachments/assets/7cba4975-3400-4fdc-bea2-d0c69f2d28a5)
|

<!-- /patchy-dev:compare:member -->

<!-- patchy-dev:compare:admin -->

#### Before and after, as Ada Park (admin)

Before is `90262f1` (where this branch left mcp/852-find-open) and after
is `f72f04e` (mcp/853-your-machines), both on the `team` scenario, from
`pnpm dev compare`.

Every page answered 200 with no browser errors.

##### `/machines`

**1280px, after**

![After: /machines at
1280px](https://github.com/user-attachments/assets/b53fcf66-6623-4dcb-8cea-54bdaf3c09f2)

<details><summary>1280px, before</summary>

![Before: /machines at
1280px](https://github.com/user-attachments/assets/9559bbe8-d4e5-4893-aae5-520ec7cc5a66)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /machines at
390px](https://github.com/user-attachments/assets/e1e5f0c4-dc21-4d3e-a949-ca2ca4ab9fab)
| ![After: /machines at
390px](https://github.com/user-attachments/assets/69058d44-a2e2-4511-b9c7-ac1baec2104d)
|

<!-- /patchy-dev:compare:admin -->
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: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.

Worker agents find their company's patches and open one

1 participant