Skip to content

feat(companies): admins turn agent access on and off at Company - #871

Merged
allisonmahmood merged 2 commits into
mainfrom
mcp/841-agent-access-switch
Oct 23, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
mcp/841-agent-access-switch

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

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

What changed

Every Patchy MCP call will need the company's agent access on, and until now there was no switch. Company now ends with an Agent access section: an On or Off tag, who made the latest change and when ("Turned off by Priya Shah on 12 Oct 2026"), a paragraph, and for admins one button, Turn on or Turn off, with no confirmation. Members see the same state and stamp without a button: "Connect yours on Your machines" when it's on, the admins' names when it's off. It starts off for every company, new or existing.

Closes #841

Look at

1. The switch lives on the company row (0020_agent_access): agent_access_on defaults to false, and agent_access_changed_by/_at hold the latest change, null together for the starting Off. Companies gains agentAccess, setAgentAccess and holdAgentAccess. A change is one UPDATE … WHERE agent_access_on <> $on, so asking for the state it already has changes nothing and reports nothing. Each real change reports agent_access.changed with on, after it commits.

2. The lock #849 shares. holdAgentAccess reads whether the switch is on, FOR SHARE of the company row. Inside a transaction, a change waits for the holder, and the holder waits for a change in flight and then reads what it committed. It returns the switch alone: a read that waited re-reads only the locked row, so a joined stamp could come back stale (Sol's round 1). Code issuance and the code exchange call it, so an exchange never acts on an "on" an "off" already replaced. The same row lock serializes it with deactivation, which locks the company row FOR UPDATE. Companies.test.ts › "makes a change wait for a holder of agent access, and a holder wait for a change" shows both directions on Postgres, waiting for a session the holder blocks; without the FOR SHARE it times out.

3. The page and route. POST /company/agent-access with state=on|off, same-origin, admins only. A member's POST is the page's existing 403, and a malformed state is a 422 alert. It redirects to /company#agent-access, so the admin lands back on the section at the foot of the page. Screenshots and a short film:

The admin's Company page, before and after (Ada, team):

Before and after, as Ada Park (admin)

Before is f76fecf (where this branch left mcp/840-agent-folder) and after is 7eeba59 (mcp/841-agent-access-switch), both on the team scenario, from pnpm dev compare.

Every page answered 200 with no browser errors.

/company

1280px, after

After: /company at 1280px

1280px, before

Before: /company at 1280px

Width Before After
390px Before: /company at 390px After: /company at 390px

A member's (Ben):

Before and after, as Ben Ortiz (member)

Before is f76fecf (where this branch left mcp/840-agent-folder) and after is 7eeba59 (mcp/841-agent-access-switch), both on the team scenario, from pnpm dev compare.

Every page answered 200 with no browser errors.

/company

1280px, after

After: /company at 1280px

1280px, before

Before: /company at 1280px

Width Before After
390px Before: /company at 390px After: /company at 390px

Turning it on and off as the admin, head only:

Flow agent-access, as Ada Park (admin)

After is 7eeba59 (mcp/841-agent-access-switch), on the team scenario, from pnpm dev film.

  • After: finished in 9.6s
after.mp4

How it was verified

  • vitest: Companies.test.ts covers a new company starting Off with no stamp, on and off stamped with who and when (under TestClock), a repeated state leaving the stamp alone, unknown companies, and the hold in both directions. CompanyPage.test.ts covers the four page states, the redirect, the events, a stale Turn on from a second admin, the 422, and /company/agent-access in the member-refusal and Origin cases. Also apps/server/src/migrations.test.ts, the companies suite, AuthPages, DevicePages and serving's Pages.
  • Typecheck (build plus tsconfig.test.json) and lint.
  • pnpm verify on e3ecce3: 8 of 9 steps passed. The test step had 14 timeouts in 9 files this PR doesn't touch (CLI repo builds, SDK, fleet, PGlite) while the machine's load was above 30. Rerun alone, all 9 passed (137 tests), and CI's three test jobs passed.
  • Rollback rehearsal against main dd3f41f, which has 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: pnpm test:rollback-rehearsal --live dd3f41f gives Exercised rollback paths passed: dd3f41f → e3ecce3 → dd3f41f, in 470s. CI's run against production's d77baaf fails only in step 3, on the agent-area patch production can't serve, the gate Build Patchy MCP #833 documents. Its upgrade step, which applies 0020_agent_access, passes.

