Repository navigation
feat(integrations): Pidgeon runs on its new API - #1458
Conversation
Pidgeon retires the API Patchy called on 22 November 2026, and connecting already fails there. Move the integration to Pidgeon's /v1 API: - Connect takes a key made in Pidgeon's dashboard, lists the inboxes it reaches and keeps it with the one picked. Such a key reaches the whole account, so every operation keeps the inbox boundary itself: anything Patchy can't show is the inbox's answers not_found. - Pidgeon no longer dedupes sends, so a ledger of draft keys writes each email as a draft and sends it at most once, answering `unconfirmed` when Pidgeon hasn't said whether it left. - Minting, revoking and retiring keys, addresses, domains and send policies go; the patch-facing contract follows the new API. Closes #1457 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…an inbox Connect's check of an Admin key asked Pidgeon to make an inbox with an empty name. It now deletes an inbox by an id Pidgeon never issues: 403 below Admin, 404 for Admin. Any other answer leaves the key not shown to be Admin, which only words the page's status line, so connect never fails over it. Both level checks name the same id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A draft Patchy hasn't shown is the connection's inbox's is never deleted. - A 429 is Pidgeon's word only in its error envelope, and a 422, which Pidgeon doesn't document, is unavailable: a send answered either way stays `sending` and is looked at, never sent again. - A 401 on a draft's send records `refused`: that draft is never sent again, and after Replace key the next attempt writes a new draft, sends it once, and deletes the old one on takeover. - A claim whose acknowledgement was lost is read back, and carried on only when the row holds the attempt's own token and email. Tests for each, and for recovery by a draft's id, another inbox's label off the connection's thread, a conversation carrying another one's message, a stale owner's release, expiry by state, and the runtime journey over two inboxes under one key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion left A Pidgeon connection stored by an earlier release keeps the old display and credentials, which made its company's whole connection list fail to decode, and Replace and Delete with it. Migration 0044 now deletes every Pidgeon connection, with its day counts and team grants, and every Pidgeon snapshot: neither can be read by this release or work on the new API. An upgrade test shows the company's connections read again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and leftovers fail the run CI gives every live file one run tag, and Pidgeon never gives a deleted address out again, so the second file to ask for `desk` was refused. Each file's inboxes now carry the file's name (`connect-desk`, `ops-desk`, `dev-desk`), still fixed so a lost answer is found by name, and a failed make says which refusal it got. A sweep no longer hides a failed deletion: it deletes the rest, counts the failures, and the file's cleanup and the CI sweep fail when any of the run's own inboxes is left, saying how many. The three files share one cleanup layer. The live check that listing and checking a key change nothing now counts every POST, PATCH and DELETE but the two level checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…finish A subject found in the inbox didn't show a whole conversation arrived, and a held-only conversation has no subject to find. The environment's record now says, per inbox, whether its mail all arrived. `up` makes and fills an inbox before connecting it (so its snapshot holds the scenario's labels): one recorded finished is used as it is with nothing delivered, and one that didn't finish is deleted and replaced by a new inbox, at a new address, filled from the start. Records from before name inboxes alone, and `down` still takes those down. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ual revocation Product, glossary, scenarios, the UI gallery and the dev runner still said Patchy mints a key for one address, revokes it on delete, shows a leftover key needing attention, tells an Admin key by making an inbox, and that a resumed `up` skips conversations by subject. They now describe a key from Pidgeon's dashboard that the admin revokes in Pidgeon, the level check by delete, the seeding record, and the live tier's per-file inbox names and leftover rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…afe chain Co-Authored-By: Claude Opus 5.5 <[email protected]>
The connect page is the shared frame's one submit, as Attio's and the mailbox's are: the key, the inbox's address and what patches may do, each refusal under its own field. Find inboxes, its route, the page's script and the frame's script slot are gone; Replace key and Change access draw the same fields. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ed once After a key Pidgeon rejected mid-send, the same email retried under its draft key took a second unit of the day's send budget, so the day's last email could be refused though nothing had left. A refused row taken over with the same digest keeps its one charge; a corrected email is still a new one. The live sweep now fails on any deletion it meant and couldn't make, an earlier run's stale inbox included. The connect frame's description and two comments no longer describe Pidgeon's removed Find inboxes flow. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review notesTwo rounds of review by GPT 6.1 Sol (xhigh), the first on Round one
Round two: no blocker.
Known and unchanged: a |
|
On the acceptance verdict above (FAIL on |
Acceptance: PASS with notesChecked Done means
Assessment of the changed requirement I read both the issue explanation and the PR explanation. The revised line is a fair statement of the owner's recorded decision: the reported empty production Pidgeon inventory supports choosing a clean cut, and the line explicitly acknowledges deletion and reconnection in other environments. This changes the acceptance requirement; it does not fix or conceal the earlier run's 404 finding. I reproduced that finding and no longer count it as a failure under the revised line. I have not independently verified the production inventory, because this run was expressly forbidden from touching production. Golden journeys and other risks
Rollback answers: Match the diff and the fresh rehearsal. Migration 44 leaves the additive draft table and irreversibly removes old Pidgeon connections/snapshots; reverting does not recover them. I independently applied the previous release's schemas to a new connection's stored credentials, display and snapshot: all three reject the new shapes. Thus a new Pidgeon connection makes rollback unsafe for that company's connection list; fix forward as disclosed. The Not run
Notes
|
## What changed This adds release 45's What's new entry, written from `e31eaab`. It covers everything merged since release 44's `through` (`b653816`), and sets the `patchy` release to `0.45.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. | Change | PRs | | --- | --- | | Improved: Pidgeon works on its new platform | #1458 | | Behind the scenes: Pidgeon connections made before this release are removed | #1458 | | Patch changes: Pidgeon's contract follows Pidgeon's new API | #1458 | #1456 is release 44's own entry. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. - **Why it ships now:** Pidgeon's old API stops on 22 November. Until this deploys, production's Pidgeon integration calls that old API. - **Patch changes:** the contract changes listed in #1458, for an agent refreshing a patch repo built against the old one. Production has no patch version that declares Pidgeon. - **Rollback safety, from the live commit `1414f9f` (release 44) to this PR's merge.** The only PR in the range is #1458, labelled `one-way`. Its migration `0044` adds the `pidgeon_drafts` table, which release 44 ignores, and removes Pidgeon connections made before it; production has none. Its rollback rehearsal passed. If this release misbehaves, roll back to `1414f9f` (release 44) while no company has connected Pidgeon on this release. Once one has, rolling back past #1458 would break that connection, because release 44 can't read the new Pidgeon credentials, and its own Pidgeon calls go to an API that's being switched off; fix forward instead. ## How it was verified `pnpm format:check`, the What's new tests and the API schema tests pass locally. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required - **What does a revert leave behind?** Nothing: the entry and the version number are in the tree. - **Does the release before it still work with that?** Yes. Written by Claude Opus 5.5 in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
…1426) ## What changed Effect moves from 4.0.5 to 4.1.4 (`effect`, `@effect/platform-node`, `@effect/sql-pg`, `@effect/sql-pglite`, `@effect/vitest`). People using Patchy see no difference. Nothing stored changes: tokens, digests, HMACs and sealed values are still made and checked by the same `node:crypto` code. This supersedes #1380, whose CI was red because 4.1 stores `HttpApiSchema.status` where our `refuse()` didn't look, so every refusal answered 400. Beside the Effect group, the lockfile moves only ws, to 8.23.0, which `@effect/platform-node-shared` 4.1.4 pins exactly. undici 8.12.4 and PGlite 0.5.16, which the 4.1 packages need, are already on main from #1424, so the workspace holds one PGlite again. ## Look at **Crypto.** 4.1 replaces `effect/Crypto` with per-family services and drops crypto from the runtime `*Services` bundles. The `Cryptography` seam stays as it was. `NodeCryptography.layer` now also provides Effect's `SecureRandom` and `Digest`, using Effect's own Web Crypto layers: no new dependency, nothing at import time, and the same behaviour on Node and Bun. Every entrypoint and test layer already provides it, so "provide `NodeCryptography.layer`" stays the one rule. The seven direct `effect/Crypto` users take `SecureRandom` or `Digest` instead. `@patchy/limits` can't depend on core, so `Digest` is what it uses. AGENTS.md, the service-conventions spec and the oxlint messages say this now. **Refusal statuses.** 4.1's `HttpApiSchema.status` writes a key annotation, which `SchemaAST.resolveAt` doesn't read. HttpApi's own reader, `getStatusErrorSchema`, is internal and missing from the published types, so `respond.ts` follows its rules exactly: 1. The last check that sets a status wins, looking into check groups too. 2. Otherwise the schema's own annotation counts, and an explicit `undefined` clears the status. 3. Otherwise the key annotation counts. 4. With none of those, the status is 500. `respond.test.ts` compares each case with HttpApi's own reader. One consequence: a schema with no status now answers 500, where it used to answer 400. No current refusal schema lacks one. **Request targets.** 4.1's server adapter turns an absolute-form target into its path, and sets `Host` to the target URL's host, which drops userinfo and the scheme's default port. The door's `Host` gate then saw a cleaned-up host, so `POST http://<public host>/mcp` and `POST https://user@<public host>/mcp` reached the bearer check instead of answering 421. `RequestTrust.requestAuthority` now reads the target and the `Host` fields from the Node request as the client sent them (`request.source`). Sources without raw fields, such as a web `Request` or the in-memory test client, keep the old reading. I also checked everything else that reads the target or `Host`: - The API guard, serving and the portal resolve `request.url` against the configured origin, and compare `Origin` rather than `Host`. They don't trust the target's authority, and the rewrite makes an absolute target reduce to its path. - The CLI dev server's DNS-rebinding guard compares `Host`. Browsers send origin-form, which the adapter leaves alone, so the guard still does its job. - Two private listeners now accept an absolute-form target where they used to refuse it before authentication, and the behaviour stays as it is. The callback gateway (`CallbackGatewayApi.ts`) used to answer `POST https://anything/callback` with 200 `invalid_request`; now it reaches the bearer and identity checks. The supervisor's callback proxy (`supervisor.ts`) looks up its callback path from the rewritten target. Neither grants anything the checks behind it don't already require. **Oversized uploads.** Under 4.1, an undeclared (chunked) body over its cap is answered instead of reset. But the adapter then keeps reading up to 256 KiB more with no deadline, so a sender that stalled kept its connection until the runtime's own timeout. A declared length over the cap had the same problem below 256 KiB, on origin/main as well. A size refusal now closes the connection, through one hook: `closeAfterAnswer` in `@patchy/api`. It adds `Connection: close` to the current request's answer, and the adapter then ends the socket and destroys it within its 500 ms grace. Measured here, the server closed it about 7 ms after answering, on Node and on Bun. Every capped reader runs the hook, for a cap crossed mid-stream and for a declared length over the cap. Each keeps its existing status and body: - `readBody`, for every JSON API route that reads one: 400 "Malformed request body." mid-stream, 413 declared. - The 16 form readers in auth and portal, through `capBody(maxBytes)`: beta links, device login, the OAuth token request and consent answer, machines, shortcuts, logout, terms, What's new, patch pages, sharing, home (two), feedback, user lifecycle, and pinning. Their declared-length prechecks run the hook too. - The runtime's call, file and stage readers (413), and the subscriptions stream (413). - The callback gateway: the file bound and the byte budget answer, as before, with a 200 refusal body. - The supervisor's callback proxy (413). One reader is left out: the MCP door reads a chunked body to its end by design, so its refusal is unchanged. The device start, device poll and shortcuts descriptions, and `docs/API.md`, say what the code does. Nothing is stored on any refusal. **Row ids.** 4.1's `SecureRandom.uuidV7` counts within a millisecond: 42 counter bits and 32 random. #214's contract test pins 74 random bits per id, and Effect's own docs say a monotonic id reveals the one minted before it. So `TableOperations` builds the UUIDv7 itself from the Effect clock and 16 bytes from `SecureRandom`, clamping the timestamp to the 48-bit field as 4.0 did. **Other behaviour 4.1 changed that tests asserted:** - A failed migration step is a typed `MigrationError` (`kind: "Failed"`) instead of a defect. Startup still fails and the process exits. - The CLI parser now splits `-json=true` into `-j -s -o -n`, so `jsonRequested` stops treating it as `--json`. A global flag's bad value (`--log-level loud`) now goes through Effect's usage path like any other parse error. That made the entrypoint's `InvalidValue` catch dead, so it is gone. Under `--json` stdout stays empty; without it, usage comes before the one line, as ADR-0004 allows. **Mechanical.** `SqlClient.make` takes a `driver`, and `sql.insert` takes a non-empty array. `docs/API.md` drops the eight duplicate `RuntimeFailure_N` components that differed only by status. **On top of the GitHub integration.** Everything on main since #1427 was written against 4.0.5: the GitHub App connection (#1448) and its reads (#1451), workerd binding its own port (#1444), CLI refresh (#1446) and sidebar pins (#1437). Checked against each 4.1 change: - **Crypto.** None of it uses `effect/Crypto`. `Cryptography` gains `rsaSha256Sign` for the App's JWT, which runs on `node:crypto` like the rest, and `NodeCryptography.layer` still provides it beside `SecureRandom` and `Digest`. - **Statuses.** It adds no routes and no status-bearing refusal schemas. GitHub's refusals reach clients through the existing connection pages, `ConnectionsApi` (whose declared errors HttpApi encodes itself) and the runtime, which takes its status from the error. The GitHub, connections and dev-read suites assert those statuses over `HttpApiTest` and real sockets, and pass on 4.1. - **Body reads.** The one new body read is the pin form, which provided `MaxBodySize` directly. It now goes through `capBody`. GitHub's connect flow adds none: its filter is a GET, and its choices post through the connection page's existing form read, which #1434 caps. - **Targets and `Host`.** The GitHub sign-in's redirect URI is built from the configured origin, and nothing new reads `Host`. - **The rest.** Nothing new calls `SqlClient.make`, the Migrator, `uuidV7` or `ws`, and no new flag uses a single-dash long spelling. **On top of Pidgeon's new API.** #1458 rewrote the Pidgeon integration against 4.0.5, and nothing in it needed a 4.1 change: - Its crypto goes through `Cryptography`. - It adds no routes, status-bearing refusal schemas, body reads or CLI flags. Its connect page posts through the connection page's existing form read, which #1434 caps. - It doesn't call `SqlClient.make`, the Migrator or `uuidV7`. - Its migration `0044_pidgeon_drafts` joins the record behind this branch's, and the record and upgrade tests pass. ## How it was verified **Red, then green, on Effect 4.1.4:** | Case | At 8980889 | Now | | --- | --- | --- | | `RequestTrust.test.ts`, the gate behind the real `NodeHttpServer` adapter: `POST http://cloud.patchyhq.com/mcp` | passed the gate | 421 | | `McpDoor.test.ts`, the whole server: `POST http://user@<host>/mcp` | 400 (past the gate) | 421 | | Same tests: origin form, the door's own absolute target (200), two `Host` fields | — | unchanged | | `AuthApi.socket.test.ts` (JSON) and `AuthPages.socket.test.ts` (form): an unterminated 8 KiB chunked upload | 400, connection still open at 3 s, on Node and Bun | 400, then closed, on Node and Bun | | `AuthApi.socket.test.ts`: `Content-Length: 8192` sent with no body (open on origin/main too) | 413, still open at 3 s, on Node and Bun | 413, then closed | | `RuntimeApi.test.ts`: a call streamed just past its cap, a stage upload streamed past its cap, and a stage upload declared past it | 413, still open at 3 s, on Node and Bun | 413, then closed | | `RuntimeStreamApi.test.ts`: a subscriptions body streamed past its cap | 413, still open at 3 s, on Node and Bun | 413, then closed | | `CallbackGatewayApi.test.ts`: a callback file body streamed past its bound | 200 refusal, still open at 3 s, on Node and Bun | 200 refusal, then closed | | `respond.test.ts`: a status set inside a check group | 409 | 403, as HttpApi | | UUIDv7 contract: a clock at −1 ms | timestamp field all ones | 0 | **Suites:** - On the head rebased onto main at 2a17d16, which now carries the Effect checker at 0.68 (#1425), `pnpm check` passes in full (3741 offline tests). - `pnpm verify` on the previous head, on main at 47deb91: - Pass in the full run: format, lint, typecheck, synth, the offline tests on Node (3732) and Bun (3405), postgres-concurrency and install. - Pass rerun alone: cli-smoke, tier2-smoke and the Chromium browser suite (189). In the full run they couldn't find the browser builds that Playwright 1.65 (from #1424) asks for; once installed, all three pass. - Could not start: the Firefox suite, because Firefox there lacks the system libraries it needs. CI's required `browser-firefox` job covers it, and it passed in an earlier round (186 tests). - The suites the Pidgeon rewrite touches pass on Node and on Bun (646 tests across 72 files each): all of `packages/integrations` and `packages/api`, the CLI's `pidgeon`, dev-resource and dev-preparation tests, and the server's migration record test. - The GitHub integration's suites, run alone on 4.1, pass on Node (361 tests across 27 files, with portal and the CLI's repo, global-CLI and dev-resource files) and on Bun (286 tests across 24 files; the CLI files run on Node only). They cover: - `github/Connections.test.ts`: connecting through the App against a stub GitHub on real sockets. - `github/Operations.test.ts`: the reads. - `github/Pages.test.ts`: the connect pages. - `github/Source.test.ts` and `Generate.test.ts`: the source and generated tables. - `ConnectionsApi.test.ts`, `ConnectionPages.test.ts` and `DevReads.test.ts`, with their status assertions. - `NodeCryptography.test.ts`, including RS256 signing. - Each rebase took main's lockfile and regenerated it with `pnpm install`; it differs from main's only in the Effect group and ws. - `install.test.ts` builds its PATH from the running Node, so these runs put the repo's pinned Node 24 first. - The supervisor's callback proxy gets the same hook, but has no socket test: reaching it needs a live workerd resident to register the callback path and capability. - Not checked: the server image (`server-image` needs Docker; CI runs it), live Clerk, and a deploy. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required This is a dependency bump, and the stored formats and the API's statuses and bodies are unchanged. Three things a client could notice: - An oversized chunked upload now gets its refusal and a closed connection, where it used to get a reset. - A declared length over a cap gets its 413 and a closed connection, where the connection used to stay open. - The undocumented single-dash `-json=<b>` spelling is no longer read as `--json`. `--json` and `--json=<b>` are unchanged. - **What does a revert leave behind?** Nothing: no migration, no new stored shape. Ids, tokens, digests and sealed values are made the same way on both sides. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 in T3 Code via Claude Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
## What changed A few forms never got a body cap, so the server read whatever was sent to them: creating or joining a company, People and Agent access, Teams, the integration connection forms, and the local dev server's agent door and shortcuts form. They now cap their reads as the rest of Patchy's forms do. A submission over the cap gets the answer that page already gives a form it can't read, and the connection closes. Builds on #1426, now merged, which added `closeAfterAnswer`. ## Look at **`capBody` now refuses a declared length over its cap before reading.** Until now it noticed an overflow only once the bytes arrived, so a sender that declared `content-length: 4097` to a 4 KiB form and sent nothing got no answer until Node's request timeout. It now fails at once, with the same `HttpServerError` the platform raises mid-stream. Each page answers it as it answers any unreadable form, and the connection closes after the answer. The forms in auth and portal that already read through `capBody` alone get the same: logout, terms, beta links, machines, What's new, patch pages, sharing, home, feedback and user lifecycle. Their answer is unchanged; it just comes without the wait. Readers that check the declared length themselves (`readBody`, device login, OAuth) answer their own 413 first, as before. With the new socket test over `capBody` without that check: ``` AssertionError: /join {"declared":4097}: expected +0 to equal 400 ``` With it, the test passes. **The caps**, each sized from the largest legitimate submission of its form: | Reader | Cap | Why | | --- | --- | --- | | `/join` (`Join.ts`) | 4 KiB | an invitation id, or a company name of up to 200 UTF-16 units (at most 9 bytes each once percent-encoded: 1,800 bytes) and a 32-character handle | | People › Invite (`CompanyPage.ts`) | 233,596 bytes (about 228 KiB) | worked out from the address schema: an address is up to 254 UTF-16 units, each at most 9 bytes once percent-encoded (a three-byte UTF-8 character; a four-byte one is two units, 6 bytes each), and a separator at most 9 (a comma or semicolon and a CRLF). The cap reads twice a full batch of those, so a longer paste is refused by its count, and 4 KiB more for the role and the list's filter: 2 × 50 × 2,295 + 4,096 | | People › role and Resend, Agent access (`CompanyPage.ts`) | 1 KiB | one hidden field each | | Teams, all five forms (`TeamsPage.ts`) | 8 MiB | a roster form carries up to two member ids per person (a shown member's removal and its keep box), about 70 bytes a person. Nothing limits how many people a company holds, so the cap sits far past any roster the page could show at once: about 119,000 people. It was 1 MiB (about 14,000 people) until acceptance submitted a 16,000-person roster and was refused. A team name is 100 code points (1,200 bytes at most) | | Every connection form (`formBody` in `ConnectionPage.ts`) | 256 KiB | Postgres's connection string may be 16,384 characters, up to 9 bytes each once encoded (147,456 bytes), beside a handle and a description | | Dev server `/~dev/agent` | `mcp.body.bytes` (1,114,112) | the call as Patchy MCP reads one: the tier 2 argument cap plus 64 KiB of envelope | | Dev server `/api/me/shortcuts` | 4 KiB | as Patchy's own `/api/me/shortcuts` reads it | **How an over-cap form answers** is how that page already answers an unreadable one: - Join, People, Agent access and Teams: the auth pages' 400 "Invalid form" door. - Connection forms, Pidgeon's and GitHub's included: the form again with 400 "The form could not be read. Submit it again." - Dev server shortcuts: 400 `Send value=on or value=off.` - Dev server agent door: the refusal Patchy MCP's door gives a body over its cap, `too_large` in the door's words, as the dev agent's usual answer, so `patchy dev agent` reports a refusal and exits 2 (below). A malformed call within the cap keeps its 400 `Bad request`. **An over-cap `patchy dev agent` call is the door's `too_large`.** A plain 400 would have made the CLI say the tool "may or may not have run" and exit 3, when the call was refused before anything started. A body over `mcp.body.bytes` is refused unread, so the dev server answers with the door's own refusal of such a body. That refusal, `bodyTooLarge`, now lives in `@patchy/api` beside the other shapes of a tool call's answer, and the door's 413 reads its words from there, unchanged. `patchy dev agent` then exits 2 with the door's words, as the README and ADR-0004 already say any refusal the door would give does; both now name this `too_large` beside the oversized read. Answered before the body is read, the CLI's own client (undici) still reads the refusal: a 1,114,155-byte call gets it, in each of four runs. **`test/socket.ts`.** `stalledUpload` reads the answer's `content-length` and rejects when the server closed before the whole answer arrived, so a close that cuts a refusal short no longer passes for one. It returns the body, so tests assert which refusal came back. Against a throwaway server, a whole answer resolves, one cut 5 bytes short rejects with "The server closed the connection 5 bytes short of its answer's body.", and a close with no answer rejects too. The five suites that already used it pass unchanged. ## How it was verified Each reader gets a body one byte past its cap over a real socket (`NodeHttpServer.layerTest`), twice: as one chunk that never ends, and as a declared length with nothing sent. Each must answer its whole refusal and close within 3 seconds. Routes that share a reader share one case. - `AuthPages.socket.test.ts`: Join, the four People and Agent access reads, Teams. - `ConnectionPages.test.ts`: the connect form, through the one `formBody` every connection form reads with. - `devServer.test.ts`: both dev server readers, inside the existing dev server test, so it boots once. The agent door's answer is the door's refusal, also sent through the CLI's own client; a malformed call within the cap is still a 400. - `cliDevAgent.test.ts`: `patchy dev agent` given that refusal exits 2 and prints the door's words, in text and `--json`. - `CompanyPage.test.ts`: a full batch of the longest addresses the page accepts (50 addresses, 114,924 bytes with the longest filter) is read and invites all 50; twice that (228,024 bytes) is refused by its count, "That is 100 addresses". The socket case refuses one byte past 233,596. Red, with one piece taken out at a time, then green with it back: | Taken out | Failing assertion | | --- | --- | | `capBody`'s declared-length check | `/join {"declared":4097}: expected +0 to equal 400` | | Teams' cap (at its first value, 1 MiB) | `/settings/company/teams/create {"chunked":1048577}: expected +0 to equal 400` | | The connection forms' cap | `{"chunked":262145}: expected +0 to equal 400` | | The dev agent door's cap | `POST /~dev/agent HTTP/1.1 {"chunked":1114113}: expected +0 to equal 200` | | The dev agent door's refusal (its plain 400 back) | `POST /~dev/agent HTTP/1.1 {"chunked":1114113}: expected 400 to equal 200` | | The invite cap's arithmetic (64 KiB back) | the full batch: `expected 400 to equal 303` | Existing page tests post real forms through `HttpServerRequest.fromWeb`, which enforces `MaxBodySize` as the socket does, so a cap below a legitimate form would fail them. They pass, including the 51-address invite refusal and every connection form. Rebased onto #1426's earlier head (`b1310609`, on main at `47deb913`, with Pidgeon's new API from #1458 and the dependency sweep from #1424), `pnpm check` passes in full: format, lint, typecheck, synth and all 3,736 offline tests. Neither #1458 nor #1424 added a body read. Pidgeon's connect form now posts through the shared `formBody`, so the 256 KiB cap covers it, and Postgres's connection string is still the largest thing a connection form carries. The suites this PR and the rebase touch pass on Node (810 tests, before the sweep landed: `packages/integrations`, `packages/companies`, `packages/api`, `packages/mcp`, the auth socket and company-page tests, and the CLI's dev-agent, dev-server and `pidgeon` tests). On Bun at this head they pass too (803; the dev-agent and dev-server files run on Node only). `pnpm verify` ran before the rebase, at the first commit, `6e54ccd5`, on a shared machine under heavy load (load average 40 to 60 during the test phases). Format, lint, typecheck, synth and every acceptance suite passed: postgres-concurrency, cli-smoke, install, tier2-smoke, browser and browser-firefox. The offline `test` and `test (bun)` phases each failed some tests: timeouts in files this PR doesn't touch, a different set on each run. Rerun alone at low load, all of them passed (10 files on Node, 6 on Bun). The socket cases ran in both phases, except `devServer.test.ts`, which is Node-only, as the CLI is. The installer suite needs `npm` beside the `node` it runs; with the pinned Node first on `PATH` it passes. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required: forms people submit read as before; only bodies past a form's largest legitimate size are refused - **What does a revert leave behind?** Nothing: no schema, rows or contract change. - **Does the release before it still work with that?** Yes. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, run from T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Allison Mahmood <[email protected]>


What changed
Pidgeon moved to a new platform and stops answering the API Patchy calls on 22 November 2026; connecting an address already fails, because calls it needs are gone. Patchy's Pidgeon integration now runs on Pidgeon's new API. An admin pastes a key from Pidgeon's dashboard, types the address of one inbox, chooses what patches may do, and patches list, read, label, triage and answer its mail as before.
The new API changed two things underneath us:
not_found, exactly as an unknown id does.Idempotency-Keythree times sent three emails). So Patchy keeps a ledger: each draft key's email is written as a Pidgeon draft, recorded, and sent at most once. When Pidgeon hasn't said whether an email left, the answer says so instead of sending again.Minting and revoking keys, creating addresses, domains and send policies are gone with the old API.
Closes #1457
Look at
1. The inbox boundary
packages/integrations/src/pidgeon/Operations.ts: lists and search always name the inbox and refuse a whole answer carrying another inbox's row (ours); a thread or message by id is shown only when it says it's the inbox's (ownThread,ownMessage); a held message by id, whose403 heldnames no inbox, answersnot_found; triage reads the thread first and checks a label against the inbox's own list (ownLabel); replies and sends are drafts in the connection's inbox only.Operations.test.ts› answers not_found for everything of another inbox, as for an unknown id, changing nothing: one key, two inboxes in the scripted double. The other inbox's thread, message, held message (read and as a reply target), label (on a thread, off a thread, as a list filter) each answer the exact failure an unknown id gets, and afterwards nothing changed there and nothing was drafted or sent. With the inbox check taken out ofownMessagethe test goes red:The same test covers another inbox's label taken off the connection's own thread, which passes the thread check and is refused by the label's. Beside it, refuses a conversation carrying another one's message, and an answer about another id: a thread read whose embedded message belongs to another conversation of the inbox fails whole, and a thread or message answered under a different id than asked is
not_found. The runtime journey (Runtime.test.ts) holds two inboxes under one key, one connection on each. The live tier does the same against Pidgeon with two inboxes the run makes (reads the desk's mail, and nothing of the other inbox).2. Sending once
pidgeon/Ledger.ts(one row per hash of connection, patch and draft key, with a claim) andsendOnceinOperations.ts, by the state an attempt finds:writingand charges the day's budget, in one transaction; budget spent inserts nothing. A claim whose acknowledgement was lost is read back, and carried on only when the row holds this attempt's token and emailwritingdrafted; a draft answered in another inbox is never touched, not even to delete itdraftedsending, then issues the draft's one send:201→sent,202→held; a refusal Patchy read in Pidgeon's words (its error envelope: a429in any other shape, or a422, which Pidgeon doesn't document, isn't one) →refusedand the draft is deleted; a401→refused, that draft never sent again; anything else → stayssending, answersunconfirmedsending/heldunconfirmedrefused401and Replace key, this writes a new draft and sends thatsentreplayed: trueEvery change after the claim is conditional on the claim's owner token, so a worker that lost its claim changes nothing. Offline tests cover a second worker arriving, a worker stopping after
sending, lost answers to the write and to the send, lost acknowledgements of the claim and of each change, a stale worker's write and release after takeover, each documented status of the write and of the send and the undocumented ones above, recovery by a draft's id refusing a message that's incoming, notsentor another inbox's, a member approving and rejecting a held email, a key refused at the send then Replace key and Pause/Resume (two drafts, one send each, one email), expiry by state (sendingandheldnever;sentfrom when it resolved, one approved late included; the rest from when they were made), a replay on a spent budget and the corrected email after a refusal. Each new check was taken out in turn and its test went red. Live: sent once though asked twice; a send carrying another conversation's text refused and its key freed.3. Connecting
The connect page works like Attio's and the mailbox's: what to make in Pidgeon, three fields, Key, Inbox and Patches may (Read, or Read and send), then Name it, Once connected and one Test and connect. There is no Find inboxes step, no page script and no list of the account's inboxes. Every sentence is in one
copyobject inpidgeon/Page.ts.Test and connect checks in this order, changing nothing in Pidgeon, and shows each refusal under the field it's about, as the mailbox page shows a bad login:
eventsinbox, under Inbox. The refusal names none of the account's other inboxes;Nothing is saved unless every check passes, and the key is never written back: a refused submit asks for it again. Replace key asks for the new key only and checks it reaches the same inbox and can do the connection's access (a Read key for a sending connection is refused under Key). Change access is the same Patches may select, a local change that re-checks the stored key when it raises access to send. The page no longer tells an Admin key apart: keeping that hint would have meant storing the key's level and an extra call at each check, for a line the Get it step already covers.
Captured on a local instance in Pidgeon's test mode, as the scenario's admin, with scenario data only. The page lists no inboxes, so nothing of the account's other inbox can appear.
4. The scenario's patch, on the new contract
The Support desk lists the scenario's mail (the three-message conversation includes a customer follow-up, threaded by the first message's RFC Message-ID), and one reply sent through it shows once, and still once after a reload.
5. What changed for patches
Builders' patches written for the old contract break where the new API forced a change. None exist in production. Every change, in
packages/api/src/pidgeon.tsand mirrored in the handwritten client, generation and thepatchy-pidgeonskill:threads.list: takesfolder(inbox,archive,spam,trash) andlabelId. A thread dropsfrom,previewandhasAttachments, and gainsfolder,labelsandunreadCount. Itssubjectis null while every message in it is held.threads.get: same shape, from one call; a held message appears withheld: trueand no content.messages.get:deliveryis gone;toandccnames are alwaysnull; a held message answersnot_found(wasaccess_deniedwith reasonheld).messages.search:textis required, 1 to 200 characters (words,"phrases",or,-word), newest first; thefrom,to,labelId,hasAttachmentandfolderfilters are gone;previewis the first 200 characters of the clean text.attachments.text: removed. Messages still list attachments' names, types and sizes.messages.reply/messages.send: same input. Output is{ status: "sent" | "held", messageId, threadId, replayed };rejected,testand thepending_approvalshape are gone. A reply goes to a received message's sender, or to the recipients of one the inbox sent. A sent key is remembered for a day after it went (was Pidgeon's 24 hours from the first send).idempotency_conflictgains reasonunconfirmed;access_deniedreasonsnot_permitted,blockedandheldare gone (exfiltration_blockedstays, now in Patchy's words);source_rate_limitedlosesrecipient_cooldown;source_unavailablegainsdetails.reasonsend_failed,unavailableorstorage_fullwhen Pidgeon said the mail couldn't go. No new codes.pidgeon.sends.dailycounts emails, once per draft key, not attempts. An email Pidgeon refused and that is retried as it was, as after Replace key, keeps its one charge; a corrected email under the same key is a new one.address.sendPolicyandplanare gone, and with them the context's Send policy and Plan lines. The generated client drops theAttachmentTextandDeliverytypes and addsFolder.How it was verified
pnpm verifyon this head: every step passed,All passed.: format, lint, typecheck, synth,test(336 files, 3723 tests),test (bun),postgres-concurrency,cli-smoke,install,tier2-smoke,browser(189) andbrowser-firefox(186).pnpm test:pidgeonwith the account's test admin, Send and Read keys, and onePIDGEON_TEST_RUN_IDfor all three files, as CI sets it:eventsinbox and Read and send with a Read key, with no POST, PATCH or DELETE sent but the level check. The page test refuses a wrong address under Inbox without the key or another inbox in the page, then connects. The test account held only its one original inbox before the run and after it.pnpm dev up pidgeonmade a test inbox with the admin key, delivered 10 messages in 6 conversations, then connectedpidgeon/supportthrough the new page with the Send test key at Read and send, and built and published the Support desk. By hand, as the admin: a wrong address was refused under Inbox, a Read key with Read and send under Patches may, the right address typed in capitals connectedpidgeon/desk, and Replace key with a Read key was refused under Key.pnpm dev downdeleted the inbox./email/test/inboundnames the first message'srfc_message_idfrom the event log (not its message id); test inbound takeshtml, and hidden instructions in it are held; sending a draft that doesn't exist answers403belowsendand404from it up, which is how Patchy tells a Read key without changing anything.Not verified:
201s for eight simultaneous sends in test mode) is still with Pidgeon; Patchy issues one send per draft whatever the answer.202 heldand approval are covered offline only.PIDGEON_TEST_SEND_KEYandPIDGEON_TEST_READ_KEYas secrets turns them on; the workflow already passes them.Release impact
The patch-facing Pidgeon contract changed (above), the stored credentials and display changed shape, and the snapshot is version 2. Migration
0044removes the Pidgeon connections made by earlier releases, with what hangs off them, and every stored Pidgeon snapshot: they could not have worked on the new API, and left in place they made their company's whole connection list fail to read. An admin connects such an inbox again with a key from Pidgeon's dashboard. Production holds no Pidgeon connection and no patch version that declares Pidgeon, so nothing running breaks.pidgeon_draftstable (additive, migration0044), the removal of Pidgeon connections and snapshots made by earlier releases (a revert doesn't bring them back), and any Pidgeon connection made on this release, whose credentials, display and snapshot are in the new shape.one-wayfor that reason.Hit every surface
packages/api/src/pidgeon.tsandpidgeonSnapshot.ts→ the server's operations, the shell broker (it validates with the same schemas),patchy list connectionstext and--json(the snapshot's fields), anddocs/API.md, regenerated.packages/patchy/README.mdand the globalpatchyskill updated where they described Pidgeon, with its hash inskills-lock.json. Thepatchy-pidgeon,patchy-loopand SDK capability text follow the new contract.scripts/devmakes the scenario's inbox with the admin key and delivers its mail, then connects it through the page with the Send key, filling in the key, the inbox's address and Read and send in one submit. The environment's record says whether an inbox's mail all arrived: a resumedupdelivers nothing to one that finished, and replaces one that didn't with a new inbox filled from the start. One exception: an environment that an earlier build of this branch connected before its mail had all arrived keeps that inbox, says so, and is started over withpnpm dev reset.downdeletes only the inboxes it recorded;docs/DEVELOPMENT.md,scenarios/README.mdand thepatchy-dev-loopskill follow. The seed and the vitest template are untouched.packages/integrations/GLOSSARY.md(inbox, Pidgeon key, inbox boundary, send ledger; address key, admin key, send policy and recipient cooldown gone),GLOSSARY-MAP.md, the portal glossary,docs/product.md(Connect now describes the one submit and its refusals), thepidgeon.addresses.listedlimit's wording (now the inboxes Patchy looks through for the address typed;docs/limits.mdregenerated),docs/OPERATIONS.mdand ADR-0013. What a tier reaches didn't change; the global skill's Building a tool section only rewords Pidgeon.0044_pidgeon_draftsin the integrations capability, the next id in landing order. It also deletes what the old integration left, with an upgrade test inapps/server/src/migrations.test.ts.ui-consistency; the frame'sscriptslot, which only Pidgeon used, is gone (GitHub still usesafter,choose,readyandoutside). Find inboxes' route and the page script's route are gone, and with them their entry inapps/server/src/Moved.ts. No bundle-check change.Built with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code