Skip to content

feat(integrations): admins connect GitHub repositories through a GitHub App - #1448

Merged
allisonmahmood merged 8 commits into
mainfrom
t3/github-ci-pr-dashboard
Nov 14, 2026
Merged

allisonmahmood merged 8 commits into
mainfrom
t3/github-ci-pr-dashboard

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Safe to deploy alone once the five new host-secret keys exist, empty: with them empty GitHub is offered nowhere. Leave them empty until the reads (#1441) ship, since a connection has nothing to read before then.

What changed

Patchy had no way to reach a company's GitHub. An admin can now connect GitHub from Integrations: sign in to GitHub, tick repositories they administer on one account, name the connection. Patchy reaches GitHub through a GitHub App, read-only, and a connection is that set of repositories. The read operations patches call come next, in #1441.

Part of #1440. Its human setup (registering the production App, filling the host secret) and its check with a second person before announcing stay open there.

Look at

The connect page, in the frame every integration shares. Back from GitHub, repositories are grouped by account, and ticking one account sets the others back:

Connect GitHub, one account ticked

Before signing in, and with nothing to choose

Connect GitHub before signing in

Connect GitHub with nothing to choose

A connection says what happened on GitHub. Suspended is not a pause: calls are refused, and the same connection works again by itself once the account unsuspends the App.

A connection whose account suspended the App

Connected

A connected GitHub connection

Who may connect what. A repository is offered, and accepted at submit, only when GitHub's listing for the signed-in person says permissions.admin is exactly true. One Patchy company holds an organization's installation; a second is refused and told the way out. The cases are in packages/integrations/src/github/Connections.test.ts, against a scripted GitHub.

What a call may reach is the seam #1441 builds on (GithubAccess.reach): the repository must be in the connection's current set before GitHub is asked, every request goes by numeric id, and each token is minted for the connection's repository ids only. An installation token reads any public repository anywhere (shown on #1439), so Patchy's own set check is the boundary for those.

Refresh has its own deadline, red then green. With Refresh on a call's 15 seconds:

GithubTimeout: GitHub did not answer within 15 seconds.
 ❯ packages/integrations/src/github/Connections.test.ts (29 tests | 1 failed | 28 skipped)

With github.discovery.deadline (60 seconds): Tests 1 passed | 28 skipped.

How it was verified

  • pnpm check at the head: lint, typecheck, synth and all 335 test files (3,684 tests) pass. Format needed one file reformatted after that run; format check, lint and the GitHub suites (41 tests) were run again and pass.
  • pnpm verify ran on the branch before the review fixes: every stage passed except four test timeouts in suites this branch doesn't touch, on a loaded machine; each file passes run alone. It has not been re-run at the head; CI covers it.
  • Tests are offline, against a scripted GitHub. Each fix from review has a test that fails without it.
  • The signed-in pages above were captured over the scripted GitHub; the others from a local instance on the dense scenario with a throwaway App.

Not checked:

Release impact

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

The host secret gains five keys, PATCHY_GITHUB_APP_ID, _SLUG, _CLIENT_ID, _CLIENT_SECRET and _PRIVATE_KEY. Add them, empty, before deploying this: a host can't start until they are present. All empty, GitHub isn't offered and nothing else changes. Some filled, the server refuses to start and names what's missing. docs/OPERATIONS.md has the steps, the key's rotation and what to do if it leaks.

One-way once used: production can't roll back past this release while a patch version declares a GitHub connection. While the keys stay empty nothing can be connected, so a rollback is safe.

  • What does a revert leave behind? Migration 43's three tables (sign-in flows, installations, claims), the five host-secret keys, and, only if the keys were filled, GitHub connection and snapshot rows and any patch version that declares github.
  • Does the release before it still work with that? Yes while the keys are empty: it ignores the tables and the keys. No for a patch version that declares github, which it can't decode; fix forward instead.

Review

GPT 6.1 Sol reviewed the branch twice.

  • Round one found 13 defects, fixed in 83eba8e3, 1bbeaacf and 0e9e7c73: claims and tokens when two actions land together, a sign-in token left unrevoked when saving failed, a stale "Suspended on GitHub", and two page bugs (Enter started "Use another GitHub account"; Add couldn't reach a repository past the first fifty).
  • Round two confirmed eleven of those and raised six more. Fixed in 74d2e896: Refresh's deadline, the message when every repository left, a Test racing a Refresh, the empty picker when GitHub listed more than Patchy read, and a bound on token cleanup.

Not acted on:

  • A sign-in token can still outlive its flow if the server is interrupted at the instant a commit lands. Revocation there is best effort by design, and the token expires in eight hours.
  • The sign-in exchange and token cleanup sit outside the host-wide cap on GitHub requests. There is one per person pressing a button, and refusing one after GitHub has issued a token would leave that token to clean up.
  • A limit answer to a cleanup request writes no cooldown. The next call gets the same answer and writes it.
  • Repositories marked as left stay marked when the token for the rest is then refused. GitHub's own listing showed them gone, and keeping the mark stops the next call listing again.
  • The global patchy skill doesn't mention GitHub yet. It gains it with the reads in GitHub: what patches read from a connection (CI, logs, pull requests) #1441.

Built by Claude Opus 5.5 (xhigh) and reviewed by GPT 6.1 Sol (xhigh) in T3 Code, directed by Claude Fable 5.2.

🤖 Generated with Claude Code

@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Nov 14, 2026
@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:integrations Company connections and integration implementations area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes labels Nov 14, 2026
allisonmahmood and others added 8 commits November 14, 2026 23:41
Cryptography signs RS256 with an RSA private key in PEM, as a GitHub App's
JWT needs. productLogos gains GitHub's Invertocat, from GitHub's published
logo archive. checklistGroups sets back the other lists once a box is ticked
in one, and an in-form search can submit as a GET to its own address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A company admin signs in to GitHub, ticks repositories GitHub shows them
administering on one account where Patchy's App is installed, names the
connection and connects it. Patchy keeps the installation and repository
ids, mints installation tokens for them on demand, and reads the mint's
answers to tell a repository gone, the App suspended, uninstalled or
narrowed apart. Reads patches call come with #1441; this leaves the seam
they call: given a connection and a repository name, a token or a refusal.

- The App's five PATCHY_GITHUB_APP_* host settings: all empty and GitHub
  isn't offered; some filled and the server refuses to start.
- Sign-in flow records: a hashed one-use nonce, PKCE, the person's token
  sealed until the save or expiry, then revoked; the setup URL proves
  nothing. Only a listing's permissions.admin exactly true is offered.
- One Patchy company per organization installation, claimed under a locked
  parent row in one lock order; Pause keeps it, Disconnect releases it.
- Test, Refresh, Pause, Resume, Disconnect, Change repositories (Add needs
  a sign-in, Remove none) and Reconnect to a reinstalled App.
- Suspension is recorded on the installation and shown in place of
  Connected; it is never a pause. A 422 is read, then reconciled once,
  under the same guard as a pause. Limit answers cool the installation.
- patchy add github/<handle> declares it, with its context and skill.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dev runner hands the development App's PATCHY_GITHUB_APP_* settings
from dev.env to the instance's server. pnpm dev up github seeds
github/platform from an installation and repository ids in dev.env, read
live through that App, since GitHub's sign-in returns only to the callback
the App registers. dense gains offline GitHub connections: connected,
suspended on GitHub, needing attention for an uninstalled App, and paused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
product.md's Connecting GitHub, the integrations glossary's GitHub terms,
ADR-0015 for the App's key and the repository rule, OPERATIONS' GitHub App
section (registering an App, its settings, rotating its key and what to do
when it leaks), and the CLI's patchy add github/<handle>.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In checklistGroups, ticking a box in one list only greyed the names in
the others, so on GitHub's connect page a second account barely changed
once the first had a tick. The other lists now dim whole, as a disabled
tile does, while staying choosable. No script, no animation.

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

Several GitHub paths acted on what they read before a wait or a race:

- Disconnect peeked at the installation, locked it, then released the
  claim on whatever installation the locked row named. A connection a
  Reconnect moved in between is now refused as changed; a retry locks
  the installation it names.
- A sign-in's callback stored its token matching only the row id, so a
  slow return from before a restart could overwrite the newer token,
  which was never revoked. It now stores only while the row's nonce is
  the one it consumed, and revokes the token the row held until then.
- A token exchanged but never stored (a failed write, a refusal, an
  interruption) stayed live. Every such exit now revokes it,
  uninterruptibly. A save revokes the token the deleted row held, as its
  DELETE returned it, and the save and that revoke run to their end
  together.
- Add and Reconnect exempted a personal account on its type alone; they
  now need the signed-in user's numeric id to be the account's, as
  Connect does. Resume, which has no sign-in, says why it needs none.
- After waiting for a slot, every call, check and discovery reloads the
  connection: one moved to another installation is refused, and a
  cooldown written meanwhile refuses before anything is sent.
- A slot's deadline now bounds the whole operation, pagination included,
  not each request. A person's own reads while they connect take one of
  GitHub's host-wide slots within the same deadline.
- Refresh and a connect that read the installation clear "Suspended on
  GitHub", as a mint does.
- Resume first reads which left repositories are back, so a paused
  connection whose repositories all left can resume once they return.
- The installation listing pages up to 200 (github.picker.installations)
  and the connect page says when there were more.

A refused replacement mint keeps its "left" marks: the complete listing
showed those repositories gone.

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

Change repositories listed the first fifty repositories it could add
with no way to reach the rest. It now has the connect page's filter by
name: a GET of the dialog that keeps the text and what was ticked, and a
refused save draws the boxes as they were.

The sign-in buttons were the connection form's first submit buttons, so
Enter in the name or filter field started "Use another GitHub account".
They now join a form of their own, drawn after the connection form
through a new `outside` slot on flowPage and dialog, so Enter presses
the filter or the form's own submit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hen every repository left

Refresh, and Resume's look for repositories that came back, read a whole
installation, so they get github.discovery.deadline (60 seconds) where a
patch's call keeps the integration deadline. A Test or Resume that finds
none of the connection's repositories in the installation says so. A Test
that raced a Refresh is refused as changed instead of writing back the
names it loaded. An empty picker says how far Patchy read when GitHub
listed more. Revoking a listing token is bounded to two seconds, so
cleanup can't hold a slot past the deadline.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the t3/github-ci-pr-dashboard branch from 74d2e89 to 9b13ec1 Compare November 14, 2026 22:41
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 9b13ec1760283c173cf0f79532243cd9e1bb16f6 (base 6da1fa28b92020567dd8b9c119d50fd232ff5b99) on fresh dense and team startup scenarios, by GPT-6.1 Sol (xhigh) in the Codex harness through T3 Code. I did not write this change.

Done means

  • An admin connects repositories they administer on one account, personal or organization: passed offline, including the sign-in and connect HTTP routes, against the scripted GitHub.
  • Repositories without exactly permissions.admin: true are neither offered nor accepted, including forged submissions: passed offline.
  • A second company cannot claim an organization's installation and is told the way out: passed offline, including competing claims.
  • Test, Refresh, Pause, Resume, Disconnect, Add, Remove and Reconnect: passed offline, including claims, credential revisions, stale attempts, token cleanup and Refresh's longer deadline.
  • Repository departure, suspension and uninstall remain distinct; unsuspension heals without a Patchy action: passed offline. Fresh dense pages also showed Connected, Suspended on GitHub, uninstalled/needs attention and Paused correctly to admins and members.
  • All five App settings empty: passed on a real fresh instance. GitHub was absent from admin/member catalogues and CLI/API offerings. Connect GET/POST, sign-in start and callback answered 404; setup redirected locally to Integrations. All five existing connect forms and connection snapshots remained readable.
  • Partial App settings: passed on a second fresh instance. With only a throwaway slug filled, startup exited 1, named all four empty settings, and left no healthy server.
  • Before announcement, a real repository admin who does not own the organization completes the production App check: not run. This remains open on GitHub: connections through a GitHub App #1440; this PR does not close it.

Golden journeys

  • Sign in and out: passed directly with dev personas; the current head's real Clerk CI check passed too.
  • Log a machine in and back out: passed locally in the packed CLI contract, including the login handoff and server-side revocation on logout.
  • Publish a page, retire/delete and restore it: passed directly using the scenario's installed CLI. A member opened the sandboxed page and its actual frame content; each off state showed its notice, and both restores served the same address again.
  • Share and unshare: passed directly. A signed-out reader received 200 with public caching and no cookie, then 401 after restoring company access.
  • Find and open a tool: passed directly through the member's Home and search.
  • Use a tool live and use a tier 2 tool: passed locally through the packed tier 2 journey and both browsers' real-server subscription suites, including two-viewer sync, keyed retry, sharing, files and members.
  • Invite/join and reverse membership changes: passed through the offline auth/company suites, browser People checks and the current head's Clerk CI coverage.

Rollback answers: match the diff. The migration adds three tables; the old release ignores them and empty settings. A stored patch version declaring github crosses the incompatible boundary, correctly documented with the one-way label. The current-head rollback job actually seeded, upgraded, rolled back and upgraded the same data again: all four steps passed, in 180 seconds. That rehearsal does not establish rollback safety after GitHub declarations are used.

Evidence on this head

git range-diff 74d2e896~8..74d2e896 9b13ec17~8..9b13ec17 reports all eight patches unchanged. The intervening main changes concern workerd's port and the image smoke's management port. I reran the focused GitHub suites, full sequential pnpm verify, and the direct instance checks above. I did not regenerate the previous head's before/after screenshots.

Focused GitHub:          3 files, 41 tests passed
Node offline:           334 files passed, 1 failed; 3,683 passed, 1 timeout
Timed-out file alone:   1 file, 3 tests passed
Bun offline:            317 files; 3,357 passed, 3 skipped
Postgres concurrency:   3 files, 28 tests passed
Packed CLI/Preact:      passed
Linux installer:        passed
Packed tier 2:          passed
Chromium:               189 passed
Firefox:                186 passed, 3 intentional skips
Format/lint/types/synth: passed

pnpm verify returned nonzero solely for the PGlite metering timeout tracked by open flaky issue #1229. As required, I reran packages/company-database/src/PgliteCompanyDatabases.test.ts alone, without changing code or timeouts: all three tests passed. The full verification command was not repeated.

All 27 current-head CI checks passed. I relied on that CI for Node 22/26, macOS/Windows installers, live Clerk, the production server image and rollback rehearsal. CI's merge commit has exactly the same file tree as the checked head. CI checks

Direct instance transcript
PASS admin/member catalogues: GitHub not offered
PASS five existing connect forms and immutable snapshots
PASS disabled GitHub connect/start/callback: 404; setup: local 303
PASS CLI/API: exactly five existing offerings
PASS Connected, Suspended, Uninstalled and Paused pages
PASS publish, member frame content, Home/search and signed-out door
PASS public/company sharing: 200 then 401
PASS retire/restore and delete/restore at the same address
PASS sign out returns the door; sign in returns access
PASS partial settings refuse startup and name missing settings

Not run

  • Live GitHub authorization, installation/lifecycle calls and pnpm dev up github: prohibited for this run. No real App settings were sought, read or used; the PR's integration requests stayed offline against the scripted GitHub.
  • The second-person production App check on GitHub: connections through a GitHub App #1440: remains required before announcement.
  • Three Firefox checks require Chromium-specific browser controls; all three ran under Chromium.

Notes

  • Before deploying, provision all five host-secret keys, empty. Keep them empty until the read operations in GitHub: what patches read from a connection (CI, logs, pull requests) #1441 ship; this PR supplies connections and the access boundary, not GitHub reads for patches.
  • Complete GitHub: connections through a GitHub App #1440's human App setup and non-owner repository-admin check before announcing the integration.
  • The only local failure was the known timeout described above; its isolated rerun and all current-head CI checks passed.
  • All instances were taken down. The PR's code, branch, body and labels were left unchanged; no merge was performed.

Checked by GPT-6.1 Sol (xhigh) in the Codex harness through T3 Code.

@allisonmahmood
allisonmahmood merged commit 5b2b939 into main Nov 14, 2026
27 checks passed
@allisonmahmood
allisonmahmood deleted the t3/github-ci-pr-dashboard branch November 14, 2026 23:23
allisonmahmood added a commit that referenced this pull request Nov 14, 2026
…1451)

Follows #1448, which has merged. The two ship in one release: #1448
makes GitHub connections, and this is what patches read from them.

## What changed

A GitHub connection had nothing to read. Patch code now has twelve
fixed, read-only operations on one: repositories, workflows, runs and
their jobs, a job's log, a commit's checks, and pull requests with their
files and reviews. Builders' agents read the real connection while they
build, and each read shows on the connection's page.

Closes #1441.

## Look at

**What a patch gets**, from patch code through the client over a
scripted GitHub: a run list, the failing job, the end of its log, a pull
request's review count, and a repository outside the connection.

```json
{
  "runs": { "complete": true, "runs": [
    { "id": 3003, "title": "Retry the webhook queue", "branch": "queue-retry", "status": "in_progress", "conclusion": null },
    { "id": 3002, "title": "Bump the payments client", "branch": "main", "status": "completed", "conclusion": "failure" },
    { "id": 3001, "title": "Add the export endpoint", "branch": "main", "status": "completed", "conclusion": "success" } ] },
  "failingJob": { "id": 7002, "name": "test (node 24)", "steps": ["Run tests: failure"] },
  "log": { "truncated": true, "size": 1221075, "textBytes": 1048576, "lastLines": [
    "2026-11-14T09:02:58.000Z ✗ payments client > retries a declined card",
    "  AssertionError: expected 2 retries, got 0",
    "2026-11-14T09:02:59.000Z ##[error]Process completed with exit code 1." ] },
  "pull": { "number": 42, "title": "Bump the payments client", "reviews": { "approved": 1, "changesRequested": 1, "complete": true } },
  "outsideTheSet": { "code": "not_found", "message": "docs isn't one of this connection's repositories. An admin adds repositories on the connection's page." }
}
```

**Each read shows on the connection's page.** This page is the real
Calls tab over rows a harness wrote in the shape the dev door writes
them; the door's own recording is covered by a test in
`DevReads.test.ts`.

![A GitHub connection's Calls tab with six Dev
calls](https://github.com/user-attachments/assets/dabcd946-7a0c-4075-b5a0-1ea65e7044b7)

**The repository boundary.** Every call looks the repository up in the
connection's current set before GitHub is asked, and addresses it by
numeric id. An installation token reads any public repository anywhere
(shown on #1439), so this check is what keeps a patch to its connection:
the test asks for a public repository outside the set and asserts
`not_found` with no request sent.

**Job logs** are read from GitHub's log store by Patchy itself: the
redirect must be https, on the default port, to the one host pattern
shown on #1439; Patchy asks for one byte to learn the length, then the
closed range for the end, and accepts only an exact 206. Neither request
carries the token or follows a redirect, and the signed URL never leaves
the host. The tests cover a store that ignores the range, changes
between the two requests, redirects, or answers from another host.

**On real GitHub**, through the development App installed on one public
repository:

- The live tier read it on every route, the job log through the log
store: `GitHub live run: 12 reads.`, `Tests 1 passed`.
- `pnpm dev up github` seeded a connection from that installation in 12
seconds.
- A fresh agent with only the Patchy skill, asked as a person would for
a CI dashboard and a pull-request board, built and published both in
about three minutes and 48 tool calls. Its five refused commands were
the launcher's own approval limits. Both pages showed the repository's
real runs and pull requests; they are real data, so they aren't
attached. The agent had no failed run among the latest to try, so the
dashboard's failure view was then called on an older failed run: it
returned the failing job, its failing step and the end of the real log.
- Check runs were asked of GitHub for two branches with `/` in their
names, one with four parts, with the slashes kept: both answered. An
unknown branch answered 422, as the code reads it.

## How it was verified

- `pnpm check` at the head: format, lint, typecheck and synth pass, and
336 of 337 test files (3,700 of 3,701 tests). The one failure was a
5-second timeout in `PatchesApi.test.ts`, which this branch doesn't
touch, on a loaded machine; the file passes run alone, 67 of 67.
- `pnpm verify` ran before the review fixes: every stage passed except
one test timeout in a suite this branch doesn't touch (`Fleet.test.ts`),
on a loaded machine; the file passes run alone, 43 of 43.
- Tests are offline, against a scripted GitHub. The runs on real GitHub
above were made at `f6ef89a9`, before the rebase onto main, which
changed none of this branch's files.

Not checked:

- **The live tier has not run in CI.** `GitHub live` is written and
skips: it needs the CI App registered and installed on a Patchy-owned
test repository, and the secrets `docs/DEVELOPMENT.md` lists. The run
above used the development App by hand.
- A private repository, and an organization's installation, with this
code. #1439 showed GitHub's side of both.
- An empty job log answering 416 is still assumed, not shown.

## Release impact

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

No migration and no new setting. The operations are new; nothing
existing changes shape. The host-secret keys #1448 adds are what turn
GitHub on.

**One-way with #1448: production can't roll back past this release while
a patch version declares a GitHub connection or calls these
operations.**

- **What does a revert leave behind?** Patch versions built against the
GitHub client, and recent-call rows for GitHub reads.
- **Does the release before it still work with that?** Not for those
patch versions: it has no GitHub operations to serve them. Everything
else works. Fix forward instead.

## Review

GPT 6.1 Sol reviewed the branch. Fixed in `f6ef89a9`: a pull-request
listing could hand out a cursor its own decoder refused past page 3,000;
exactly 100 reviews read as incomplete (it now follows GitHub's `Link`
header); completeness at exactly one page was untested for jobs and
checks; and two skills were out of date.

Not acted on:

- **Cursors are not signed.** As for the other integrations, a cursor
names only another page of a list its caller may already read, so
altering one gains nothing.
- **The repository name a patch asked for is recorded in recent calls
even when it isn't in the connection.** It is what an admin needs to see
why a call was refused, and it is bounded by the repository-name
pattern.
- **Jobs, checks, workflows and reviews are one page of 100**, flagged
incomplete past that. A run with more than 100 matrix jobs can't be read
in full yet.

Built by Claude Opus 5.5 (xhigh) and reviewed by GPT 6.1 Sol (xhigh) in
T3 Code, directed by Claude Fable 5.2.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

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

## What changed

This adds release 44's What's new entry, written from `b653816`. It
covers everything merged since release 43's `through` (`1cbd39f`), and
sets the `patchy` release to `0.44.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Connect GitHub | #1448, #1451 |
| New: Pin patches to your sidebar | #1437 |
| Improved: Patchy works in Firefox | #1427 |
| Improved: Your agent's Patchy skill keeps up | #1446 |
| Fixed: Dialogs close in Firefox | #1427 |
| Fixed: Publishing a tool no longer fails by chance | #1444 |
| Behind the scenes: agents read what each tier means before picking one
| #1438 |

#1445 is CI only and has no line. #1422 is release 43's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **GitHub is announced because this deploy makes it available.** The
production App is registered and its five settings are in place, so
GitHub is offered in Integrations once this ships. The code was run
against real GitHub before it merged (#1451). One check stays open on
#1440: someone who administers a repository without owning its
organization. That case fails closed until it is shown.
- **One test changed with it.** With GitHub off, a test searched the
whole catalogue page for the word "GitHub". The entry puts that word in
the What's new bell on every page, so the test now checks for the
catalogue's own GitHub card and link instead.
- **`pidgeon-suite` and `pidgeon-live` are red for a reason outside this
release:** Pidgeon is retiring the API the integration calls (#1457).
Neither is a required check, and this release neither fixes nor worsens
it.
- **Rollback safety, from the live commit `5decfef` (release 43) to this
PR's merge.** #1448 and #1451 are labelled `one-way`; the rest are not,
and each says release 43 reads what it leaves.
- #1448 adds migration 43's three tables and five host settings. Release
43 ignores both, and the rollback rehearsal passed on #1448's head.
  - #1437 adds a personal pins table that release 43 never reads.
- A patch version that declares a GitHub connection is what release 43
can't read. None can exist before this release.

If this release misbehaves, roll back to `5decfef` (release 43) while no
patch version declares a GitHub connection. Once one does, rolling back
past #1448 would break that patch, because release 43 can't read a
`github` declaration; fix forward instead.

## How it was verified

`pnpm format:check`, the What's new tests, the API suites and GitHub's
page 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 Fable 5.2 in Claude Code, through T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 19, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core area area:docs Touches the docs area area:integrations Company connections and integration implementations area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles one-way Rolling production back past this PR would break the release before it size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant