Repository navigation
feat(integrations): connect a Pidgeon address with an admin key - #921
Conversation
An admin pastes a Pidgeon admin key, picks an address it reaches or creates one, and chooses Read or Read and send. Patchy mints a key for that one address at that access, checks it and keeps only that; the admin key is never stored. The connection page offers Rotate key (no admin key), Change access, Replace key, disconnect and delete, and builders declare it with `patchy add pidgeon/<handle>`, which generates the context alone until #825 adds operations. The Pidgeon source, the fake account, the address snapshot, the limits, the connect page's tile and choice-card components, a `pidgeon` dev scenario and an opt-in live test come with it. Closes #824 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… drop Rotate key Allison cut Rotate key from v1: Replace key and Change access are the one way to a new key, and the pending-rotation record, its grace period, route, page state and limit go with it. Test admin keys now connect, to test addresses in their own mode. The connection keeps its mode and shows "Test · mail stays in Pidgeon" wherever it's listed; its snapshot, CLI detail and generated context say so too. Connect reads key.test and reaches_all_addresses from /me. Every write sends an Idempotency-Key and is sent again under it while its answer is lost, waiting out idempotency_in_progress. A lost mint answer comes back as a replay naming the key without its secret, which Patchy revokes before minting once more; a key it can't account for is named. 429 refusals say when to try again from Retry-After. The in-process fake is gone. Offline tests seed connections and answer revokes and reads; everything Pidgeon does moves to the live tier against pidgeon.ai's test mode with PIDGEON_TEST_ADMIN_KEY, paced and cleaned up by run tag, run in CI as pidgeon-live when the secret is set. The pidgeon dev scenario uses the developer's test key, or says so and skips Pidgeon. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…test key Co-Authored-By: Claude Opus 5.5 <[email protected]>
…red budgets Co-Authored-By: Claude Opus 5.5 <[email protected]>
307aa62 to
4b1caed
Compare
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d the list's test mode Co-Authored-By: Claude Opus 5.5 <[email protected]>
The sweep touches only test keys Patchy named below admin, and the partial admin key case moves offline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… as its own queued workflow The suite and the sweep script check the admin key's own /me and stop before any change unless it is a test key. A run stops using Pidgeon 20 minutes after it starts, as the job does, and the stale sweep only takes what is three run limits old, addresses first, then the keys that reach nothing. CI's live job moves to its own workflow, one account-wide queue with nothing cancelled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r stored ids They read the key ids the instance's connections store and revoke only test keys Patchy named below admin, with the developer's test key, before wiping anything. When the instance is stopped or Pidgeon won't revoke one, they say which and remove nothing. A scenario only connects Pidgeon with a test key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…read by port Every dev instance's database has the same name and credentials, so reading key ids by port could read another worktree's instance, and the scenario stood in for whether the environment had connected. Now up records each test address it asks Pidgeon for in the environment folder, and down and reset take those down with the test key, no instance needed: they revoke each Patchy-named test key below admin that reaches only those addresses, delete the addresses, then wipe. If any of it fails they name the addresses and remove nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o run A required check passes when its job is skipped, so a failed or timed-out pidgeon-changes would have skipped the live job and passed. The suite is now pidgeon-suite, in the account-wide queue, and pidgeon-live always runs and passes only when pidgeon-changes decided and the suite passed, or was skipped because nothing it exercises changed or there is no key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ways reads it up writes the record beside the old one and renames it over, so a crash or a full disk mid-write never loses addresses recorded before. reset takes the recorded addresses down whatever plan.json says, before anything else. An address Pidgeon already deleted is named, with its key left to the stale sweep, and the record goes once everything in it is handled. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only a suite that ran and passed, or one skipped because pidgeon-changes decided not to run it, passes; an empty decision or any other combination fails, naming all three values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…geon already deleted Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Review notes from the GPT 6.1 Sol rounds 6 and 7 that weren't fixed, with reasons.
Every other round 6 and 7 finding is fixed in 3b264a1, 3968c3f and 79242ce. |
Acceptance: PASS with notesChecked Done means
Golden journeys and additional risks
Rollback answers: match the diff, and the Not run
Notes
Both the instance data and scenario workspace were confirmed absent; the three started processes were gone and their systemd scope inactive. The browser tab was closed. No extra worktree or evidence instance was made. The checkout is clean at the checked detached head. |
…ss (#954) ## What changed A Pidgeon connection gave a patch an address it couldn't use: the generated client had no operations. Now a tier 1 page, or a tier 2 action through `ctx.connections`, reads the address's conversations, messages, search, labels and text attachments, and with a `send` key replies, sends and triages from it. Patchy writes every request and fills in the address, so patch code never names a path, an address id or a key. A draft is one email, a held send is never mistaken for a sent one, and each connection has a daily send budget. `pnpm dev up pidgeon` gains Lumen Bikes' Support desk, with customer mail delivered through Pidgeon's test mode. Closes #825. Part of #822. Stacked on #921 (#824 connections); #826 (dev reads) stacks on this. The three ship together in one release with no flag, so don't deploy this alone. ## Look at - **One draft, one email** (`pidgeon/Operations.ts`, `sendDraft`). A send's `idempotencyKey` names one email; Pidgeon's `Idempotency-Key` is `sha256(["pidgeon.send", connection, patch, draft])`, 64 hex. The same draft within 24 hours answers the first send with `replayed: true`. Pidgeon's 409s fail `idempotency_conflict` with `details.reason` `mismatch`, or `in_progress` with `retryAfter`, and nothing is sent; Patchy never retries. A draft sent again after Replace key is `mismatch`, because Pidgeon counts the calling key. Live, against Pidgeon's test mode: the same draft sent twice answers the same `messageId` with `replayed: true` and the thread gains one message; a dropped answer (`Pidgeon-Test-Fail: drop`) replays; different mail under a used key, and a used draft after Replace key, fail `mismatch` and the thread doesn't grow. - **A held send is never sent** (Pidgeon SDK 1.43). A send answers a union on `status`: `sent` with `messageId` and `rejected`, or `pending_approval` with `draftId` and `approval { reason, expiresAt }`. The pending side has no `messageId`, so a patch has to read `status` first; a type test pins it. - **Mail read with care** (SDK 1.39–1.42). Messages are firewall-cleaned plain text with the verdict and the kinds it found, never a signal's quoted `detail`. A message Pidgeon Firewall holds has `held: true` and no content, and reading or answering it fails `access_denied` with `reason: "held"`. `exfiltration_blocked` is a typed `access_denied` too. `delivery` carries a sent message's state. - **The send budget.** `pidgeon_sends` (migration `0028`) counts each send and reply per connection per UTC day in one atomic upsert before Pidgeon sees it; past `pidgeon.sends.daily` (200 to start) a send fails `source_rate_limited` with `limit: "budget"` and nothing is sent. The connection page shows "Sends today N of 200". Offline: five concurrent sends with two left let exactly two through, a new store reads the same count, and the count goes with its connection. - **A read connection writes nothing.** Its generated client has no write methods, and the host refuses a hand-made `pidgeon.write` `access_denied` before Pidgeon sees it. Queries, mutations and read-only actions can't call it either (gateway test). - **Recent calls never hold a body.** A send records its subject and recipients (capped at 500 characters, "+N more"), a reply its message and CC, triage its status or label, a read its ids. A sentinel body and search text run through the tier 1 runtime and appear in no `runtime_calls` row and no log line. ## Decisions to overturn The coordinator accepted these; each is a product call Allison can reverse. - **A held send counts against the budget**, like every attempt, and its replay counts again. The skill tells patches to show "waiting for approval". Patchy v1 has no approval-status operation. - **`delivery` is exposed** as `{ state, deliveredAt }` on messages, so a desk can see a reply bounced. Per-recipient diagnostics aren't. - **`abuse_blocked` stays a generic `access_denied`** with Pidgeon's message, and Pidgeon's other 409s (`conflict`) become `invalid_request`. - **Address checks.** Reads check what Pidgeon answers against the address and drop or refuse anything else, and a thread's page keeps only that thread's messages; writes and `attachments.text` rely on the key reaching only its one address, which connect verifies. - **A call that waited for a slot rechecks its viewer** in the member directory before it sends, one indexed read per call, so a viewer deactivated while queued sends nothing. ## How it was verified - `pnpm verify` on the head before the live fix's test-only commit: `PASS format, lint, typecheck, synth, test (231 files, 2,400 tests), postgres-concurrency (28), cli-smoke, install, tier2-smoke, browser (81)`, "All passed." - Offline Pidgeon tests over answers shaped from Pidgeon SDK 1.43.1, with fields the wire leaves out: every request as built; every refusal before upstream with zero requests (undeclared, wrong kind, public, cross-company, deactivated viewer, read connection, bad ids and draft keys, a body past 100,000 characters, `undefined` options, extra keys); each Pidgeon status as its runtime refusal; the budget; `in_progress` with `retryAfter` from a recorded answer; and a call that waited while its viewer was deactivated or its connection disconnected, which sends nothing. - Packed journeys over the same answers: the generated client through the runtime API as a signed-in viewer, and a tier 2 action in workerd through the callback gateway. 100,000 characters of six-byte escapes and of emoji reach Pidgeon on both tiers; past `runtime.pidgeon.bytes` (1 MiB) nothing does. - **The live tier, locally, once in full and once for this file after a test fix.** `pnpm test:pidgeon` against Pidgeon's test mode with the test admin key: - Full run: #921's `Pidgeon.live.ts` passed 7 of 7 (`81 calls, 7 keys minted, at most 3 active at once`). `PidgeonOperations.live.ts` passed 2 of 9: the tier 2 action, and another address's mail answering `not_found`. The other seven failed on the test's own bugs: `POST /test/inbound` takes a bare `from` with `from_name` beside it, and refusals' `details` carry Pidgeon's message beside the reason. - After the fix, `PidgeonOperations.live.ts` alone: `9 passed (9)` in 151 s, `119 calls, 3 keys minted, at most 2 active at once`, and each block's sweep revoked its key and deleted its 2 addresses. - **What the live file covers.** - A tier 1 page lists the open conversations, reads a three-message thread two to a page to its end, reads a text attachment, replies once though sent twice, and marks the thread waiting. - A tier 2 action does the same; the page's draft sent again is one email. - Lost answers, mismatched mail and a draft sent twice at once. - A reply-only refusal, then the fixed draft sent under the same key. - A held send under first-contact approval, `pending_approval` with reason `first_contact` and the same on replay. - A `rejected@` recipient comes back in `rejected`, the same twice. - Held mail, unreadable and unanswerable with reason `held`. - Replace key. - **Key cap.** The harness now fails a test before it would hold more than 6 of the run's keys and prints the most it held: 3 at most here. Address changes (open sends, first-contact approval, `hold_suspicious`) go through `Live.reconfigure`, which refuses any address the run didn't make. - **`pnpm dev up pidgeon`** (under `systemd-run --user --scope`) connected `pidgeon/support` to a new test address, printed `10 messages in 6 conversations delivered through Pidgeon's test inbound mail`, and published the Support desk. As Allison, the desk lists them by status (Open 4, Waiting 1, Resolved 1). The flagged phishing message shows Pidgeon's verdict with its hidden text removed, and the order thread shows its label and the desk's reply. `pnpm dev down` printed `revoked 1 key and deleted 1 test address this environment made`. An `up` resumed after it had connected (its manifest marked incomplete) printed `already connected`, kept its one recorded address and replayed the mail there: still six conversations. Test inbound mail carries no attachments, so the scenario has none; the live tier reads one. The test address is masked in these captures.  <details><summary>The flagged message</summary>  </details> What isn't checked: `patchy dev` can't run Pidgeon calls until #826; they fail `invalid_request` there, as the skill says. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Additive: two runtime operations, one runtime code (`idempotency_conflict`), three registry limits, a project skill and a table no earlier code reads. Existing patches, connections and commands behave as before. Part of the #921 → this → #826 stack, which ships in one release. - **What does a revert leave behind?** The `pidgeon_sends` table and its rows; mail patches sent, replies and triage changes in companies' Pidgeon accounts, and drafts held for approval there; and patch versions whose generated client calls `pidgeon.read` and `pidgeon.write`. - **Does the release before it still work with that?** Yes for everything but those patches: it ignores the table, and it hides Pidgeon connections and their calls, as #921 set up. No for a patch whose current version calls Pidgeon: it needs this release to serve, so recovering it means rolling forward. Hence `one-way`, as on #921. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ulates sends (#955) ## What changed `patchy dev` couldn't run Pidgeon at all: every call failed `invalid_request`, so a builder's agent built a support desk against mail it never saw. Now `patchy dev` reads the connected address's real mail through the instance's dev read door, as the builder, and simulates every send, reply and triage. Dev's output names what it would have sent, and nobody receives anything. Closes #826. Part of #822. **Ships in one release with #921 and #954**, and stacks on #954. ## Look at **1. Pressing Send in the Support desk under `patchy dev` sends nothing.** On `pnpm dev up pidgeon`, I started the workspace repo's `pnpm patchy dev --json` with the agent launcher's environment, then drove the desk in Chromium: list, open, type a reply, press **Send reply**. ``` listed 4 conversations opened conversation 1: 1 messages notice: Sent to Lumen Bikes Billing. after the send, the reloaded conversation has 1 messages ``` `dev.log` names the simulated reply. This session logs JSON; a text session prints `<viewer> pidgeon/support messages.reply <id>: simulated in dev, nothing reached Pidgeon`. ```json {"type":"simulated","viewerId":"usr_env_lumen_allison","connection":"pidgeon/support","operation":"messages.reply","summary":"messages.reply <message id>"} ``` The connection's recent calls on the instance show only Dev reads, the last one being the desk's reload after the send. There's no write: ``` Dev patchy dev on Dev environment threads.list Allison Mahmood 6 rows Succeeded Dev patchy dev on Dev environment threads.get <thread> Allison Mahmood 1 row Succeeded Dev patchy dev on Dev environment labels.list Allison Mahmood 5 rows Succeeded Dev patchy dev on Dev environment threads.get <thread> Allison Mahmood 1 row Succeeded ``` `pnpm dev down`: `Pidgeon: revoked 1 key and deleted 1 test address this environment made.` **2. A repo whose only live integration is Pidgeon gets the machine key.** `patchy dev` handed its key to the daemon only when PostHog was declared. `devLifecycle.test.ts` › "hands the key to a repo whose only live integration is Pidgeon…", run over #954's `devLifecycle.ts`, `dev.ts` and `devPreparation.ts`: ``` AssertionError: {"ok":false,"source":"patchy","error":"The instance refused this machine's key: it expired or was revoked, or your account was deactivated. …","code":"access_denied"}: expected 403 to equal 200 ``` …and over this head: `Tests 1 passed | 11 skipped (12)`. **3. The door reads Pidgeon as a published read does, and refuses writes.** `packages/integrations/src/DevReads.ts` runs `pidgeon.read` through `pidgeon/Operations.ts`'s new `devReads`, with the same address checks, slots and held-mail handling. It answers `pidgeon.write` `invalid_request`, logged. `DevReads.test.ts` › "Pidgeon in patchy dev" covers: - both viewers reading as the machine's person; - held mail staying empty; - a write sent straight to the door, refused; - simulated writes reaching neither the door nor Pidgeon; - a `read` connection's write refused exactly as a published one is; - a revoked key, a deactivated person and a disconnected address stopping reads while simulated writes keep working; - slots shared with published reads, and the key checked again after the wait (I confirmed the test fails without the fix). Live: the new `PidgeonDev.live.ts` reads a fresh test address through the door, finds held mail empty, and shows that a simulated reply leaves the next read unchanged. ### Decisions you can overturn 1. **No `pending_approval` in dev.** A simulated send always answers `sent`. The snapshot doesn't carry the address's approval setting, so dev can't know when Pidgeon would hold a send. 2. **A simulated send's or reply's `threadId` is a `dev_` id.** Dev can't learn a reply's thread without reaching the instance. Reading a `dev_` id answers `not_found`, so the desk's new-email view opens onto `not_found` in dev; the skill says so. 3. **Per-operation body bounds at the door.** The door reads a body up to the largest live bound, `runtime.pidgeon.bytes` (1 MiB), then holds each operation to its own; `runtime.posthog.bytes` stays 256 KiB. A garbage body between 256 KiB and 1 MiB now answers 400 instead of 413. 4. **PostHog's dev client moved into `DevDoor`.** `posthog/Dev.ts` is now a thin binding over `packages/integrations/src/DevDoor.ts`, which Pidgeon's binding uses too. Its errors' tags changed from `PostHogDev*` to `DevDoor*`. Tags aren't on the wire, and PostHog's messages are unchanged. Also settled on #826: - Triage answers are partial: `threads.update` returns the id and the new status, and `threads.label` returns the label when the snapshot lists it. - Dev doesn't apply the send policy, replays, the daily budget, or exfiltration and held-reply refusals. ### Changes to #954's code - `pidgeon/Operations.ts`: - A read's context no longer carries a patch id; writes keep it. - `perform`'s tail became `atAddress`, which the door shares. It also hands the door's refusal of its caller after a slot wait back unchanged. - New `devReads`. - Published behaviour is unchanged, and #954's suites pass. - `api/pidgeon.ts`: `PidgeonDevRead`, additive. - `pidgeon/index.ts`: `live: ["read"]`. - `pidgeon/Generate.ts` and the `patchy-pidgeon` skill now say what dev does. ## How it was verified - **`pnpm verify`** on `c14b999`: all ten suites passed (format, lint, typecheck, synth, test, postgres-concurrency, cli-smoke, install, tier2-smoke, browser). The only difference between that commit and this head is #954's last commit, which changes the Support desk's `App.tsx`, and no verify suite exercises that file. - **The live tier, once**, on this branch: 3 files, 19 tests passed. The account's keys stayed under the harness cap: ``` PidgeonOperations.live.ts 87 calls, 2 keys minted, at most 2 active at once; swept 1 key and 2 addresses after PidgeonOperations.live.ts 119 calls, 3 keys minted, at most 2 active at once; swept 1 key and 2 addresses after Pidgeon.live.ts 81 calls, 7 keys minted, at most 3 active at once; swept 1 key and 1 address after PidgeonDev.live.ts 31 calls, 1 key minted, at most 1 active at once; swept 1 key and 1 address after ``` - **`pnpm dev up pidgeon`**, the desk under `patchy dev`, then `pnpm dev down`: as above. Every surface #826 named: - the wire: `devRead.ts` and `docs/API.md`; - the CLI: `packages/patchy` dev, its README and ADR-0004's `dev.log` lines (no flag or exit code moved); - the dev loop: `docs/DEVELOPMENT.md` and `patchy-dev-loop`; - the global `patchy` skill with its lock hash, and the project skills; - the Integrations glossary, with a new "Simulated write" entry, and `GLOSSARY-MAP.md`; - `docs/product.md`; - ADR-0013, which now says writes never run live in dev and names Pidgeon beside PostHog, with #819's invoice trial as the evidence. There's no migration. Prototype #819's fixture door never reached this stack, so there was nothing to remove. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required Dev only: the door gains one read operation, `patchy dev` gains Pidgeon's binding, and nothing a published patch does changes. - **What does a revert leave behind?** Dev calls in `runtime_calls`, in the shape PostHog's dev reads already use: machine credential, no patch, `op` `pidgeon.read`. No schema, and no mail, since dev never sent any. - **Does the release before it still work with that?** Yes. It already reads machine calls, and its `patchy dev` fails Pidgeon calls `invalid_request` as before. The stack's own rollback story is #921's and #954's. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
… patchy survives a Node update (#962) ## What changed This PR adds release 20's What's new entry, written from `c5175bd`. It covers everything merged since release 19's `through` (`156a228`), and it sets the `patchy` release to `0.20.0` in `packages/patchy/package.json` and `CURRENT_RELEASE`. With this release patches can read and answer a company email address on Pidgeon, and the `patchy` command keeps working after a Node version change. | Change | PRs | | --- | --- | | New: Patches can read and answer a company email address | #921, #954, #955 | | Fixed: The patchy command survives a Node update | #944 | | Behind the scenes: Patchy keeps only a key for the connected address, never the Pidgeon admin key | #921 | Two merged PRs get no line: #941 is release 19's own entry, and #945 adds CI install checks on macOS and Windows, which is tooling. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. Its labels are the pages' own: Integrations, Read, Read and send. The 200 sends a day is `pidgeon.sends.daily`'s default. The Node fix says what #944's Release impact asks of the note: people whose terminal doesn't look in `~/.local/bin` are shown the line to add when they rerun the install line. - **Rollback safety, from the live commit `fe8a0f2` to `c5175bd`.** Three PRs in the range are labelled `one-way`: - **#921 and #954 (Pidgeon).** Release 19 hides Pidgeon connections and ignores the new `pidgeon_sends` table, but a patch whose current version declares or calls Pidgeon needs this release to serve. Recovering it means rolling forward. - **#944 (CLI install).** On machines where the new installer put `~/.local/bin/patchy` ahead of Node's own bin on PATH, release 19's install-and-login line refuses after installing. Those people would need to clean that up by hand. - **#955 and #945** answer both Release impact questions with "Yes". `rollback-rehearsal` passed on every landed head, including #954's migration `0028`. ## How it was verified - **Tests.** `whatsNew.test.ts` (4), `WhatsNewPages.test.ts` (6), `schemas.test.ts` (11) and the skill lock (1) pass. Typecheck passes for core, api and the CLI, and so do prettier and eslint on the changed files. - **The stack.** #921, #954 and #955 each had GPT 6.1 Sol reviews to merge-ready and an acceptance verdict of PASS with notes. Each landed after all 21 checks passed on its rebased head, `Pidgeon live` included. Each rebase left the tree byte-identical to the accepted head, and `main`'s tree at `c5175bd` is identical to #955's accepted `cce5019`. - **Deploy state.** The live commit was pinned from `/healthz/deep`: `fe8a0f2`, release 19. 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 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 20 would just see no new release. - **Does the release before it still work with that?** Yes. Rolling back past #921 and #954 would stop any patch whose current version uses a Pidgeon connection from serving, and rolling back past #944 would break the install-and-login line on machines where the new installer put `~/.local/bin/patchy` ahead of Node on PATH; fix forward instead. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
…967) ## What changed Companies keep their customers, deals and pipelines in Attio, and Patchy had no way to connect it. Now an admin pastes a read-only Attio access token and Patchy checks it, reads the workspace's objects, lists and attributes, and keeps that shape. A key that can write is refused, naming the scope. A builder runs `patchy add attio/crm` and gets the declaration and a context listing every object, list and attribute. Patches can't read records yet: that's #966, built on this branch's first commit, and the two ship in one release. Closes #965. Part of #963. ## Look at **The connection page, direction A** (Allison's pick from the [mocks](https://post.patchyhq.com/d/qvtk8f9qngx3)). It opens with the options discovery skipped and what it left out, then each object and list as a counted row that opens to its attributes. Ten rows show per group and the rest fold behind "N more". Captured over the offline Attio double with synthetic data, the `deals` row opened:  **A key that gained a write scope.** Test, Refresh and Reconnect each run the key check. When it finds the stored key can write, the connection is disconnected exactly as Disconnect does it, unless a concurrent Replace key already saved a newer key. The page keeps naming the scope, whose check found it and when, and the way back:  <details><summary>Refusals at the key field: a write scope on connect, a key from another workspace on Replace key</summary>   </details> **The key check fails closed** (`attio/Source.ts`). `GET /v2/self` must answer an active workspace token holding Records, Object configuration, List entries, List configuration and User management at Read, with no `:read-write` scope and a workspace id. Extra read scopes are accepted. Each refusal names what to change. A deleted key answers like an unknown one (#964's last checks), so both read as "Attio doesn't know this key". **Discovery** reads every object, list and attribute (`show_archived=true`, so archived attributes can be named), then select and status options while it has budget: 45 s or 2,000 requests. It marks the attributes it skipped and never drops one. Every bound in the limits registry refuses the moment it's passed, saving nothing. Connect is one submit: the check refuses within a second, then discovery runs for at most 60 s. A second submit by the same name while one runs is refused, `connect_in_progress`. **Admission.** At most 4 calls and discoveries per workspace per process, shared by every connection to it, inside 6 for all of Attio. `AttioSource.send` and `withSlot` are what #966's runtime calls use. Peak memory with all 6 slots at their worst (five calls each collecting and decoding a 16 MiB answer, beside a discovery producing a 7 MiB, 50,000-attribute snapshot) was 292, 353 and 293 MiB above baseline over three runs. That's under the 512 MiB the parent sets, so the host bound stays at 6. **The live tier never blocks a merge.** `pnpm test:attio` reads Patchy's probe workspace with the read-only key. The `Attio live` workflow runs it on main and on this repository's PRs that touch Attio, queued and never cancelled, with Pidgeon's fork and Dependabot exclusions. `attio-live` is informational and not meant to be required. The case about a custom object skips once the workspace drops to Attio's Free plan. Pidgeon's live config and harness now name only Pidgeon's files (`harness.ts` → `pidgeonHarness.ts`). <details><summary><code>patchy add attio/crm</code> in a <code>pnpm dev up attio</code> environment</summary> ``` $ patchy add attio/crm --json {"ok":true,"alias":"crm","declaration":{"kind":"attio","handle":"crm"},"generated":["patchy/_generated/client.ts","patchy/_generated/index.json","patchy/_generated/manifest.json","patchy/_generated/context/crm.md","patchy/_generated/uses/crm.ts"],"skills":["patchy-attio"],"addedCapabilities":[],"warnings":[]} $ patchy list connections attio/crm attio/crm Northwind's CRM in Attio: companies, people, deals and the sales pipeline. connected Workspace: Patchy (patchy) Snapshot revision: 1 Objects: probe_deals (Probe deals) record_id: text … ``` </details> ## How it was verified | Done means (#965) | Shown by | | --- | --- | | An admin connects the probe workspace as `attio/crm` with `Patchy read` and sees its objects and lists | `pnpm dev up attio` connected it through the connect page in a browser: 7 objects, 7 lists, 373 attributes, one archived attribute named. Live: "replaces a connection's key with the same key" | | `Patchy setup` and `Patchy bare` are refused, naming the scopes | Offline over the same answers: setup → "List configuration, List entries, Object configuration and Records are Read-write"; bare → the four missing scopes named (`attio/Source.test.ts`, `attio/Connections.test.ts`). The setup key never ran anywhere | | A builder runs `patchy add attio/crm` and gets the declaration and context file | Above, and `cliRepo.test.ts` "adds an Attio declaration with its context and skill, and removes them again" | - `pnpm verify`: all passed (format, lint, typecheck, synth, 2,438 tests, postgres-concurrency, cli-smoke, install, tier2-smoke, browser). - `pnpm test:attio` with the read key: 4 passed in 19 s, 234 requests, none rate-limited. Making the custom-object case look for a missing object skips it rather than failing. - Offline over the scripted Attio (`test/attio.ts`, hand-written in the probe's shapes): - every key-check refusal; - discovery paging, each bound, the option budget, the deadline, and the exclusions; - every error class; - the write-scope disconnect: zero upstream calls after it, the admin attributed, a concurrent Replace key left connected, and Reconnect after the fix; - Replace key from another workspace, and a failed rediscovery leaving the old key and snapshot; - `busy` across two keys to one workspace; - the pages; - rollback: the release before hides an Attio row and its snapshot, and older CLIs never list one. - Not checked: none of #966's reads. Allison's two remaining probe steps are answered on #964 (a scope edit shows in `/v2/self` within seconds; a deleted key reads as unknown). ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required New integration, no migration. The `connections` API adds `attio` rows only for callers that ask for them, and `DeclarationMetadata.attio` defaults to empty for older generations. It ships in one release with #966 and isn't deployed alone. **One-way: production can't roll back past this release while any patch version declares an Attio connection.** The release before can't decode a manifest that declares `kind: "attio"`, so it can't serve those patch versions. The only recovery is rolling forward to this release or later (`docs/OPERATIONS.md` › Rolling back), as with Pidgeon's #921. - **What does a revert leave behind?** Attio connection and snapshot rows in the existing `connections` and `connection_snapshots` tables, each connection's read-only key encrypted under the keyring, and any patch version that declares an Attio connection. Nothing is created or changed in anyone's Attio workspace. - **Does the release before it still work with that?** **No** for patches whose current version declares Attio: they need this release to serve, and recovering them means rolling forward. Everything else, yes. The release before reads only the integrations it ships (#657), so Attio rows stay hidden from its connections page, `patchy list connections`, lookups and deletion checks, and its CLIs never ask for them. Tests run that release's integration list against an Attio row, and an older CLI's integration filter against the API. Rolling back is safe only while no published patch version declares Attio. Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through T3 Code. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- patchy-dev:compare:connect --> #### Before and after, as Ada Park (admin) Before is `a4df431` (where this branch left main) and after is `61594b0` (feat/attio-connections), both on the `team` scenario, from `pnpm dev compare`. ##### `/company/connections/connect` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company/connections/connect/attio` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | - Before at 1280px answered 404; 1 browser error(s): `Failed to load resource: the server responded with a status of 404 (Not Found)`. - Before at 390px answered 404; 1 browser error(s): `Failed to load resource: the server responded with a status of 404 (Not Found)`. <!-- /patchy-dev:compare:connect --> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
What changed
Companies that run their mail through Pidgeon had no way to give patches one address. Now an admin pastes a Pidgeon admin key, live or test, picks an address it reaches or creates one, and chooses Read or Read and send. Patchy mints and keeps a key for that one address at that access, and never stores the admin key. A test key connects test addresses, whose mail stays in Pidgeon, and the connection shows "Test · mail stays in Pidgeon" wherever it's listed. The connection page shows the address, its send policy and labels, and offers Change access, Replace key, disconnect and delete; Rotate key is cut from v1. A builder runs
patchy add pidgeon/supportand gets the declaration and a context file. Patch operations come in #825, and the dev door and the Support desk patch in #826.Closes #824. Part of #822.
Look at
/assets/pidgeon-connect.js, posts the key and fills in the rest; without script the page says it needs it. The tiles and cards are new shared components,tileOptionsandchoiceCardsinpackages/core, native radio groups in theui-consistencyspec, drawn to main's calmer components. Screenshots below.pidgeon/Keys.ts). The admin key travels only in the bodies of the admin's two requests and never reaches a page, URL, log line, stored row or refusal. Connect readskey.testandreaches_all_addressesfrom/meand refuses a key that isn't admin over the whole account. Find addresses lists only addresses in the key's own mode, and an address in the other mode is refused. A minted key must show the chosen access, the same mode and exactly the one address before it's saved, under the namePatchy <handle> <attempt>.patchy list connectionsmarks a test connection, as text and astest: truein its JSON.Idempotency-Keyand is sent again under it while its answer is lost, waiting outidempotency_in_progresswithin the deadline; past the deadline nothing is sent.connection.deleted.pnpm test:pidgeon, against pidgeon.ai withPIDGEON_TEST_ADMIN_KEY, failures made withPidgeon-Test-Fail.Retry-Afteror a full key count outside the call's own timeout./meand stop before any change unless it is a test key. They name the variable, never the key.Pidgeon live, so the CI workflow's cancel-on-push never reaches it.pidgeon-changesdecides whether it runs: on main, and on a pull request from this repository that touches what it exercises, when the repository has the key.pidgeon-suiteruns it in one account-wide queue (jobconcurrencywithqueue: maxand no cancellation), thenpnpm test:pidgeon:sweephowever it ended; only a run that tests waits in the queue.pidgeon-liveis the check to require. A skipped job passes a required check, so apidgeon-changesthat failed or timed out would have let the suite be skipped and pass;pidgeon-livealways runs and fails unlesspidgeon-changessucceeded and the suite passed, or was skipped because it had no reason or no key to run.pnpm dev uprecords each test address it asks Pidgeon for in the environment folder, before asking.pnpm dev downandresettake those down with the developer's test key, needing no instance: after checking/mesays test, they revoke eachPatchy …test key below admin that reaches only those addresses, delete the addresses, then wipe. If any of it fails (no key, not a test key, Pidgeon not answering or refusing), they name the addresses and remove nothing. With nothing recorded they don't call Pidgeon.How it was verified
support@on the shared domain atsend: the page shows the address, reply-only and labels; the only new key in Pidgeon is that address's/meof it: send, test, one address) and "connects through the pages with a test key"; offline: "labels a test connection wherever it's shown" (address, Replies only, labels)Keys.test.tsrefuses an admin key over some addresses, and what can't be a key is refused before any callread, the old key is revoked, or the page names itpatchy add pidgeon/supportgives the declaration and the context filecliRepo.test.ts, and the CLI transcript belowb9007a9: 7 of 7 passed in 103 s, with 81 Pidgeon calls and 7 mints; its closing sweep took its one remaining key and address. Before and after, the account had only its 2 admin keys active, no Patchy keys and no run-tagged test addresses. At87ba968, a second local run passed 7 of 7 while CI's run was going on the same account; with at most three keys each, two runs and the two admin keys stay at eight of the account's ten.a711af8: every check passed. In thePidgeon liveworkflow (run 40419827525)pidgeon-changesdecided to run,pidgeon-suiteran the live tier for real with the repository's test key, 7 of 7 in 126 s with 81 calls and 7 mints, and its sweep step found nothing left;pidgeon-livethen passed on that result. Afterwards the account had only its 2 admin keys active, no Patchy keys and no run-tagged test addresses.Source,Keys,Connections,Pages), plus the API list's test marker, the CLI list's, generation, publish binding, shared components, the dev runner's connect failure, which never shows the admin key a failed fill quotes, and itsdown, which over a scripted Pidgeon changes nothing with a key whose/meisn't test, revokes only thePatchy …test keys below admin that reach nothing but the recorded addresses, keeps the address and names it when a key won't revoke, and calls Pidgeon only when an address is recorded.pnpm verifyatb9007a9: format, lint, typecheck, synth, test (2376), postgres-concurrency, cli-smoke, install, tier2-smoke and browser all pass. The two commits after it, the dev runner'sdownand the workflow's check, were checked here by typecheck, lint and the dev runner's and Pidgeon's offline suites (18 files, 112 tests), and by CI on the head;pnpm verifywasn't run again while an acceptance run had the machine.pnpm dev up pidgeonwith the test key recorded one address and connectedpidgeon/supportto it: 2 active keys before, 3 after.pnpm dev stop, thenpnpm dev downwith the instance stopped printedPidgeon: revoked 1 key and deleted 1 test address this environment made.and removed both folders: 2 active keys after, both admin, and the recorded address gone.pnpm dev up(team) thenpnpm dev down, with the key in the environment and every fetch to pidgeon.ai traced: no Pidgeon call either way.downnaming the address withNothing was removed, and no key or a key that isn't a test key changes nothing.Not checked here: sending and reading mail (no operations until #825), a published patch calling Pidgeon (#825/#826), and the live-key refusals against a real live key, which no run here may use. The screenshots, film and transcript below were taken at
ac639d3; later commits change none of those pages or lines.Decisions #824 left open
displayand credentials columns, andtestin the snapshot: no migration.pnpm dev downtakes down what the environment recorded, so it needs no instance and never reads another worktree's database: every dev instance's database has the same name and credentials, so reading by port could reach another worktree's. A connection a stored version declares, like feat(integrations): patchy dev reads the real Pidgeon address and simulates sends #826's Support desk patch will, gives up its key too.uprecords an address before asking Pidgeon for it, so one made by a connect that failed afterwards is found as well.downleaves it. Its key goes when its connection is deleted, or, once Pidgeon deletes the test address a day after it was made, in the live tier's next stale sweep.Release impact
Additive: a new integration, new wire variants and a new CLI declaration kind. No migration. Existing connections, patches and commands behave as before. This is the bottom of the #824 → #825 → #826 stack, which ships together in one release with no flag, so don't deploy it alone.
docs/OPERATIONS.md› Rolling back). Everything else, yes: its connection readers filter to the integrations it ships, as feat(integrations): the connections page works for no connections, one, or thirty #657 set up, so Pidgeon rows stay hidden from the connections page,patchy list connectionsand lookups; a test runs that release's integration list against a Pidgeon row. This release's CLI still reads that release's generation, which has no Pidgeon metadata. Minted keys stay revocable in Pidgeon under Developers › API keys.Before and after, as Ada Park (admin)
Before is
7edd481(where this branch left main) and after isac639d3(feat/pidgeon-connections), both on theteamscenario, frompnpm dev compare./company/connections/connect1280px, after
1280px, before
/company/connections/connect/pidgeon1280px, after
1280px, before
Failed to load resource: the server responded with a status of 404 (Not Found).Failed to load resource: the server responded with a status of 404 (Not Found).Before and after, as Allison Mahmood (admin)
Before is
7edd481(where this branch left main) and after isac639d3(feat/pidgeon-connections), both on thepidgeonscenario, frompnpm dev compare.Before couldn't be shown: Bringing the before instance up failed (exit 1). This shows after only.
Every page answered 200 with no browser errors.
/company/connections1280px, after
Flow
pidgeon-test-label, as Allison Mahmood (admin)After is
ac639d3(feat/pidgeon-connections), on thepidgeonscenario, frompnpm dev film.after.mp4
Transcript
pidgeonBefore is
7edd481(where this branch left main) and after isac639d3(feat/pidgeon-connections), both on thepidgeonscenario, frompnpm dev transcript.Before couldn't be shown: Bringing the before instance up failed (exit 1). This shows after only.
Each line ran in its own
bash -cfrom 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. Redacted before writing: email addresses outside the scenarios' example domains.The company's Pidgeon connection, as a builder agent finds it
Exit 0 in 0.4 s.
Declaring it in a patch: a config line and a context file, and no client yet
Exit 0 in 6.5 s.
Exit 0 in 0.0 s.
Exit 0 in 0.0 s.
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.