Skip to content

feat(mcp): agents' calls are held to 300 a minute per patch and 16 in flight per person - #889

Merged
allisonmahmood merged 4 commits into
mainfrom
mcp/857-call-limits
Oct 23, 2026
Merged

allisonmahmood merged 4 commits into
mainfrom
mcp/857-call-limits

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #888 (ticket #856); merges with the rest of #833's stack, not alone.

What changed

A person's agent could call a patch through Patchy MCP as often, and as many calls at once, as its client liked. Only the door's 600 requests a minute held it back. Its calls spent none of the company's admission, and its actions took the same two action slots as the person's own tab. Now read_patch and change_patch are admitted per person, as the spec's Bounds set out:

  • 300 calls a minute per person per patch (mcp.calls.perMinute), across their agents, beside the page's own runtime.calls.perMinute. An agent's loop never touches its person's tab.
  • 16 calls in flight per person (mcp.inFlight), across their agents. The seventeenth is busy with retryAfterSeconds: 1. An admitted call holds its slot until its work settles, including after its client hangs up.
  • Company admission is shared: agents' calls now spend the company's bucket with its pages.
  • Agents get their own action slots: an agent's actions take a tier2.actions.viewer key of their own beside the person's page. The company's action slots stay shared.

Every counter is per host replica and keyed by the person, never an address or connection. A refusal is the refusal shape over HTTP 200 with retryAfterSeconds, writes no log row, keeps the change key free, and names its limit id in its wide event.

Each call is also cheaper: it used to read the company's patches with a scan of every version's manifest, about 190 ms per call at 200 patches × 20 versions. It now skips that scan and takes about 27 ms (second commit, measured below).

Closes #857

Look at

Done means, on a dev instance (brightline, New Business given agent tools, tokens from pnpm dev mcp-token, driven by a script against /mcp). The loop uses countDeals, a read-only action, which always writes a log row, so rows count admitted calls exactly.

Jordan's two agents (Codex, Claude), one call after another:
  admitted 300 in 9.9 s, the 301st → 200 rate_limited, retryAfterSeconds 51:
  "Jordan Lee's agents called new-business more than 300 times in a minute; try again in 51 seconds.
   Bulk work wants a tool that takes a list; if new-business has none, its owner, Allison Mahmood, can add one."
  runtime_invocations for agent.countDeals: +300 (the refusals wrote none)
Jordan's tab, while his agent is still refused (pnpm dev shot jordan /brightline/new-business):
  200, browser errors: none, the board loaded with live deals (below); the next agent call: rate_limited, 44 s
Priya's two agents, 17 waitAction calls at once (read-only, 2.5 s each):
  16 ok, 1 → busy, retryAfterSeconds 1:
  "Priya Shah already has 16 calls in flight through their agents; try again in a second, once one has finished."
16 slow calls whose client hangs up after 0.5 s:
  the next call at once → busy; 3 s later → admitted; the 16 rows say reply_delivered = false

Jordan's tab while his agent was refused:

Jordan's New Business tab, loaded while his agent is rate-limited

The two refusals' wide events, from dev.log:

{"route":"/mcp","status":200,"mcpTool":"read_patch","agentTool":"countDeals","outcome":"refused","code":"rate_limited","limitId":"mcp.calls.perMinute","clientName":"Codex", "limits":[…{"limitId":"mcp.calls.perMinute","value":300,"peak":300}]}
{"route":"/mcp","status":200,"mcpTool":"read_patch","agentTool":"waitAction","outcome":"refused","code":"busy","limitId":"mcp.inFlight","clientName":"Codex", "limits":[…{"limitId":"mcp.inFlight","value":16,"peak":16}]}

The two busy cases stay apart in events: a change key still running has no limitId, and the in-flight cap's says mcp.inFlight.

On the dev instance, 17 slow queries at once got 8 through and 9 busy from the company's database connections. A query holds a connection for its snapshot while it runs. This is the spec's note that 16 in flight can still fill the company's connections, and it is not the cap. The in-flight run above uses read-only actions, with Brightline's action slots raised by an override so the cap is what's measured.

How the slot follows the work (packages/mcp/src/Admission.ts, Invocation.AgentCall.retain). The order is: the minute on the patch, then a slot, then company admission, all before a change key is claimed. The request holds the slot while it runs. Runtime takes one more hold for each run it forks, inside its uninterruptible region, nested ctx.run children included, and lets each go in that run's ensuring. The slot comes back when every hold is gone.

An action Runtime refuses before it starts gives its key back. That covers its own action slots (InvocationBusy), a refused bind (LifecycleError) and the execution service at capacity (ExecutorBusy). Before this PR, a busy refusal said to retry in a second, and the retry with the same key got key_used. A mutation's key is never discarded, because its retry already runs under its mutation key.

The per-call company patch read (handed over from #854). Every agent call, and every catalogue call, read the company's patches through Patches.read. Its shared-read edges scan the uses of every version of every patch. Measured on the test Postgres, with manifests the size of New Business's (3 KB stored), p50 over 35 calls on a loaded machine:

Company Patches.read (portal, unchanged) whole read_patch, before after (Patches.list)
10 patches × 1 version 2.5 ms 11.6 ms 10.3 ms
200 × 1 26 ms 34.5 ms 24.4 ms
200 × 20 183 ms 189 ms 27.3 ms
300 × 40 513 ms 340–540 ms 38.7 ms

At 189 ms a call, one person's agent at 300 a minute on one patch would keep about one platform database core busy, and two across patches under the door's 600. That isn't comfortable. Patches.list answers the same patches by the same rule without reads and dependants, which the door never shows. With it, 300 a minute costs about 0.14 database seconds per second per person per patch, flat in versions and linear only in patches. The portal still uses read and pays the version scan on each page. That is out of scope here; caching or bounding those edges is the lever if it shows in data.

CompanyAdmission is the company token bucket, moved out of RuntimeProduction into its own service now that it has two consumers. RuntimeProduction.layer provides it, so the door spends the same instance as pages.

How it was verified

  • Tests, red first:
    • packages/mcp/src/Admission.test.ts (4 cases):
      • the minute per person per patch, across two connections, with TestClock rolling the window. Another patch, a colleague and another company each keep their own; a refused change keeps its key.
      • the seventeenth in flight across three connections, with a fake Runtime that retains as Invocation does. A hang-up keeps its slot until its work settles; a failure and a give-up before dispatch give it back. A burst racing releases never runs more than 16.
      • company admission shared with a page's spend.
      • an action refused before dispatch (action slots, bind, executor capacity) keeps its key.
    • packages/runtime/src/Invocation.test.ts:
      • an agent's own action slots beside its person's page, with the company's shared and no row for a refusal.
      • retain taken at dispatch and let go when the work settles, after the caller is interrupted, and held by a ctx.run child after its action returns; never taken by a call refused, or given up, before dispatch. Fails without the change.
    • packages/patches: list answers what read does, minus the edges.
  • Suites: packages/mcp, packages/runtime, packages/patches, packages/portal, packages/integrations, packages/limits (the docs/limits.md render test) and packages/api/agentTools are green. A few runtime and catalogue cases timed out at load average 50–67 and passed when rerun alone. Typecheck, tsconfig.test.json, lint and format are clean.
  • Dev instance: as above, on this head's code.
  • Rollback rehearsal against main at e4243ff, which has Tier 2 readers accept handler descriptions, read-only actions and agent tools, and enforce them #837 and Deactivation and Disconnect everything end pending device logins and record when a person's credentials ended #838: pnpm test:rollback-rehearsal --live e4243ff passed e4243ff → 3d625ad → e4243ff → 3d625ad in 360 s. The later commits touch no migration or descriptor schema.
  • Review: GPT-6.1-Sol, two rounds; round 2 found nothing blocking. The findings and fixes are in the comment below.
  • pnpm verify on 5d20897: all passed (format, lint, typecheck, synth, test, postgres-concurrency, cli-smoke, tier2-smoke, browser). CI is green on the same head.
  • Acceptance: PASS with notes on 5d20897 (GPT-6.1-Sol, fresh brightline data), in the verdict comment below. Its one load flake, a supervised-workerd diagnostics case, passed alone and is filed as flaky: supervised workerd diagnostics misses invocation settlement deadline under load #895.

Release impact

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

New operating limits with defaults. No migration, and no wire or CLI change.

  • What does a revert leave behind? Nothing persistent: the counters are in memory, and no rows or columns are added. Company overrides of mcp.calls.perMinute or mcp.inFlight, if anyone set them, stay as rows the older release doesn't read.
  • Does the release before it still work with that? Yes.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).

