Skip to content

fix(auth): Disconnect everything and deactivation end device logins not yet collected - #867

Merged
allisonmahmood merged 4 commits into
mainfrom
mcp/838-credentials-ended
Oct 22, 2026
Merged

allisonmahmood merged 4 commits into
mainfrom
mcp/838-credentials-ended

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

What changed

A device login the person approved could still mint a machine token after they pressed Revoke all machines (Disconnect everything), or after they were deactivated and reactivated, if the terminal hadn't collected it yet. Now both endings cancel every approval the terminal hasn't collected.

Each user's row also records when their credentials last all ended. Patchy MCP's agent connections and consents (#846, #849) will refuse anything made at or before that time. That keeps credentials ended even when the ending happened on a release that knows nothing about agent connections, which is why this ships before the stack.

Closes #838

Look at

The poll checks the stamp under the user lock (packages/auth/src/DeviceLogins.ts). Deactivation (Users.deactivate) and revoke all (MachineTokens.revokeAll) set users.credentials_ended_at in their transaction; reactivation leaves it. Confirming a device login now records confirmed_at. Before minting, the poll locks the user row (mint and both endings take the same lock) and refuses a confirmation at or before the stamp, compared in Postgres at full precision, answering unknown as it does today for someone deactivated between confirm and poll. A login confirmed by the release before this one has no confirmed_at; once the person has a stamp, it never mints.

Both times are the database's clock, read under the user's row lock. Confirmation takes a share lock on the user, and the endings take FOR UPDATE, so a confirmation that commits before an ending always has the earlier clock_timestamp(). Servers' own clocks can disagree by more than the gap between a confirmation and an ending, which Sol showed would let one mint (round 1 in the review comment). The stamp never moves back (GREATEST). When #846 and #849 compare agent connections and consents with the stamp, they should take those times from the database's clock too.

The endings don't touch device_logins rows. The poll holds the login's row lock while it waits for the user lock, so an ending that deleted those rows under the user lock could deadlock with it. Checking at the poll keeps one lock order (login, then user), and the row is consumed when the terminal polls, or pruned at expiry.

A test, red on main's code, green on the head. Disconnect everything and deactivation cancel confirmations not yet collected runs approve → revoke all → poll, and approve → deactivate → reactivate → poll, with the confirming server's clock a minute ahead of the ending's. It also fails on this PR's first commit, which used servers' clocks. With main's DeviceLogins.ts, MachineTokens.ts and Users.ts restored under the new test, the first poll mints:

 FAIL  packages/auth/src/DeviceLogins.test.ts > DeviceLogins > Disconnect everything and deactivation cancel confirmations not yet collected
{
  status: 'complete',
  token: 'pp_…',
  machine: { id: 'tok_…', name: 'Cancelled' },
  …
}
      Tests  1 failed | 17 skipped (18)

On the head: Tests 1 passed | 17 skipped (18).

On a local instance, as [email protected]: patchy login, confirm on /login/device, POST /machines/revoke-all, then the terminal collects:

$ patchy login --complete HSJP-NTVX --api-url http://127.0.0.1:27140
No login is pending for code HSJP-NTVX on http://127.0.0.1:27140; it may already have been reported. Run: patchy login
exit 2

The server answered POST /api/login/device/token with 410 unknown. Afterwards the login row was gone and the user had no live token. A second patchy login, started and confirmed after the ending, logged in normally (This machine is "after the ending".).

How it was verified

  • New and changed tests, all passing: packages/auth/src/DeviceLogins.test.ts (the two endings above; a login started before the ending but confirmed after it still mints, even on a server whose clock runs behind, or in the same millisecond as the ending; a poll racing revoke all leaves no live token), MachineTokens.test.ts (revoke all moves the stamp forward each time), Users.test.ts (deactivation sets it, a repeat deactivation and reactivation keep it).
  • pnpm check: format, lint, typecheck and synth pass. Its full offline run hit timeouts in suites this PR doesn't touch (patchy CLI, PGlite) at load average ~20, and they passed when rerun alone.
  • The hand test above on pnpm dev, at the first commit. Deactivate → reactivate → poll is covered by the test, not by hand.
  • During the deploy, a server still on the release before this one neither stamps nor checks. The guarantee holds once every server runs this release, which Build Patchy MCP #833's stack waits for anyway.
  • Migration id: this takes 0019_credentials_ended, the next above main's 0018. Tier 2 readers accept handler descriptions, read-only actions and agent tools, and enforce them #837 is being built in parallel; whichever of the two merges second renumbers.

Release impact

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

Two nullable columns, no backfill, no API or CLI change.

  • What does a revert leave behind? users.credentials_ended_at and device_logins.confirmed_at, holding the stamps written while this release ran.
  • Does the release before it still work with that? Yes. It names its columns in every read and insert on both tables, and the rollback-rehearsal check runs it on this schema. Rolling back past this PR reopens the device-login gap it closes. Once Build Patchy MCP #833's stack is live, it would also let agent connections an older release ended work again, so the stack must not be rolled back past this PR. That constraint belongs to the stack's release, not this one.

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:m 100-500 changed lines labels Oct 22, 2026
@allisonmahmood
allisonmahmood force-pushed the mcp/838-credentials-ended branch from 4a80c94 to abd5c2f Compare October 22, 2026 07:57
allisonmahmood and others added 4 commits October 22, 2026 10:20
…vice logins

Each user now records when their credentials last all ended
(users.credentials_ended_at, migration 0019). Deactivation and revoking
every machine set it in their transaction; reactivation keeps it. Device
logins record when they were confirmed, and the terminal's poll, holding
the user lock the endings take, never mints from a confirmation at or
before the stamp. The stack's agent connections and consents will honour
the same stamp, so credentials stay ended whichever release ended them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Servers' clocks can disagree by more than the gap between a confirmation
and an ending, so a confirmation committed before Disconnect everything
could carry a later time than its stamp and still mint. Confirmation now
takes the user lock the endings take, and both read the database's clock
under it; the stamp never moves back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A confirmation from the release before confirmed_at has only its start,
on the app server's clock, which the database's stamp can't be compared
with. Once the person's credentials have ended, it never mints.

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

JavaScript dates keep milliseconds, so a confirmation in the same
millisecond as an ending but after it was cancelled. The poll now asks
Postgres, under the same user lock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the mcp/838-credentials-ended branch from a43b15c to 9e756fe Compare October 22, 2026 08:20
@allisonmahmood

Copy link
Copy Markdown
Owner Author

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

Round 1 (at the first commit)

  1. Blocking, fixed. confirmed_at and the stamp came from each server's own clock, so with skew a confirmation committed before Disconnect everything could carry the later time and mint. Sol reproduced it. Now confirmation takes the user's row lock (FOR SHARE) that the endings hold FOR UPDATE, and both read the database's clock_timestamp() under it; the stamp never moves back (GREATEST). The main test confirms with the server clock a minute ahead of the ending's; it mints on the first commit and is refused now.
  2. Should-fix, dismissed. "Revoke all machines" is hidden on Your machines when the person has no live token, so an uncollected first approval can't be cancelled there. This ticket changes nothing else for anyone, and Your machines shows how to connect an agent and lists the agents you've connected #853 owns that page, including "Lost a laptop?" holding Disconnect everything. Sol agreed in round 2; the point is passed on for Your machines shows how to connect an agent and lists the agents you've connected #853.

Round 2

  1. Blocking, fixed. The fallback for a login confirmed by the release before this one (confirmed_at null) compared its app-clock created_at with the database-clock stamp, so a row from a server running ahead could mint after a later ending. Now an unstamped confirmation never mints once the person has a stamp. The test's legacy row has created_at an hour ahead.

Round 3

  • Nothing blocking.
  1. Should-fix, fixed. Comparing as JavaScript dates dropped Postgres's microseconds, so a confirmation in the same millisecond as an ending, but after it, was cancelled. The poll now compares in SQL under the same lock, with a test at .123100 / .123900.

Confirmed across rounds: one lock order (login, then user; endings take only the user), no deadlock path, migration 0019 additive and rollback-compatible, surfaces (glossaries, ADR-0008, product doc, vitest template) complete.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 9e756fe82621c57f36cc30a93e7865185f8992ac (base 26920f9866d8ee8c0c58452bd25189d964d5f242) on fresh team data, by GPT-6.1-Sol (xhigh) in Codex on T3 Code.

Done means

  • Deactivation and Disconnect everything record when credentials ended: passed. Observed a previously NULL stamp become non-NULL after each existing form action.
  • Reactivation keeps that time: passed. Compared the full Postgres timestamp before and after reactivation; it was unchanged.
  • Neither ending allows an uncollected approval to mint: passed. Ada's approved CLI login was refused after revoke-all (exit 2, “No login is pending”); Ben's approval returned HTTP 410, code unknown, after deactivate → reactivate. Both approval rows were consumed and neither person had a live token after the refused poll.
  • Nothing else changes: passed within the checked scope. New approvals work after an ending, including a login started before it; existing revoked keys remain refused, unrelated people's logins work, and deactivation/reactivation still removes/restores browser access.

Golden journeys

  • Log a machine in and log it out: passed through the environment's packed CLI. A fresh approval completed with exit 0 and logged_in; whoami succeeded. Logout succeeded; subsequent whoami exited 1 for the missing local credential, as ADR-0004 specifies.
  • Invite and join — deactivation/reactivation portion: passed through Ada's existing company actions. Ben's browser was refused while deactivated and worked after reactivation; his old machine key remained HTTP 401.
  • Sign in — existing persona session/access checks: passed for Ada, Ben and Cleo. Real Clerk sign-in was not run locally; CI's clerk-live passed.
  • Publishing, sharing, finding tools and tier 1/2 interaction have no changed path in this diff; no rendered-page comparison applies.

Risk checks and evidence

The focused suites ran serially against isolated real Postgres:

pnpm exec vitest run packages/auth/src/DeviceLogins.test.ts \
  packages/auth/src/MachineTokens.test.ts packages/auth/src/AuthApi.test.ts \
  packages/companies/src/Users.test.ts apps/server/src/migrations.test.ts --maxWorkers=1

Test Files  5 passed (5)
     Tests  55 passed (55)

These include both endings with server-clock skew, Postgres sub-millisecond precision, the poll/revoke race, repeated endings, transaction rollback and existing token contracts. Additional direct checks on the fresh instance passed:

confirmation exactly equal to credentials_ended_at -> HTTP 410 unknown
legacy confirmation without confirmed_at, created_at one hour ahead -> HTTP 410
login started before revoke-all, confirmed afterwards -> usable token
repeat poll after successful collection -> HTTP 410
Cleo remains unstamped and can log in; Ada's recovered token survives Ben's endings

Migration 0019 is next after base's 0018; the migration-record test passes. The shared vitest template consumes the composed server migration record. ADR-0008, product documentation and both glossaries match the behavior. No wire, CLI, runner, company-resource locking, repo-layout or rendered-page change requires another mirror.

Rollback answers: match the diff. The two nullable columns and their stamps remain; the previous release can continue using its named columns. No one-way label is needed for this PR. The rollback rehearsal passed all three stages: live d77baaf → this PR's merge build 04a3908 → live d77baaf. Rolling back reopens the fixed gap, as the body states; the later agent-connection stack has its own ordering constraint.

Not run / not yet complete

  • Full pnpm verify was not repeated locally on the shared machine. At the final CI snapshot, test (22), test (24), test (26) and browser were still running; their results are not counted as passed. The other ten checks, including lint, both CLI smoke jobs, tier 2 smoke, real-Postgres concurrency, live Clerk and rollback rehearsal, passed. CI run.

Notes

  • No behavioral acceptance failure found; the remaining note is incomplete broad CI, not a merge-readiness verdict.
  • Both throwaway instances were stopped using their recorded PIDs. All six recorded supervisor/server/Postgres PIDs are gone; instance and environment data were removed. The checkout is clean, and the author's code, branch, body and labels were left unchanged.

@allisonmahmood
allisonmahmood merged commit d4d6ed7 into main Oct 22, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the mcp/838-credentials-ended branch October 22, 2026 08:47
allisonmahmood added a commit that referenced this pull request Oct 22, 2026
…874)

