Repository navigation
feat(execution): process events say how long a patch process took to start - #865
Conversation
f262de6 to
b003b14
Compare
Review: GPT-6.1-Sol (xhigh), three roundsRound 1 (6c0a573): one blocking finding.
Round 2 (b003b14): one blocking finding.
Round 3 (d4d2d45): no blocking, should-fix or nit findings. Shutdown ordering against the supervisor's finalizer and watchdog, in-flight batches at close, and error handling all check out. |
d4d2d45 to
b1f09ed
Compare
…start Each process event now carries startMs, from spawn until the process was ready for its first call, and firstOnTask, true for the first process its company task started after being bound. Both are optional on the wire so hosts and supervisors of neighbouring releases keep decoding each other's reports. The numbers let us check, from production's events, that a cold start leaves a query enough of its 3 s deadline before Patchy MCP lands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The no-pool executor behind `pnpm dev` and `patchy dev` kept its process reports in memory and never emitted them, so the dev loop couldn't see a process's start time. It now emits each ended process's wide event within a second and acknowledges it, as the fleet's collection does. A patch repo's compact dev log stays about calls; its --json log carries the full events. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sses Closing the no-pool executor stopped its report loop before the supervisor reaped the processes still running, so their reports were never emitted. Its finalizer now stops the supervisor and emits what is left, after the loop stops; each emit-and-acknowledge step is uninterruptible so a close never sends a report twice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
b1f09ed to
33938a0
Compare
Acceptance: PASS with notesChecked This verdict covers the process-reporting implementation. Allison explicitly excludes production's process-start numbers and the later #833 release gate. Production was never contacted. Rebase verification All three commits match the previously accepted Done means
{"type":"process","tier":2,"processGeneration":1,"cause":"idle","callsServed":14,"startMs":115,"firstOnTask":true}
{"type":"process","tier":2,"processGeneration":2,"cause":"idle","callsServed":4,"startMs":138,"firstOnTask":false}
Golden journeys
Validation Local run: execution, analytics, API, local invocation/subscriptions, both integration callers, CLI dev server, server development wiring and 11 of 14 PR checks have passed; test (24), test (22), browser are still running. No failed checks at posting. The local checks above passed on this head. Head CI run. Notes
Rollback answers: match the diff. A revert leaves already-emitted events and additional keys in stored report JSON. The previous release accepts those keys, the new release accepts older reports, and stored report JSON has no consumer requiring the new shape. This PR changes no migration or infrastructure; no Surfaces: management wire and generated API documentation, analytics schema/vocabulary, dev execution wiring, and compact/JSON CLI logs apply. No new public CLI contract, migration, company-resource caller, served page, lifecycle transition or package layout change. Not run
No tracked files, PR code, branch, body or labels were changed. The throwaway environment and checkout are being removed after posting. |
…vents, as #865 asks Co-Authored-By: Claude Opus 5.5 <[email protected]>
…874) ## What changed Release 16's What's new entry, written from `dd3f41f`. It covers everything merged since release 15's `through` (`9e4b0df`), and sets the `patchy` release to `0.16.0` (`packages/patchy/package.json` and `CURRENT_RELEASE`). | Change | PRs | | --- | --- | | Fixed: Revoke all machines stops logins still on their way | #867 | | Behind the scenes: `mcp` and `oauth` kept off company addresses | #863 | | Behind the scenes: read-only actions and agent tools understood and enforced before anything writes them | #868 | | Behind the scenes: logs record how long a tool's server takes to start | #865 | #814 is release 15's own entry, so it's left out. #818 and #831 are docs (Patchy is live; the Patchy MCP spec) and #864 is dev tooling, so none of them gets a line. ## Look at - **The entry**, at the top of `releases` in `packages/core/src/whatsNew.ts`. #867 is the only change a person could notice. The page's button is still labelled "Revoke all machines" (Disconnect everything is the spec's future name), so the entry uses that label. - **Rollback safety, from the live commit `d77baaf` to `dd3f41f`.** No PR in the range is labelled `one-way`, and every PR answers both Release impact questions with "Yes". - #867 is the only migration: `0019_credentials_ended` adds two nullable columns, `users.credentials_ended_at` and `device_logins.confirmed_at`. At `d77baaf`, every insert into `users` and `device_logins` lists its columns, and nothing reads either table with `SELECT *`. - `rollback-rehearsal` passed on #863, #865, #867 and #868. #868's run covered #867's migration already on main: `Exercised rollback paths passed: d77baaf → ffe9988 → d77baaf`. - A rollback would reopen what #867 closes: an approved login that hasn't finished could again get past Revoke all machines. It would also let new companies take the `mcp` and `oauth` addresses (#863). No release that writes read-only actions or agent tools has shipped, so going back past #868 leaves nothing behind. ## How it was verified - `vitest run packages/core/src/whatsNew.test.ts packages/api/src/schemas.test.ts`: 14 passed. - `pnpm typecheck`: 23 of 23 tasks pass. Prettier and eslint are clean on the changed files. - The live commit was pinned from `/healthz/deep` (`d77baaf`, release 15). 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 The changelog text plus the `patchy` version bump. A CLI installed before this deploy is told to upgrade, as with every release. - **What does a revert leave behind?** Nothing. People whose seen marker reached 16 would just see no new release. - **Does the release before it still work with that?** Yes. If this release misbehaves, roll back to `d77baafcf10c7cdf28c71bd65ea1a0009aa99ced` (release 15). Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>