@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area size:xl Over 1,000 changed lines; review in multiple passes labels Oct 22, 2026
@allisonmahmood
allisonmahmood force-pushed the mcp/856-log-attribution branch 2 times, most recently from b2ab836 to fd27c49 Compare October 22, 2026 21:16
@allisonmahmood

Copy link
Copy Markdown
Owner Author

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

Round 1 (at 3d625ad): one blocking finding, nothing else.

  • Blocking: the in-flight slot could come back while nested work still ran (packages/runtime/src/Invocation.ts). Only the top-level run retained the slot. An action's ctx.run child is its own run, which can outlast the action once the action is fenced. Sol reproduced it: after the parent settled the MCP holds were 0 while the child was still running.
    Fixed in f293ed9. Every run in an agent call's tree now takes its own hold at its fork and lets it go in that run's ensuring, as Runtime's execution lease already follows the tree. A new case in Invocation.test.ts starts a child through ctx.run, lets the action return, and checks one hold stays out until the child ends. It failed before the fix.

Checked and clean in round 1:

  • request-side release and interruption masking;
  • counters keyed by the person;
  • shared company admission and separate agent action slots;
  • override selection;
  • no log rows for refusals, and events with limit ids;
  • change-key handling;
  • Patches.list matching Patches.read minus the edges;
  • registry, docs, glossary and skill surfaces.