Release impact

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

An additive migration: three columns on companies, defaulted or null. Nothing reads the switch yet; the door and consent (#849 onward) will.

  • What does a revert leave behind? The three columns, and a latest change on companies an admin switched.
  • Does the release before it still work with that? Yes. It never selects the columns, and every insert it makes takes their defaults.

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 area:ui Portal and first-party browser pages, shared rendering and styles size:m 100-500 changed lines labels Oct 22, 2026
@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from 7eeba59 to d6421bf Compare October 22, 2026 09:01
@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from d6421bf to b8ec35d Compare October 22, 2026 09:14
@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from 1ac249c to c00413f Compare October 22, 2026 09:27
@allisonmahmood

Copy link
Copy Markdown
Owner Author

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

Round 1 (head d6421bf): nothing blocking.

  • Should-fix, fixed in 1ac249c. holdAgentAccess read FOR SHARE OF c with a LEFT JOIN users. A read that waits on a change re-fetches the locked company row but not the joined user. Sol reproduced it on Postgres: a fresh switch came back with latest: null. Issuance and the exchange need only the switch, so holdAgentAccess now returns the boolean, from SELECT agent_access_on … FOR SHARE. The page's agentAccess read is unlocked and unchanged.
  • Nit, fixed in 1ac249c. The test's lock-wait detector accepted any waiting session in the database. held now records the holder's pg_backend_pid(), and the test waits for a session whose pg_blocking_pids include it. Without the FOR SHARE, the test times out (checked by hand).
  • Migration id. Sol confirmed the additive columns are rollback-safe and asked for 0020 once the stack restacked over Deactivation and Disconnect everything end pending device logins and record when a person's credentials ended #838's 0019_credentials_ended. Renumbered in b8ec35d, with the header comment.

Sol also checked the rest and found it sound: the page copy against the mock, escaping and the shell components, the admin-only same-origin route, events after commit, the seed and template defaults, and no docs/API.md change for a page-form route. It found no lock-order cycle with Users, Looks or OperatingLimits. For #849: hold through issuance and exchange until commit, take the company lock before user or code locks, and never upgrade a share holder to an exclusive lock.

Round 2 (head 1ac249c): no blocking, should-fix or nit findings. All three fixes hold.

@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from c00413f to e3ecce3 Compare October 22, 2026 11:26
@allisonmahmood

allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked e3ecce371d2a98ed16c1a95c8fa3289593f4c4ad (stack base 814cd9c7144ba3764c63c6be7f076a9133c81d40) on fresh team and brightline instances, by GPT-6.1-Sol (xhigh) in the Codex harness on T3 Code. No code, branch, PR body or labels changed; no production requests made.

Done means

  • Admin turns agent access on/off and sees who/when: passed over real HTTP and browser form submissions. Each POST redirects 303 /company#agent-access; Ada and a second admin overwrite the latest stamp correctly. A stale Turn on leaves its original actor and timestamp intact.
  • Member sees the same state/stamp without a button; member POST is refused: passed for both states. On links to Your machines; Off names active admins. Member POST returns 403, including immediately after demotion. Signed-out/foreign-Origin requests return 401/403; malformed or missing state returns 422. All leave the switch unchanged.
  • New company starts Off without a stamp: passed through actual create-company onboarding and direct database inspection. The fresh dev seed and team company also start { on: false, by: null, at: null }.

Golden journeys

  • Sign in/out: passed on the persona instance: Company returns 401, signing in opens it, signing out restores 401. Local AuthPages and DevicePages suites passed; live Clerk CI is green.
  • Invite/join and its reverse paths: passed. Invited a new scenario address, signed in, chose Join Acme Co, reached Home and saw the member-only switch state. Focused suites also passed invitation revocation and member deactivation/reactivation.
  • Machine login, publish/retire/restore and share/unshare: passed in CI (cli-smoke, Node 24 and 26); DevicePages also passed locally. No CLI or wire shape changed here.
  • Find/open and tier 1/2 tools: passed in the local rollback rehearsal on brightline: CLI identity/list/publish, Home, every seeded patch with its sample data, and the new agent-area patch's read-only/page-call guards. CI's browser and tier2-smoke checks are also green.

Other risks

  • Passed: the real-Postgres test holds the share lock in both directions: a change waits for its holder, and a holder waiting for Off reads Off after commit. Focused tests also cover events only for real committed changes, retaining the stamp after deactivation, and unknown companies.
  • Passed: browser checks at 1280px and 390px; no horizontal document overflow, shared shell components, a 44px-high toggle and no confirmation. Company-name markup stays escaped; changing Acme's switch leaves the other company unchanged.
  • Surfaces checked: Company form route and Auth mount; company glossary; migration 0020 through the existing server composition; shared dev/test defaults; UI consistency; reverse On/Off. No public HttpApi route, CLI contract, company-resource or package-layout change requires mirroring.

Focused command:

pnpm exec vitest run packages/companies packages/auth/src/CompanyPage.test.ts packages/auth/src/AuthPages.test.ts packages/auth/src/DevicePages.test.ts packages/serving/src/Pages.test.ts apps/server/src/migrations.test.ts
Test Files  11 passed (11)
Tests       143 passed (143)

Rollback answers: match the diff. A revert leaves three additive company columns and any latest-change stamp; the preceding release ignores them and its inserts use defaults. No one-way label is needed for this change.

pnpm test:rollback-rehearsal --live dd3f41f
Step 1 dd3f41f seeds the data: passed
Step 2 e3ecce3 upgrades it: passed
Step 3 dd3f41f comes back: passed
Exercised rollback paths passed: dd3f41f → e3ecce3 → dd3f41f, in 286s.

Not run

  • Live Clerk and a full pnpm verify locally: relied on their green CI suites; local execution used personas and recorded invitation mail. Production is outside this run's scope.

Notes

Inspected browser evidence at the checked head

Admin On, 1280px:

Admin On at 1280px

Admin On, 390px:

Admin On at 390px

Member Off, 390px:

Member Off at 390px

@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from e3ecce3 to 1257031 Compare October 23, 2026 02:08
@allisonmahmood allisonmahmood mentioned this pull request Oct 23, 2026
Base automatically changed from mcp/840-agent-folder to main October 23, 2026 12:05
Agent access is stored on the company, starts off, and records who made
the latest change and when (migration 0020). Admins flip it with one
button at the foot of Company; every member sees the state and the stamp.
A change is a business event, and code issuance and exchange can hold the
switch against a change with holdAgentAccess.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A FOR SHARE read that waits for a change re-reads the company row but not
the joined user, so the held read could return a fresh switch with no
stamp. Issuance and the exchange need only the switch, so
holdAgentAccess returns whether it is on. The test now waits for a
session blocked by the holder itself.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the mcp/841-agent-access-switch branch from 1257031 to 7dead9d Compare October 23, 2026 12:05
@allisonmahmood
allisonmahmood merged commit 4d57612 into main Oct 23, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the mcp/841-agent-access-switch branch October 23, 2026 12:14
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
…blish lists them (#872)

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

## What changed

People's agents will know a patch's agent tools only from what Patchy
shows them, and the door, `patchy dev agent`, the card and publish must
all show the same thing. The shapes they share now live once in
`packages/api` (`agentTools.ts`): handler descriptors as JSON Schema
2020-12, `open_patch`'s tools, the agent area check, and how a tool call
answers or refuses. Publishing a patch with agent tools now checks them,
names the fix when one is wrong, and lists them:

```
Agent tools: addLead (change), listDeals (read). People's agents use these through Patchy's MCP at <instance>/mcp.
Warning: Agent access is off at Acme, so no agent can use these agent tools yet. An admin turns it on at <instance>/company.
```

Closes #842

## Look at

**1. The schema mapping** (`handlerJsonSchema`, `argsJsonSchema`), as
the spec has it: closed objects that require what isn't optional,
nullable as `anyOf` with an outer description winning, 32-bit integers,
`date-time` timestamps, `t.json()` as `{}`, string enums, and
`t.row(table)` as the full stored row described "A row of <table>:
<table description>". `agentTools.test.ts` › "maps every value kind to
JSON Schema 2020-12" checks every kind. One call the spec didn't spell
out: a row value with its own `.describe()` keeps that description, the
outer-wins rule nullable already has (the prototype did the same);
`docs/product.md` now says so.

**2. One check, three callers** (`checkAgentArea`). It refuses a tool
with no description, `t.upload()`/`t.fileHandle()` anywhere in its
arguments or result, a row naming an undefined table, and tools whose
`open_patch` rendering, rows expanded, passes 60 KiB of UTF-8. It walks
tools in name order, so CLI and instance report the same first problem
however jsonb stored the keys.
- `patchy publish` and watched dev builds run it after the description
check, naming the file; a failed dev build keeps the last good binding.
From `devServerWatch.test.ts`:
`agent/intake.ts: count needs a description: it is all an agent knows
about the tool. Say what it does, what it changes and when it refuses.
The last successful binding stays served.`
- The instance runs it in `Content.publish` on the inspected
descriptors, naming the tool (`InvalidAgentArea` → `invalid_manifest`).
`PatchesApi.test.ts` › "refuses an agent area that fails the shared
check" hand-rolls each case, including 40 tools of 2,000 characters: `An
agent reads all of this patch's tools in one answer of at most 64 KiB,
and the tools get 60 KiB of it; yours come to 85 KiB. Shorten
descriptions or drop tools.`
- A row naming an unknown table is refused earlier, by the manifest's
own check. That check now names the handler (an agent tool by its tool
name) and the fix, and the instance passes a manifest-wide check's words
through instead of "Invalid manifest." (field-level problems stay
generic).

**2b. `server/agent.ts` on the instance** (`c6020af`). Only
`server/agent.ts` builds an `agent.*` handler without the agent tool
mark. The CLI already refused it before building (#840), and now the
shared check refuses one first on the instance too, so a hand-rolled
publish can't skip it: `agent.listDeals comes from server/agent.ts.
Agent tools live in agent/; move these exports there.` Reading an older
version is unchanged: its unmarked `agent.*` handlers stay page
handlers. `PatchesApi.test.ts` › "refuses an unmarked agent.* handler,
as server/agent.ts builds".

**3. What publish says.** The CLI builds the agent tools line from the
manifest the attempt sent (`cliRepoRecovery.test.ts` recovers an attempt
with a broken config and still lists its tools). The instance adds the
argument warnings and, through `Companies.agentAccess`, the access-off
warning; JSON gains no field. `PatchesApi.test.ts` › "warns about
undescribed arguments, and that no agent can use the tools while access
is off" publishes with access off, turns it on and publishes again.

**4. Answers and refusals** for the door and `patchy dev agent`:
`toolAnswer` (compact JSON text plus `structuredContent`), `CallSuccess`
`{ result, version, replayed? }`, `ToolRefusal` and `patchRefusal`,
which reads "New Business refused addLead (missing_fields): give every
field." from a handler's `details.message` and keeps code and details
unchanged.

## How it was verified

- `vitest` on `packages/api`, `packages/sdk`, `packages/patches`
`PatchesApi`/`Content`, and `packages/patchy` `devServerWatch`,
`serverModules`, `server`, `cliRepoRecovery`: 199 tests on `5a00179`,
all passing (one SDK repack test timed out under machine load and passed
alone); the round 1 fixes add tests to the api, patches and patchy
suites, all passing.
- `pnpm typecheck` and `eslint` on the changed files.
- `pnpm dev transcript` on throwaway `team` instances, base `c00413f`
against `5a00179`: a fresh tier 2 repo with two agent tools publishes
with the line and both warnings, and dropping one description is refused
locally, naming `agent/notes.ts`, where the base published. The
transcript is below.
- GPT-6.1-Sol (xhigh) reviewed in two rounds: round 1's blocking
size-check crash and three smaller findings are fixed in `f69e936`, and
round 2 found nothing. The rounds are in [the review
comment](#872 (comment)).
- `pnpm test:rollback-rehearsal --live dd3f41f`, a `main` commit with
#837 and #838: dd3f41f → f69e936 → dd3f41f passed in 290 s. On
`f69e936`, CI's `rollback-rehearsal` failed against production's
then-commit d77baaf, which couldn't read the stack's agent tools (#833).
- `pnpm verify` on `f69e936`: format, lint, typecheck, synth,
postgres-concurrency, cli-smoke and browser passed. `test` and
`tier2-smoke` failed only on timeouts while the shared machine was at
load 40; `tier2-smoke` then passed alone, and the 12 test files that
timed out in either run passed alone (115 tests). CI passed both on this
head.
- Sol's round 3 on `c6020af`'s delta found nothing
([comment](#872 (comment))).
Every CI check passes on `c6020af`, `rollback-rehearsal` included:
production's commit has since moved to e4243ff, and the rehearsal ran
e4243ff → c6020af → e4243ff.
- Acceptance on `c6020af` by GPT-6.1-Sol (xhigh): [**PASS with
notes**](#872 (comment)).
It upgraded a version with an unmarked `agent.legacy` from `f69e936`:
its page call kept working, a new publish of it was refused, and
rollback to it still served it. It also ran the rehearsal against
dd3f41f. Its note: merge with the stack, not alone.
- Earlier, acceptance on `f69e936` by GPT-6.1-Sol (xhigh): [**PASS with
notes**](#872 (comment)).
It checked the publish line and warnings, seven CLI and eight
hand-rolled refusals, byte counts against `JSON.stringify` up to exactly
61,440 bytes, watched dev keeping the last good binding, the publish and
lifecycle journeys, and its own rehearsal against dd3f41f. Its note is
the documented `rollback-rehearsal` gate above.

<!-- patchy-dev:transcript:agent-tools -->

#### Transcript `agent-tools`

Before is `5f474a6` (where this branch left main) and after is `5a00179`
(mcp/842-schemas-publish), both on the `team` scenario, from `pnpm dev
transcript`.

Each line ran in its own `bash -c` from the side's agent workspace, as
the scenario's signed-in CLI, with stdin closed. Each side's origin
reads `<origin>`, its environment folder `<env>`, its checkout
`<checkout>` and the home folder `~`; nothing else is normalized.
Nothing in it matched a collected secret (each side's CLI state,
machine-token and login-code shapes, email addresses outside the
scenarios' example domains, secret-named variables, and any accounts the
run acts as).

2 of 4 lines changed.

##### A tier 2 patch whose agent/ folder holds two tools

<details><summary><code>$ patchy init notes --purpose "Notes for the
team" --tier 2 --json &gt; /dev/null &amp;&amp; echo "initialized
no…</code>: no change, exit 0 in 4.6 s</summary>

```console
$ patchy init notes --purpose "Notes for the team" --tier 2 --json > /dev/null && echo "initialized notes at tier 2"
initialized notes at tier 2
```

</details>

<details><summary><code>$ mkdir -p notes/agent &amp;&amp; printf '%s\n'
'import { query, mutation, t } from "../patchy/_generated/serv…</code>:
no change, exit 0 in 0.0 s</summary>

```console
$ mkdir -p notes/agent && printf '%s\n' 'import { query, mutation, t } from "../patchy/_generated/server.js";' 'export const listNotes = query({ description: "Lists the newest 100 notes.", args: {}, result: t.array(t.row("notes")), handler: async (ctx) => (await ctx.tables.notes.list({ limit: 100 })).rows });' 'export const addNote = mutation({ description: "Adds a note with the given title.", arg…
import { query, mutation, t } from "../patchy/_generated/server.js";
export const listNotes = query({ description: "Lists the newest 100 notes.", args: {}, result: t.array(t.row("notes")), handler: async (ctx) => (await ctx.tables.notes.list({ limit: 100 })).rows });
export const addNote = mutation({ description: "Adds a note with the given title.", args: { title: t.text() }, result: t.row("notes"), handler: async (ctx, args) => ctx.tables.notes.insert({ title: args.title }) });
```

_Lines are cut at 400 characters. `--json` has it all._

</details>

##### Publishing names the tools, warns about the undescribed argument
and that agent access is off

**Changed.** Before, exit 0 in 4.1 s; after, exit 0 in 4.7 s.

```console
$ cd notes && pnpm --silent patchy publish
Publishing to <origin> (target came from patchy.json).
Published patch
URL: <origin>/acme/notes
Scope: company (signed-in colleagues in your company)
Patch ID: xuxps3o2scg0
Tier: 2
Version: 1
Provisioned tables: notes.
Provisioned columns: notes.title.
Provisioned indexes: none.
Provisioned stores: none.
Unused tables: none.
Unused columns: none.
Unused indexes: none.
Unused stores: none.
Agent tools: addNote (change), listNotes (read). People's agents use these through Patchy's MCP at <origin>/mcp.
[stderr]
Warning: Agent access is off at Acme Co, so no agent can use these agent tools yet. An admin turns it on at <origin>/company.
Warning: addNote's argument title has no description, so an agent knows only the name and type. Add .describe() where the name doesn't say enough.
```

```diff
@@ 2 unchanged lines @@
 URL: <origin>/acme/notes
 Scope: company (signed-in colleagues in your company)
-Patch ID: u3hupcnf5x84
+Patch ID: xuxps3o2scg0
 Tier: 2
 Version: 1
@@ 6 unchanged lines @@
 Unused indexes: none.
 Unused stores: none.
+Agent tools: addNote (change), listNotes (read). People's agents use these through Patchy's MCP at <origin>/mcp.
+[stderr]
+Warning: Agent access is off at Acme Co, so no agent can use these agent tools yet. An admin turns it on at <origin>/company.
+Warning: addNote's argument title has no description, so an agent knows only the name and type. Add .describe() where the name doesn't say enough.
```

##### A tool with no description is refused before anything is sent,
naming its file

**Changed.** Before, exit 0 in 4.3 s; after, exit 1 in 4.1 s.

```console
$ cd notes && sed -i 's/description: "Lists the newest 100 notes.", //' agent/notes.ts && pnpm --silent patchy publish
Publishing to <origin> (target came from patchy.json).
[stderr]
agent/notes.ts: listNotes needs a description: it is all an agent knows about the tool. Say what it does, what it changes and when it refuses.
```

```diff
 Publishing to <origin> (target came from patchy.json).
-Updated patch
-URL: <origin>/acme/notes
-Scope: company (signed-in colleagues in your company)
-Patch ID: u3hupcnf5x84
-Tier: 2
-Version: 2
-Provisioned tables: none.
-Provisioned columns: none.
-Provisioned indexes: none.
-Provisioned stores: none.
-Unused tables: none.
-Unused columns: none.
-Unused indexes: none.
-Unused stores: none.
+[stderr]
+agent/notes.ts: listNotes needs a description: it is all an agent knows about the tool. Say what it does, what it changes and when it refuses.
```

<!-- /patchy-dev:transcript:agent-tools -->

## Release impact

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

New refusals apply only to agent tools, which nothing released has yet,
plus clearer wording for refusals the instance already made. No schema,
no stored shape.

- **What does a revert leave behind?** Versions published while it was
live, whose manifests are the shape #837 already reads, and publish
warnings stored in replayable responses as plain strings.
- **Does the release before it still work with that?** Yes. It reads the
same manifests and simply stops checking new agent areas.

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]>
@allisonmahmood allisonmahmood mentioned this pull request Oct 28, 2026
1 of 2 tasks
allisonmahmood added a commit that referenced this pull request Oct 29, 2026
## What changed

Patchy MCP has been live in production since release 17, but the product
doc, the glossary map and the MCP glossary still called it specified or
being built. They now describe what runs, and where the build settled a
detail differently from the spec, the spec now says what the code does.
Production acceptance (#861) hasn't run: the section says so, and claims
about particular clients are framed as what the build was designed for.

Part of #862. This is everything in #862's "What to do" except "What
remains takes acceptance's findings", which waits for #861.

## Look at

**Status and pointers.** Each of these now reads as built:
- `docs/product.md`: the "Built and live" intro line names Patchy MCP;
the Patchy MCP section opens "Built, and live since release 17", links
#833 and says #861 hasn't run.
- The same file's tier 2 sentence, `agent/` pointer, Companies (admins,
deactivation), Who's who and Bounds' admission rule.
- `GLOSSARY-MAP.md`: Auth and Patchy MCP.
- `packages/mcp/GLOSSARY.md`.
- `README.md`: the layout, plus one sentence on tier 2.
- `AGENTS.md`'s tier 2 line.
- `docs/OPERATIONS.md`: request events.

**Spec details the build settled differently.** Each claim was checked
against main:

| Claim in the doc | What main does | Where |
| --- | --- | --- |
| A forwarded host is trusted from Patchy's proxy | The door never
believes a forwarded host and refuses two `Host` fields |
`packages/mcp/src/RequestTrust.ts:7-10` |
| `Host` gates the OAuth endpoints too | Only `/mcp` is Host-gated; a
dev instance serves every route on `127.0.0.1` |
`packages/mcp/src/Door.ts:372`,
`packages/auth/src/OAuthEndpoints.ts:19-20` |
| An unknown method is `404` | `404` on 2026-07-28, `200` on legacy,
where 404 means session ended | `packages/mcp/src/Door.ts:356-363` |
| An `unknown_outcome` always resolves on retry | Only until a few
minutes before 24 h; then `key_expired` |
`packages/mcp/src/ChangeKeys.ts:116-123`, `Calls.ts:339-347` |
| An action's key never runs again | Unless Runtime refused the first
try before it started | `packages/mcp/src/ChangeKeys.ts:60-64`,
`Calls.ts:409-419` |
| `resource` is bound through exchange and refresh | Optional; must name
the door wherever sent | `packages/auth/src/Consents.ts:203-205,
345-348` |
| Consent re-asks after an account switch | Also re-asks an Allow after
the client's name changes |
`packages/auth/src/OAuthEndpoints.ts:423-436` |
| With agent access off, consent names the admins | To members; an admin
is told to turn it on | `packages/auth/src/OAuthEndpoints.ts:182-185` |
| "logged as Jordan via Claude" | The person's full name: "Jordan Lee
via Claude" | `packages/auth/src/OAuthEndpoints.ts:151-162` |
| The docs say how to reconnect by hand | Not written; Connect an app
gives first-time steps only | no such doc in `docs/`, `skills/`,
`packages/sdk/skills` |
| Publish's warning points at `<instance>/company` |
`<instance>/company/agent-access` |
`packages/patches/src/PatchesApi.ts:454` |
| The instance names a duplicated tool | It can't: inspection drops the
bundle's message; only the CLI names it |
`packages/execution/src/inspection.ts:12-16` |
| A read-only action's writes are type errors | Table and file writes
are; Pidgeon writes typecheck and the callback gate refuses them |
`packages/patchy/src/server.ts:247-262`,
`packages/runtime/src/CallbackGateway.ts:107-111` |
| `dev.log` names the person | It writes their id: `usr_dev via patchy
dev …` | `packages/patchy/src/devLog.ts:23-27` |
| New repos include `agent` | Tier 1 and 2 repos do |
`packages/patchy/src/initProject.ts:207` |
| The MCP request event says whether its binding is agent-only | Only
the binding event carries `agentOnly` |
`packages/analytics/src/WideEvents.ts:228` |
| An in-flight slot is held after the client disconnects | A client gone
before dispatch gives it back | `packages/mcp/src/Admission.ts:13-17` |
| The week-unused note opens "Not used since 2 Oct." | It opens "If you
reconnected …" | `packages/auth/src/MachinesPage.ts:178` |
| "today a person types everything into them" | Agents now find, read
and change patches too | the section itself |
| Pages "get phone checks when built" | They were checked at 390 px in
their PRs' screenshots (#871 #876 #882 #885 #931 #932) | — |

## How it was verified

- Four read-only passes went claim by claim through the Patchy MCP
section against main at 2f9f7c1. I re-read the code for every finding
before changing a line. The table lists each change.
- **Findings left as they are:**
- "the one secret Patchy keeps recoverable": the context is the
connection's tokens.
- "each change gets a fresh change key" in `patchy dev agent`: the
code's own comment says the same.
- The lists of which outside clients can connect: these are facts about
those clients, and the code offers no dynamic registration.
- `pnpm check`: format, lint, typecheck and synth passed. Two test files
failed under load average 19, a 5 s timeout in
`PgliteCompanyDatabases.test.ts` and a worker SIGKILL in
`devExecution.test.ts`. Both passed when rerun alone. Neither touches
docs.
- **Not done here:** `packages/sdk/skills/patchy-server/SKILL.md:415`
and `packages/sdk/src/sdkCapabilities.ts:107` say a patch's tools fit in
64 KiB, but the check allows 60 KiB of that answer. Those files belong
to another lane, so they're left for a follow-up.

## Release impact

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

Docs only.

- **What does a revert leave behind?** Nothing; the docs go back to
calling Patchy MCP specified.
- **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).

---------

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 area:ui Portal and first-party browser pages, shared rendering and styles size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Admins turn agent access on and off on Company

1 participant