What changed
An agent's call on a company whose server is released waits for the bind, then the version's process start counts against the query's 3 s deadline. Nothing recorded how long a process start takes, so nobody could check that a cold start on Fargate leaves a query enough of its 3 s.
Each process event now says how long its process took to start (
startMs, from spawn until ready for its first call) and whether it was the first process its company task started after being bound (firstOnTask). Both are optional on the private management wire, so hosts and supervisors from neighbouring releases keep decoding each other's reports.The dev executor behind
pnpm devused to keep its process reports in memory and never emit them. It now emits them too, so the dev loop sees the same events.Closes #836
Look at
A process event as the host emits it, from the local fleet (a separate supervisor process per task, over the management wire, decoded, stored and emitted by the host: the path production takes, run offline). Trimmed:
{ "type": "process", "tier": 2, "processGeneration": 1, "cause": "stopped", "durationMs": 683, "callsServed": 1, "startMs": 576, "firstOnTask": true }The same events in the dev loop.
pnpm dev up brightline, New Business opened, then its processes left to idle out. Frompnpm dev logs, trimmed:What decides the numbers is two lines in
packages/execution/src/supervisor.ts:startMsis taken when the load finishes and the process is marked ready, andfirstOnTaskisgeneration === 1. A supervisor serves one company for its life and counts generations from one. A process that never became ready, such as aload_failedone, has nostartMs.The test, red then green. Before the supervisor change,
reports how long each process took to start, and whether it was its task's firstfails on its first assertion:With it:
Tests 2 passed(the new test, plus theload_failedone now assertingstartMsis absent). Likewise, the newLocal.test.tscase, where two versions idle out and both events arrive, timed out with nothing delivered before the dev executor forwarded reports.How the dev executor emits them (
packages/execution/src/local.ts): a scoped fiber reads the supervisor's reports about once a second, emits each event, then acknowledges them, the same way the fleet's collection does. When the executor closes, it stops the supervisor and emits what's left, so processes still running at shutdown are reported too. It needsWideEventsfrom the environment. The server's dev wiring passes it through, and tests that build the executor directly provideWideEvents.layerNoop. A patch repo's compactpatchy devlog skips process events (packages/patchy/src/devLog.ts), so builders don't get a line each time an old version idles out. Its--jsonlog carries them.How it was verified
firstOnTask: true, the secondfalse. Both have astartMsthat is above zero and fits within the bind and the process's life. A load that expires has none.firstOnTaskandstartMs.Local.test.tscase for the no-pool dev executor: a process that idles out is emitted by the loop, and one still running when the executor closes is emitted withcause: "stopped". Hand-checked onpnpm dev up brightline(above).~/Patchygained nothing.pnpm verifyond4d2d45: 8 of 9 steps pass. Theteststep had one 5-second timeout inPgliteCompanyDatabases.test.tsat load average 17, in code this PR doesn't reach. It passes alone and in CI on all three Node versions. On the previous head,b003b14, all 9 steps passed; since then onlylocal.ts's shutdown and its test have changed.Supervisor,Fleet,Management,LocalTaskProvider,packages/analyticsandpackages/api(12 files, 114 tests), plus everyLocal.makecaller (Local,InvocationLocal,QuerySubscriptionsLocal,HandlerTls, PostHogRuntime,devServer,DevelopmentExecution).pnpm typecheck, lint and format pass.Surfaces: the management wire (
packages/api/src/management.ts, its prose inmarkdown.tsrendered intodocs/API.md), the wide event schema (packages/analytics), the Analytics glossary (Process start),docs/OPERATIONS.md(what emits them, and a Logs Insights query) and the dev executor. The skills already saypatchy dev --jsonrecords full wide events. No CLI, migration, dev-runner or page change.Reading production's numbers (release gate, not done here)
Once this has been live for a few days, this read-only HogQL query gives the p50, p90 and maximum process start on Fargate against the 3 s deadline.
firstOnTask IS NOT NULLkeeps only reports from supervisors of this release or later:Starts that never became ready don't have a
startMs. Count them by cause with the same filter andproperties.startMs IS NULL, grouped byproperties.cause. ThefirstOnTask = truerow is the cold start an agent's first call on a released company pays. Its p90 and max against 3000 ms answer #833's question.Release impact
Two optional fields added to a private wire's process event and to the wide event. No schema, CLI or config change.
execution_processeswhose stored report JSON has the two extra keys. Nothing reads that JSON back.Built by Claude Opus 5.5 (xhigh) in Claude Code on T3 Code; reviewed and accepted by GPT-6.1-Sol (xhigh).