Round 2 (at f293ed9): nothing blocking. Sol confirmed the round 1 fix: children retain independently, mutation retries and rebinds stay under the same hold, and callback fencing prevents a late child dispatch. No further race, double hold or leak. One should-fix:

  • Should-fix: an action the execution service refuses at capacity burned its key (packages/mcp/src/Calls.ts, neverStarted). ExecutorBusy is a pre-dispatch refusal (residency capacity), but the action's key was settled as used, so the retry after busy got key_used.
    Fixed in 5d20897. ExecutorBusy now gives the key back, as action-slot and bind refusals do. The same-key retry is covered in Admission.test.ts, red then green.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 5d20897bd2dd136d8aaba31eeb5499fefeeb3eec (stacked base fd27c49c07f79577cee5303387f2645322454a7e, #888) on fresh brightline data in a dedicated throwaway checkout, by GPT-6.1-Sol (xhigh) in the Codex harness through T3 Code. The checkout stayed clean. No production instance was used.

Done means

  • Past 300 calls, while the person's tab works: passed. Jordan's Codex and Claude connections alternated 300 read_patch calls to New Business's read-only countDeals action: all admitted in 3.435 s. Call 301 returned HTTP 200, rate_limited, retryAfterSeconds: 57. A change_patch call shared the same allowance and was refused too. Jordan moved Verdant Grocers from Lead to Discovery, then restored it to Lead during a later capped window; Allison's already-open board reflected both moves without a reload. Immediately after the page restored the deal, an agent call was still rate_limited, with 15 seconds remaining.
  • The seventeenth concurrent call is busy: passed. Seventeen 4-second read-only actions, split across Priya's Codex and Claude connections, produced 16 successes and one HTTP 200 busy with retryAfterSeconds: 1. Only the action-slot limits were raised to 40 for this check, to isolate the unchanged default mcp.inFlight: 16 from the lower action caps.
  • Neither refusal writes an invocation row, and both are wide events: passed. The first loop added exactly 300 agent.countDeals rows; the concurrent burst added exactly 16 agent.waitAction rows. The actual refusal events included:
{"route":"/mcp","status":200,"mcpTool":"read_patch","agentTool":"countDeals","outcome":"refused","code":"rate_limited","limitId":"mcp.calls.perMinute","clientName":"Codex"}
{"route":"/mcp","status":200,"mcpTool":"read_patch","agentTool":"waitAction","outcome":"refused","code":"busy","limitId":"mcp.inFlight","clientName":"Codex"}

Other risks checked

  • Disconnects and change keys: passed. Started 16 more slow actions, waited for their invocation rows, then disconnected all clients. An immediate read and change still returned busy. After settlement, the refused change's same key succeeded. All 16 disconnected invocations settled successfully with reply_delivered = false, and no extra slow-action row appeared. A minute-refused change's same key also succeeded after the window reset.
  • Company admission, agent/page action slots, nested holds, pre-dispatch key release, and catalogue visibility: passed in the focused suites. These included Admission.test.ts, Invocation.test.ts (including the child that outlives its parent), RuntimeProduction, Patches, Portal, Limits/rendered docs and agent-tool contract tests. Patches.list matched read without sharing edges. The live MCP find_patches search and open_patch both returned New Business and its agent tools successfully.

Golden journeys

  • Publish a page/tool: passed. Fresh scenario setup published all four patches and loaded sample data; the repo's pinned packed CLI then published the tier 2 agent fixture successfully. CI's CLI and tier 2 smoke jobs also passed at this head.
  • Find and open a tool: passed. Jordan's Home listed the studio's patches; searching kudos returned one match and opened the framed tool.
  • Use tier 1 live: passed. Jordan sent Priya Kudos; it appeared on Priya's already-open wall without reloading.
  • Use tier 2: passed. New Business's shared board moves and reverse worked as above. Spend loaded its seeded requests and receipt; Jordan's attempt to approve his own request returned “You can't approve your own request.” Browser snapshots reported no console errors.

Mirrored surfaces: registry and rendered limits, Limits/MCP vocabulary, the release-bound patchy-server skill, and both runtime consumers checked. This diff changes no API/CLI wire shape, dev runner, migration, company-database locking or package layout.

Rollback answers: match this PR's diff. No migration, descriptor, wire or infrastructure change. Counters are in memory; optional new limit-override rows remain readable but unused by older code. No one-way label is needed. I read the green rollback-rehearsal job: it explicitly skipped the rehearsal because this PR changes no migration or handler descriptor.

Not run

  • The author's large-company latency benchmark was not repeated; the local loop above used the small fresh scenario.
  • Real fleet bind waiting and containment: this run used the dev instance's local workerd engine; pre-dispatch waiting and release were exercised by the suites. No production or external integration was contacted. CI's live Clerk job was green; I did not rerun it locally.

Notes

@allisonmahmood
allisonmahmood force-pushed the mcp/856-log-attribution branch from fd27c49 to 1013df8 Compare October 23, 2026 02:09
@allisonmahmood allisonmahmood mentioned this pull request Oct 23, 2026
@allisonmahmood
allisonmahmood force-pushed the mcp/856-log-attribution branch from 1013df8 to 52de1e0 Compare October 23, 2026 16:16
Base automatically changed from mcp/856-log-attribution to main October 23, 2026 16:28
… flight per person

read_patch and change_patch pass the door's admission once they reach their
target, before a change key is claimed or anything runs: the person's calls a
minute on the patch (mcp.calls.perMinute, 300), their calls in flight across
every agent (mcp.inFlight, 16), then the company's admission, which agents now
spend from the same bucket as pages (CompanyAdmission, moved out of
RuntimeProduction). Every counter is per host replica and keyed by the person.
A refusal is the refusal shape over HTTP 200 with retryAfterSeconds, writes no
log row, keeps the change key free, and names its limit in the request's event.

An admitted call holds its slot until its work settles: the request holds it
while it runs, and Runtime retains it as it dispatches the work (AgentCall's
retain) and lets go when that work ends, so a client that hangs up after
dispatch leaves its slot held and one that gives up before gives it back. An
agent's actions take their own tier2.actions.viewer key beside the person's
page, and an action Runtime refuses before it starts gives its change key back.

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

Every read_patch and change_patch, and every catalogue call, read the company's
patches through Patches.read, whose shared-read edges scan the declarations of
every version of every patch. On a company of 200 patches with 20 versions each
that was about 190 ms of database time per call, which at 300 calls a minute
would keep a platform database core busy for one person's agent. Patches.list
answers the same patches by the same rule without those edges, which the door
never shows; a call there now takes about 27 ms, flat in versions. The portal
keeps Patches.read.

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

An action's ctx.run child is its own run, which can outlast the action when the
action is fenced, so the slot came back while the child still ran. Every run in
an agent call's tree now takes its own hold at its fork and lets it go when it
settles, as Runtime's execution lease already follows the tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s its change key

The supervisor refuses a bind or invoke for residency capacity before dispatch,
so the handler never ran, yet the action's key was settled as used and a retry
after the busy got key_used. ExecutorBusy now gives the key back, as an action
slot or bind refusal does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 684eda7 into main Oct 23, 2026
14 checks passed
@allisonmahmood
allisonmahmood deleted the mcp/857-call-limits branch October 23, 2026 16:43
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
…nd waits for it to start (#892)

Stacked on #889 (ticket #857); merges with the rest of #833's stack, not
alone.

## What changed

An agent's call used to keep its company's server for thirty minutes, as
a tab does, so an agent polling every few minutes kept a company running
around the clock. Now an agent's call keeps the server for a minute
after it settles, on a clock of its own that never touches a tab's
thirty minutes, and a call on a released company waits for the server to
start (up to 40 s) before it's refused `busy` with `retryAfterSeconds:
15`.

Closes #858

## Look at

- **Two clocks on the binding row**
(`packages/execution/src/fleetStore.ts`). `last_activity_at` stays the
documents' clock, with `idle_since` as before: the window starts no
earlier than the first pass to find no document holding the task. A
binding no document or page ever touched (`last_activity_at = 0`) skips
that step. The new `agent_activity_at` is the agents' clock. Agent
admissions run only their own clock and never set or clear `idle_since`.
`idleFence` releases once no document holds the task, nothing is in
flight on it or on a binding of the company still draining, and both
clocks are out.
- **A settling call runs its clock before it lets go of the binding**,
so no pass can find the binding free with the clock not yet run. It lets
go even if that update fails, and then keeps its crash protection to the
deadline. Clocks only move forward (`GREATEST`), so a settlement that
lands late never shortens a later one's window. An update that finds no
live binding runs once more, because a replacement that committed while
it waited is outside its snapshot. That costs a warm call one more
statement, six instead of five: the clock, then the protection clear.
- **A tab's window starts when a pass first sees it gone**, even while
agent work holds the binding. So overlapping agent calls can't postpone
a tab's thirty minutes.
- **Who called** is now a required argument of
`ExecutionLifecycle.acquire` (`"page" | "agent"`), set by Invocation
from the binding's agent. Nested calls ride on their parent's one
admission, so the agent's clock starts when the whole tree, cleanup
included, settles.
- **The deadline.** The bind wait was already outside the handler's
deadline, and the process start inside it. A new Invocation test pins
both: 30 s waiting for the server, then a 2.9 s start succeeds and a 3.1
s start is `handler_timeout`.

## How it was verified

- Fleet tests on Postgres with `TestClock`, all red before the change:
- an agent-only binding survives 5 min of in-flight work and is released
exactly 60 s after settling;
- a call that settles on a binding a deployment replaced while it ran
still gets its minute on the replacement;
- a pass landing right after a long call lets go of the binding finds
the minute already running;
- a document holder that vanished without letting go still leaves its
thirty minutes from the first pass to find it gone;
- a tab that leaves while an agent's call runs starts its thirty minutes
then, not when the call ends;
- a settled call whose clock update fails still lets go of the binding
and idles out after its protection;
- a call settling while a deployment replacement commits runs its minute
on the replacement;
  - an abandoned cold wait still says how long it waited;
- a tab's 30 min and an agent's minute run side by side: a call 29m30s
after the tab let go keeps the task until 30m30s, not 59m30s;
- a call's event says `bound` / `spare` / `launch` and the wait,
including a wait refused at the end of `execution.pool.wait`;
  - binding events carry `agentOnly`.
- The door test: a bind-wait refusal reaches `read_patch` and
`change_patch` as `busy`, "Acme's server is starting; try again in 15
seconds.", `retryAfterSeconds: 15`.
- `pnpm typecheck`, eslint on the changed files, and the execution,
runtime, mcp, analytics, limits and server suites.
- **Dev-instance run.** `pnpm dev up brightline`, with `countDeals`, a
read tool, added to New Business. Agent access was turned on at
`/company`, and Jordan's token came from `pnpm dev mcp-token jordan
--client "Claude Code"`. The dev runner's server is no-pool and its
environment is closed, so a second host from this worktree ran beside it
on the instance's database and storage. It had
`EXECUTION_PROVIDER=local-fleet`, its own `EXECUTION_LOCAL_DIRECTORY`,
`EXECUTION_CALLBACK_URLS`/`EXECUTION_CALLBACK_PORT` and
`PATCHY_PUBLIC_BASE_URL`, and short clocks through `PATCHY_LIMITS_JSON`:
`{"execution.company.agentIdle":10000,"execution.company.idle":60000,"execution.housekeeping.interval":1000}`,
plus `execution.fleet.budget` and `execution.pool.wait` for the last
run. A script sent `read_patch` to that host's `/mcp`, and a watcher
printed Brightline's bindings from the database.

Run at the PR's head (fbc2de3):

<details><summary>An agent calling every 30 s (for every five minutes;
agent idle 10 s): each call binds and the company is released ~11 s
later</summary>

```
22:36:08 call 1: 200 {"result":{"deals":17},"version":2}  565 ms
22:36:09 bindings  24:active
22:36:20 bindings  24:stopped, bound 11.4 s, idle, agentOnly true
22:36:38 call 2: 200 252 ms
22:36:39 bindings  25:active
22:36:50 bindings  25:stopped, bound 10.9 s, idle, agentOnly true
22:37:09 call 3: 200 346 ms
22:37:09 bindings  26:active
22:37:20 bindings  26:stopped, bound 10.7 s, idle, agentOnly true
binding event: {"type":"binding","releaseCause":"idle","agentOnly":true, ...}
```
</details>

<details><summary>A tab beside the agent keeps its own clock (tab 60 s,
agent 10 s): released after both, never extended by agent
calls</summary>

```
22:37:25 bindings  27:active                 Jordan opens New Business
22:37:29 call A: 200, 59 ms                  runs on the tab's binding, no new one
22:38:04.976 the tab leaves                  last_activity_at 22:38:04.976, idle_since 22:38:05.221 (next pass)
                                             -> the tab's window runs to 22:39:05
22:38:25 call B: 200, 121 ms                 had it touched the tab's clock: no release before 22:39:25
22:39:00 call C: 200, 123 ms                 agent_activity_at 22:39:00.322 -> agent clock runs to 22:39:10
22:39:10.541 bindings  27:stopped, bound 105.6 s, idle, agentOnly false
```
</details>

<details><summary>A call on a cold company waits for the bind; one past
the pool wait is refused busy (budget 1 task, pool wait 5 s)</summary>

Calls made the instant the company was released, before the replacement
spare was ready (`execution.fleet.budget: 1`):

```
call 1: {"companyBind":"launch","bindWaitMs":1646,"durationMs":1980}
call 2: {"companyBind":"launch","bindWaitMs":942,"durationMs":1254}
call 3: {"companyBind":"launch","bindWaitMs":761,"durationMs":1003}
call 4: {"companyBind":"launch","bindWaitMs":1096,"durationMs":1434}
```

A Patchy Dev tab holding the only task the budget allows, so
Brightline's server can't start (`"execution.pool.wait":5000`):

```
22:40:35.364 Patchy Dev's tab holds the only task
22:40:35.366 call: 200 after 5228 ms
  {"error":{"code":"busy","from":"patchy","message":"Brightline Studio's server is starting; try again in 15 seconds.","retryAfterSeconds":15}}
  event: {"companyBind":"launch","bindWaitMs":5003,"outcome":"refused","code":"busy","limitId":"execution.pool.wait"}
22:41:34.855 Patchy Dev released; a spare is ready
22:41:34.859 call: 200  {"companyBind":"spare","bindWaitMs":42}
```

Patchy Dev's patch is a copy of New Business published by the instance's
dev key.
</details>

## Release impact

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

Additive migration `0025_agent_idle`:
`execution_bindings.agent_activity_at` (default 0) and
`execution_binding_history.agent_only` (nullable).

- **What does a revert leave behind?** The two new columns, and bindings
an agent claimed with `last_activity_at = 0`.
- **Does the release before it still work with that?** Yes. It never
reads the new columns. `0` is a valid `last_activity_at` to it, and its
own `idle_since` step gives such a binding a fresh thirty minutes.
`idle_since` keeps the meaning both releases give it, so a rollout or
rollback keeps every document's window.

Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and
accepted by GPT-6.1-Sol (xhigh).
allisonmahmood added a commit that referenced this pull request Oct 23, 2026
## What changed

This PR adds release 17's What's new entry, written from `5dd94f3`. It
covers everything merged since release 16's `through` (`dd3f41f`), and
it sets the `patchy` release to `0.17.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`. With this release,
people's agents can use their company's patches through Patchy MCP
(#833).

| Change | PRs |
| --- | --- |
| New: Your AI agent can use your company's tools | #873, #878, #880,
#881, #882, #883, #884, #886, #887 |
| New: Admins choose whether agents can use the company's tools | #871 |
| Improved: Your machines shows your agents too (Revoke all machines is
now Disconnect everything) | #885, #879 |
| New: See what agents can do with a tool | #876 |
| New: The log says when an agent made a change | #888 |
| New: Your agent can make a tool ready for agents | #869, #870, #872,
#875, #896 |
| Behind the scenes: agents' calls have their own limits, and a server
only an agent uses rests a minute after its last call | #889, #892 |
| Behind the scenes: New and Improved changes are public, for
patchyhq.com | #893 |
| Behind the scenes: library updates | #899 |

Five merged PRs get no line:
- #874 is release 16's own entry.
- #894 is dev tooling: worker agent launchers and scenario data. Its one
CLI fix lets a `patchy` installed outside a tier 2 repo publish it. The
skills have agents use the repo's pinned `pnpm patchy` instead, so that
path is off the documented one.
- #900 is CI.
- #901 rewords an internal skill.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- It names only Claude Code and Codex. Both have connected through real
consent against dev instances. Hosted clients (Claude.ai, ChatGPT) are
checked in production only (`docs/product.md` › Patchy MCP ›
Acceptance).
- Its labels are the pages' own: Agent access on Company, Your machines,
What agents can do, Disconnect everything, and "Jordan Lee via Claude".
- **Rollback safety, from the live commit `e4243ff` to `5dd94f3`.**
- No PR in the range is labelled `one-way`, and every PR answers both
Release impact questions with "Yes".
  - Migrations 0020–0025 are all additive:
    - three defaulted or nullable columns on `companies`;
- `agent_name` on the runtime log, with a widened `credential_kind`
check;
    - the agent connection tables, `agent_consents` and `change_keys`;
    - two columns on execution bindings.

The new tables reference `users` without a cascade, but no release
deletes users or companies. Release 16 reads the runtime log only for
credential kinds it knows, so rows from agents can't break it.
- `rollback-rehearsal` on #892 rehearsed the whole stack, since #892
adds the last migration and the rest of the stack sits below it:
`Exercised rollback paths passed: e4243ff → c8bede4 → e4243ff → c8bede4,
in 238s.` #896's run skipped, because it changes no migration or handler
descriptor.
- #883 turns on the load balancer's host header preservation, which the
Deploy workflow's app stack deploy applies. A rollback leaves it on.
That's harmless, because release 16's server never reads `Host`.
- A rollback takes `/mcp` and `/whats-new.json` away. Connected agents
get a 404 until this release returns, and then their connections work
again, unless one ended in between. Agent tools published in between
stay refused to pages, because #837 already shipped in release 16.

## How it was verified

- `pnpm check` on `2d528b1`: format, lint, typecheck and synth passed.
In the test step, 2,300 of 2,301 tests passed. The one failure was
`packages/sdk/src/install.test.ts` › "says how to reach patchy when the
prefix's bin is not on PATH", which timed out at 180 s while the shared
machine was loaded. Rerun alone, that file passes all 7 tests in 62 s.
The release's own tests pass too: `whatsNew.test.ts`, `schemas.test.ts`
and `WhatsNewPages.test.ts`.
- The live commit was pinned from `/healthz/deep`: `e4243ff`, release
16. The Deploy run updated last succeeded, and none is unfinished.
- Each PR in the range was read with `gh pr view`, including its Release
impact answers.

## 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 17 would just see no new release.
- **Does the release before it still work with that?** Yes.

If this release misbehaves, roll back to
`e4243ff54d2acbbc88b60eeb0cf9b82a26dc9d5d` (release 16).

Prepared by Claude Opus 5.5 (xhigh) in Claude Code on T3 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:docs Touches the docs area area:server Touches the server area size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent calls are rate-limited and bounded per person

1 participant