## What changed

Release 16's What's new entry, written from `dd3f41f`. It covers
everything merged since release 15's `through` (`9e4b0df`), and sets the
`patchy` release to `0.16.0` (`packages/patchy/package.json` and
`CURRENT_RELEASE`).

| Change | PRs |
| --- | --- |
| Fixed: Revoke all machines stops logins still on their way | #867 |
| Behind the scenes: `mcp` and `oauth` kept off company addresses | #863
|
| Behind the scenes: read-only actions and agent tools understood and
enforced before anything writes them | #868 |
| Behind the scenes: logs record how long a tool's server takes to start
| #865 |

#814 is release 15's own entry, so it's left out. #818 and #831 are docs
(Patchy is live; the Patchy MCP spec) and #864 is dev tooling, so none
of them gets a line.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. #867 is the only change a person could
notice. The page's button is still labelled "Revoke all machines"
(Disconnect everything is the spec's future name), so the entry uses
that label.
- **Rollback safety, from the live commit `d77baaf` to `dd3f41f`.** No
PR in the range is labelled `one-way`, and every PR answers both Release
impact questions with "Yes".
- #867 is the only migration: `0019_credentials_ended` adds two nullable
columns, `users.credentials_ended_at` and `device_logins.confirmed_at`.
At `d77baaf`, every insert into `users` and `device_logins` lists its
columns, and nothing reads either table with `SELECT *`.
- `rollback-rehearsal` passed on #863, #865, #867 and #868. #868's run
covered #867's migration already on main: `Exercised rollback paths
passed: d77baaf → ffe9988 → d77baaf`.
- A rollback would reopen what #867 closes: an approved login that
hasn't finished could again get past Revoke all machines. It would also
let new companies take the `mcp` and `oauth` addresses (#863). No
release that writes read-only actions or agent tools has shipped, so
going back past #868 leaves nothing behind.

## How it was verified

- `vitest run packages/core/src/whatsNew.test.ts
packages/api/src/schemas.test.ts`: 14 passed.
- `pnpm typecheck`: 23 of 23 tasks pass. Prettier and eslint are clean
on the changed files.
- The live commit was pinned from `/healthz/deep` (`d77baaf`, release
15). The Deploy run updated last succeeded, and none is unfinished.

## Release impact

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

The changelog text plus the `patchy` version bump. A CLI installed
before this deploy is told to upgrade, as with every release.

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

If this release misbehaves, roll back to
`d77baafcf10c7cdf28c71bd65ea1a0009aa99ced` (release 15).

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
)

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

- `packages/mcp`: `Catalogue.test.ts` covers a narrower openability
rule, order, 55 patches over two pages with a publish and a retire
between them, the read cap with `detail: "tools"`, search, cursor
tampering, bad arguments, resolution by name/id/address/former name,
other instances' and companies' addresses, and the 64 KiB cap.
`Door.test.ts` covers the agent access refusal for a member and an
admin, with discovery and the tool list still working. The shared
harness moved to `src/test/door.ts`.
- `packages/patches`: `agentToolSummaries` by version. `packages/api`:
summaries keep `open_patch`'s order.
- `pnpm verify` on 90262f1: format, lint, typecheck, synth,
postgres-concurrency, cli-smoke, tier2-smoke and browser passed. In
`test`, 2237 of 2239 passed. The two that timed out under the machine's
load are in packages this PR doesn't touch: `cliRepoBuild.test.ts` (30
s) and `SdkApi.test.ts` (5 s). Both pass alone, and in CI. Every CI
check is green on 90262f1. clerk-live passed on a rerun: its two live
tests had passed and only the cleanup sweep got a Clerk 404.
- No migration, so `rollback-rehearsal` has nothing to rehearse. #837
(PR #868) and #838 (PR #867) are both on `main`.
- Real clients against a dev instance, on the final head: Claude Code
2.1.308 through real consent, and Codex 0.163.0 with a minted token on
both its revisions. Each found Ben's 56 patches over two pages (50 + 6),
with `deal-desk` first as the one with agent tools, and opened it, by
name and by address. With agent access off, each call was refused naming
Ada Park, the admin.

<details><summary>Real clients against a dev instance,
transcripts</summary>

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:

~~~text
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](https://github.com/user-attachments/assets/f25486d8-8b1f-4e51-8d6b-4e9c6e838a82)

Then `claude -p` with the same config:

~~~text
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:

~~~text
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):

~~~text
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."

~~~text
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 | — |

</details>


## Release impact

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

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

- **What does a revert leave behind?** Nothing. Clients that called the
two tools get "not built" again, as on #883.
- **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).
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:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deactivation and Disconnect everything end pending device logins and record when a person's credentials ended

1 participant