Repository navigation
feat(integrations): patches read, reply and send from a Pidgeon address - #954
Conversation
Acceptance: PASS with notesChecked This is the requested short delta acceptance. The only delta is Done means — delta: passed
Golden journeys: passed The fresh desk listed the six seeded conversations (Open 4, Waiting 1, Resolved 1). Opened the order conversation, sent its reply, opened the warranty conversation, searched for the two acceptance messages, and opened the order thread from a search result. Added and removed Feedback. Moved the order thread Open → Waiting, verified it in the Waiting list (2 conversations), then returned it to Open. Delta browser evidenceAll sends went through the published Support desk and its real runtime broker. A temporary browser-only fetch wrapper held the real send responses briefly so the pending fields could be exercised; it fabricated no response and called no Pidgeon API directly. Rollback answers: unchanged by this UI-only delta and consistent with the inherited findings. The additive send-budget table, external mail/triage/held drafts and published versions using the new operations can remain after a revert; those patches need rolling forward. Not run
Notes
Inherited acceptance findings and limitsHistorical evidence, carried forward rather than rerun here:
|
pidgeon.read and pidgeon.write carry the operations Patchy writes for one address, each with its result schema: held mail, delivery state and a send's sent or pending_approval status included. idempotency_conflict joins the runtime codes, and the registry gains runtime.pidgeon.bytes, the thread page size and the daily send budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The generated Pidgeon client, on a tier 1 page and in a tier 2 action, calls operations Patchy writes for the connection's address; a read connection's client has no write methods and the host refuses one forced past its types. A send's draft key becomes Pidgeon's Idempotency-Key, hashed with the connection and the patch, so a draft is one email; Pidgeon's 409s fail idempotency_conflict with their reason, held sends answer pending_approval, and held mail, the send policy and exfiltration refusals fail access_denied with theirs. Sends and replies count against a daily budget per connection in a new table before Pidgeon sees them, and the connection page shows today's count. A call that waited for a slot checks its viewer and connection again before it sends. Recent calls name subjects, recipients and ids, never a body or search text. The patchy-pidgeon skill says how to use it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A run connects its own support address and a customer address, with mail from the customer and from outside through POST /test/inbound, then reads, replies, sends and triages through the operations and a packed tier 1 page, and replies from a tier 2 action in workerd. It checks what Pidgeon decides: a replay, a lost answer replayed, mismatched mail, a draft sent twice at once, a send policy refusal then the fixed draft, a held send, rejected@ recipients, another address's mail, held mail and Replace key. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sted Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ts customer mail Co-Authored-By: Claude Opus 5.5 <[email protected]>
… operation Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly its own addresses The harness counts the run's active keys from Pidgeon's answers, fails a test that would mint past six, and prints the most it held. Changing an address's send policy, approval or holding goes through the harness, which refuses any address this run didn't make. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he Support desk The scenario's mail arrives through Pidgeon's POST /test/inbound, which carries no attachments, with the desk's replies sent from the address, then labels and statuses, each write under its own Idempotency-Key. Without a test key, up skips the Support desk with the connection and says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… address Pidgeon's test inbound mail takes the sender's name beside its address, and a refusal's details carry Pidgeon's message beside the reason. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s on the address threads.get drops any message Pidgeon answers that isn't on the connection's address or in the requested thread, as the list reads drop rows, rather than passing it to the patch. Co-Authored-By: Claude Opus 5.5 <[email protected]>
After Pidgeon answers a new email without sending all of it, held for approval or with rejected recipients, Compose stops sending it and offers a new email, prefilled with the rejected recipients, as a fresh Compose with a fresh key. A send that failed keeps its key, so sending it again replays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ready connected Before minting a local part, up asks the environment's CLI whether the connection exists. If it does, and its address is one up recorded, the idempotent mail delivery resumes there; nothing new is recorded or made. A new address is still recorded before Pidgeon is asked. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New email waits while a send is in flight, so the sending Compose keeps its draft key until Pidgeon answers, and a completion closes the email only while it's still the one on screen. Co-Authored-By: Claude Opus 5.5 <[email protected]>
One sending flag, set by a new email's send and a reply's, disables New email, the conversation list and search results until Pidgeon answers, so neither the draft nor its key is dropped while its answer could be lost. Status tabs and search only change the list, so they stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reply box and the new email's recipients, subject and message are read-only while their send is in flight, so what's on screen stays what was sent: success clears only that, and a retry replays it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
333ea52 to
5d2310a
Compare
…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]>
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 asendkey 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 pidgeongains 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
pidgeon/Operations.ts,sendDraft). A send'sidempotencyKeynames one email; Pidgeon'sIdempotency-Keyissha256(["pidgeon.send", connection, patch, draft]), 64 hex. The same draft within 24 hours answers the first send withreplayed: true. Pidgeon's 409s failidempotency_conflictwithdetails.reasonmismatch, orin_progresswithretryAfter, and nothing is sent; Patchy never retries. A draft sent again after Replace key ismismatch, because Pidgeon counts the calling key.Live, against Pidgeon's test mode: the same draft sent twice answers the same
messageIdwithreplayed: trueand 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, failmismatchand the thread doesn't grow.status:sentwithmessageIdandrejected, orpending_approvalwithdraftIdandapproval { reason, expiresAt }. The pending side has nomessageId, so a patch has to readstatusfirst; a type test pins it.detail. A message Pidgeon Firewall holds hasheld: trueand no content, and reading or answering it failsaccess_deniedwithreason: "held".exfiltration_blockedis a typedaccess_deniedtoo.deliverycarries a sent message's state.pidgeon_sends(migration0028) counts each send and reply per connection per UTC day in one atomic upsert before Pidgeon sees it; pastpidgeon.sends.daily(200 to start) a send failssource_rate_limitedwithlimit: "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.pidgeon.writeaccess_deniedbefore Pidgeon sees it. Queries, mutations and read-only actions can't call it either (gateway test).runtime_callsrow and no log line.Decisions to overturn
The coordinator accepted these; each is a product call Allison can reverse.
deliveryis exposed as{ state, deliveredAt }on messages, so a desk can see a reply bounced. Per-recipient diagnostics aren't.abuse_blockedstays a genericaccess_deniedwith Pidgeon's message, and Pidgeon's other 409s (conflict) becomeinvalid_request.attachments.textrely on the key reaching only its one address, which connect verifies.How it was verified
pnpm verifyon 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,
undefinedoptions, extra keys); each Pidgeon status as its runtime refusal; the budget;in_progresswithretryAfterfrom 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:pidgeonagainst Pidgeon's test mode with the test admin key:Pidgeon.live.tspassed 7 of 7 (81 calls, 7 keys minted, at most 3 active at once).PidgeonOperations.live.tspassed 2 of 9: the tier 2 action, and another address's mail answeringnot_found. The other seven failed on the test's own bugs:POST /test/inboundtakes a barefromwithfrom_namebeside it, and refusals'detailscarry Pidgeon's message beside the reason.PidgeonOperations.live.tsalone: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.
pending_approvalwith reasonfirst_contactand the same on replay.rejected@recipient comes back inrejected, the same twice.held.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 throughLive.reconfigure, which refuses any address the run didn't make.pnpm dev up pidgeon(undersystemd-run --user --scope) connectedpidgeon/supportto a new test address, printed10 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 downprintedrevoked 1 key and deleted 1 test address this environment made. Anupresumed after it had connected (its manifest marked incomplete) printedalready 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.The flagged message
What isn't checked:
patchy devcan't run Pidgeon calls until #826; they failinvalid_requestthere, as the skill says.Release impact
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.pidgeon_sendstable 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 callspidgeon.readandpidgeon.write.one-way, as on feat(integrations): connect a Pidgeon address with an admin key #921.Made by Claude Opus 5.5 in Claude Code, running in T3 Code.