Skip to content

fix(showcase/harness): reap chromium zombies, alarm on PID saturation, stop saturated workers claiming - #6333

Merged
jpr5 merged 3 commits into
mainfrom
fix/showcase-harness-pid-reaper
Aug 12, 2026
Merged

jpr5 merged 3 commits into
mainfrom
fix/showcase-harness-pid-reaper

Conversation

@jpr5

@jpr5 jpr5 commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

This PR carries three changes to the same prod incident. Change 1 fixes
the PID leak itself; changes 2 and 3 fix the two reasons the leak was able to
starve the fleet unannounced. Each has its own RED → GREEN below.

# Commit What it fixes
1 e66fb1af13 The leak. No PID-1 reaper, so crashed chromium grandchildren become permanent zombies holding cgroup PID slots.
2 7f28e9bd39 Nothing alarmed. The worker heartbeats its cgroup PID gauges and no non-test code read them.
3 63ef4081c2 Saturated workers kept claiming. The claim gate only checked free browser-context slots, so a worker at 1000/1000 PIDs won jobs it could not run and burned each to a 600000ms abort.

CHANGE 1 — the leak (tini as PID 1)

The bug

harness-workers has no PID-1 zombie reaper, so it leaks cgroup PID slots until it cannot launch a browser.

libuv's SIGCHLD handler only waitpid()s the pids Node itself spawned. Playwright spawns the chromium browser process (reaped fine), but that browser's zygote/renderer/GPU children are grandchildren. When a browser process dies — prod's Target crashed path, or a pool self-heal relaunch — those grandchildren are re-parented onto PID 1 and exit. Node-as-PID-1 never waits on them, so each becomes a permanent <defunct> still holding a cgroup PID slot.

Prod, on a single container up 6d22h: zombieCount 70 → 757, cgroupPidsCurrent 286 → 1000/1000. Once saturated, probes could not launch browsers (Target crashed, browserContext.newPage: … has been closed, feature exceeded 300000ms wall-clock) and 295 of 414 red prod d6 cells went abort, fleet-wide across ~20 slugs.

This Dockerfile already documented the outage mode in a 40-line FIX #3 block — but both of its stated mitigations are demand-side (BROWSER_POOL_MAX_CONTEXTS 40→24, resource-gauge warning logs). Those cap the peak of pids.current. They cannot stop a monotonic leak, and prod died of a monotonic leak. resource-gauges.ts only ever measured zombies (if (s.state === "Z") zombieCount += 1); nothing reaped them.

The change

One file, +59/-3. tini as PID 1.

RUN node ./node_modules/playwright/cli.js install --with-deps chromium \
 && apt-get install -y --no-install-recommends tini \
 && /usr/bin/tini --version \
 && rm -rf /var/lib/apt/lists/*
…
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/bin/bash", "-c", "ulimit -u $(ulimit -Hu) 2>/dev/null || true; exec node dist/orchestrator.js"]

Why this form:

  • tini baked into the image, not Docker --init — --init is a runtime flag and Railway does not expose it, the same reason pids.max isn't settable from here (already documented in this file).
  • Not an in-process reaper — Node has no waitpid binding, so an application SIGCHLD handler would need a native addon. This is the platform's job.
  • Rides the existing apt layer — playwright's --with-deps just ran apt-get update, so this costs one ~267KB package download instead of a second index refresh. The tini --version call is a build-time assertion on the path baked into ENTRYPOINT: if a future Debian moves the binary, the build fails rather than the container failing to start in prod.
  • No -g — tini's process-group broadcast would signal the live chromium pool alongside node and pre-empt orchestrator.ts's process.once("SIGTERM", drainAndExit). Without it, delivery is byte-identical to today: exactly one process gets the signal.
  • Exec form, exec kept in CMD — tini really is PID 1 and really receives Railway's SIGTERM; node is tini's direct child with no bash lingering in the tree.

No existing convention to match: grep for tini/dumb-init/--init across every Dockerfile in the repo returns zero hits. Nothing in the repo asserts on this image's CMD/ENTRYPOINT, and nothing outside the CI build step docker runs it, so adding an ENTRYPOINT breaks no consumer.


RED → GREEN

Real container, real chromium, real zombies. Identical argv for both; only the image differs, and the image supplies PID 1:

docker run --rm --pids-limit 1000 -e REPRO_CYCLES=230 \
  -v <repro>:/repro:ro <image> /bin/bash -c "exec node /repro/zombie-repro.mjs"

--pids-limit 1000 mirrors Railway's platform-fixed ceiling. Each cycle launches chromium with the exact args browser-pool.ts uses (headless, --no-sandbox, --disable-dev-shm-usage), opens a context+page, then SIGKILLs the browser process — prod's Target crashed path, orphaning its children onto PID 1.

Measurement is container-wide on purpose. The harness's own sampleResourceGauges() walks the tree from process.pid; under a real init the orphans re-parent to the init, not to node, so a node-rooted walk would report zero zombies whether or not they were reaped — a vacuous GREEN. Counting every state-Z process in /proc plus the cgroup counter is blind to which process is PID 1, so it is honest in both directions.

RED (unmodified main, pid1=node)

20 cycles — exactly +5 permanent zombies per crashed browser:

baseline zombieCount=0 procCount=1 threadCount=7 cgroupPidsCurrent=7 cgroupPidsMax=1000 selfPid=1 pid1=node
  PID  PPID S THR COMMAND
    1     0 R   7 node
cycle=1 pre-kill zombieCount=0 procCount=7 threadCount=76 cgroupPidsCurrent=76 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=1 zombieCount=5 procCount=6 threadCount=16 cgroupPidsCurrent=16 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=2 zombieCount=10 procCount=11 threadCount=21 cgroupPidsCurrent=21 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=3 zombieCount=15 procCount=16 threadCount=26 cgroupPidsCurrent=26 cgroupPidsMax=1000 selfPid=1 pid1=node
…
cycle=20 zombieCount=100 procCount=101 threadCount=111 cgroupPidsCurrent=111 cgroupPidsMax=1000 selfPid=1 pid1=node
final    zombieCount=100 procCount=101 threadCount=111 cgroupPidsCurrent=111 cgroupPidsMax=1000 selfPid=1 pid1=node
SUMMARY cycles=20 zombiesBefore=0 zombiesAfter=100 pidsBefore=7 pidsAfter=111 launchFailure=none

The leaked processes, verbatim from the final /proc table — all ppid=1, all Z:

   21     1 Z   1 headless_shell <defunct>
   22     1 Z   1 headless_shell <defunct>
   36     1 Z   1 headless_shell <defunct>
   61     1 Z   1 headless_shell <defunct>
   77     1 Z   1 headless_shell <defunct>
   87     1 Z   1 headless_shell <defunct>
   88     1 Z   1 headless_shell <defunct>
  104     1 Z   1 headless_shell <defunct>

cgroupPidsCurrent after each cycle never returns to 7 — it is 7 + 5×cycles. A monotonic ratchet, the same curve prod walked over 7 days.

RED, driven to saturation (started before the Dockerfile was touched)

baseline  zombieCount=0    cgroupPidsCurrent=7    /1000
cycle=25  zombieCount=125  cgroupPidsCurrent=136  /1000
cycle=50  zombieCount=250  cgroupPidsCurrent=261  /1000
cycle=75  zombieCount=375  cgroupPidsCurrent=386  /1000
cycle=100 zombieCount=500  cgroupPidsCurrent=511  /1000
cycle=125 zombieCount=625  cgroupPidsCurrent=636  /1000
cycle=150 zombieCount=750  cgroupPidsCurrent=761  /1000     ← prod's ~757 reproduced
cycle=175 zombieCount=875  cgroupPidsCurrent=886  /1000
cycle=184 pre-kill  zombieCount=915  cgroupPidsCurrent=993  /1000
cycle=185 pre-kill  zombieCount=920  cgroupPidsCurrent=996  /1000
cycle=185           zombieCount=925  cgroupPidsCurrent=936  /1000
   ← no further output. Cycle 186 never completed.

The run wedged at cycle 185 with no output for >12 minutes: chromium.launch() could not get PIDs and never returned — it did not even surface Playwright's 30s launch timeout, which is exactly why prod shows 300s feature timeouts and 1200s run aborts instead of a clean launch error. docker ps: Up 17 minutes (unhealthy).

$ docker exec red-sat cat /sys/fs/cgroup/pids.current /sys/fs/cgroup/pids.max
1000
1000

And the errno-11 signature this Dockerfile's own comment names — the container could no longer fork() at all:

$ docker exec red-sat /bin/bash -c 'for i in 1 2 3; do cat /proc/uptime; done'
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: Resource temporarily unavailable

That is the prod outage, end to end, in a local container.

GREEN (this PR's image, pid1=tini) — same repro, same argv, 230 cycles

baseline zombieCount=0 procCount=2 threadCount=8 cgroupPidsCurrent=8 cgroupPidsMax=1000 selfPid=7 pid1=tini
  PID  PPID S THR COMMAND
    1     0 S   1 tini
    7     1 R   7 node
cycle=1   pre-kill zombieCount=0 procCount=8 threadCount=76 cgroupPidsCurrent=76 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=1            zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=50           zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=100          zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=150          zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=200          zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=230 pre-kill zombieCount=0 procCount=8 threadCount=77 cgroupPidsCurrent=77 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=230          zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
final              zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
SUMMARY cycles=230 zombiesBefore=0 zombiesAfter=0 pidsBefore=8 pidsAfter=12 launchFailure=none

procCount returning to 2 (tini + node) after every single cycle is the reap actually happening: the browser's 6 processes appear pre-kill (procCount=8) and are fully gone post-kill.

RED (pid1=node) GREEN (pid1=tini)
zombies after 20 cycles 100 0
zombies at cycle 185 925 0
pids.current floor at cycle 185 936, peaking 996/1000 12
reached cycle 230? no — wedged at 185 yes
chromium.launch() hangs; fork: Resource temporarily unavailable fine, launchFailure=none
leak per crashed browser +5 0

Signals and non-zero exit still work

The prober's container must still self-restart on crash, so this was proven, not assumed. signal-child.mjs installs the same process.once("SIGTERM", …) shape orchestrator.ts uses; run on both images:

--- GREEN (ENTRYPOINT tini, pid1=tini) ---
[showcase-harness:green MODE=term-graceful] exitCode=0
    CHILD mode=term-graceful pid=7 ppid=1
    CHILD ready — idling until signalled
    CHILD received SIGTERM at pid=7 — draining        ← tini FORWARDED it to node
[showcase-harness:green MODE=exit-42] exitCode=42     ← non-zero preserved
[showcase-harness:green MODE=abort]   exitCode=134    ← 128+6 (SIGABRT), non-zero
--- RED (no ENTRYPOINT, pid1=node) — baseline ---
[showcase-harness:red MODE=term-graceful] exitCode=0
    CHILD received SIGTERM at pid=1 — draining
[showcase-harness:red MODE=exit-42] exitCode=42
[showcase-harness:red MODE=abort]   exitCode=133
  • SIGTERM reaches node, not just tini — the handler fires at pid=7, so docker stop's SIGTERM was forwarded into the process that owns the graceful drain. orchestrator.ts's drainControlPlaneAndExit("SIGTERM") path is intact.
  • Non-zero exits survive — exit(42) → container 42; a crash still exits non-zero, so Railway still restarts. The HEALTHCHECK restart-on-sustained-503 behaviour this Dockerfile calls "THE INTENDED OUTCOME" is untouched.
  • tini is strictly more correct here: note RED's abort → 133 vs GREEN's → 134. A process running as PID 1 in a namespace has default signal actions ignored by the kernel, so node-as-PID-1 was distorting its own fatal-signal exit code (128+SIGTRAP instead of 128+SIGABRT). Both non-zero, so no regression — but the fixed image reports crashes accurately.

Cross-arch check

Local images are arm64; prod builds amd64. tini availability was verified on amd64 explicitly rather than assumed — same path the build-time assertion checks:

Package: tini
Architecture: amd64
Version: 0.19.0-1+b3
-rwxr-xr-x 1 root root 27792 Jun  6  2025 /usr/bin/tini
tini version 0.19.0

Pre-push checks

Check Result
docker buildx build -f showcase/harness/Dockerfile (== CI's build check) PASS, both images
nx run @copilotkit/showcase-harness:typecheck PASS
nx run @copilotkit/showcase-harness:test:ci 3677 passed, 18 skipped, 1 failed — environmental, see below
commitlint PASS
lefthook pre-commit + commit-msg PASS
git status clean

The single failure is d0-gone-predicate.test.ts > resolves the real generated registry.json…, failing on ENOENT … showcase/shell/src/data/registry.json. That file is gitignored and generated at build time — this Dockerfile's own comment says so, which is why the image generates it via generate-registry.ts. Proven environmental rather than assumed: generated the file, re-ran that exact spec, 11/11 passed. A Dockerfile-only diff cannot affect a vitest run.

No formatter/linter covers this file: lefthook's lint-fix glob is *.{js,jsx,ts,tsx,mjs,cjs,md,css,yml,yaml,html,vue,py}, and there is no hadolint anywhere in CI.

Not in this PR

  • This does not fix prod by itself. Prod is digest-pinned and still running the leaking container; it needs the live mitigation restart (owned by a separate worker — prod was not touched here) and then a promote to pick this image up.
  • The ≥3-cell value test is not done and cannot be done from this PR — confirming red cells flip requires the prod restart plus a fleet sweep. Note the ~20 conversation-error and ~16 goto-error cells are almost certainly unrelated real bugs this will not fix; only the abort/feature-timeout/driver-error population is in scope.
  • Alerting / scheduled recycle is deliberately out of scope (one concern per change). Still worth doing: the documented pool-unrecoverable alarm demonstrably never fired at 1000/1000, and cgroupPidsCurrent/cgroupPidsMax > 0.75 would have given ~36h of warning before the flip.
  • Leak rate on the graceful browser.close() path was not measured — irrelevant to the fix (tini reaps either way), but it means prod's exact 757 can't be attributed to crashes alone.

RE-VERIFICATION 2026-08-12 — rebased onto origin/main, red-green re-run from scratch

The proof above was produced 2026-08-03 against a base that predates
ced993447f ("copy patches/ into harness build context"), which touches THIS
Dockerfile. The branch has been rebased onto current origin/main and the
whole red-green was re-run on freshly built images so the numbers describe the
actual merge candidate.

Both images built locally from this repo, same machine, same context, ~3 min apart:

showcase-harness:red-main    sha256:b86686e9a06d51f884d5e59e9d15d667fd298284efe7a15622ff3bf2575a3ffd created=2026-08-12T20:15:50Z  (origin/main Dockerfile, /usr/bin/tini ABSENT, Entrypoint=["docker-entrypoint.sh"])
showcase-harness:green-tini  sha256:d666b823f16bda07bf62d35f1d72ef099d13406a61e2f0cd51c99bf51eb14df4 created=2026-08-12T20:18:54Z  (this branch,          /usr/bin/tini present, Entrypoint=["/usr/bin/tini","--"])

Identical driver, identical argv, 40 cycles each, runs 18 seconds apart:

docker run --rm --pids-limit 1000 -e REPRO_CYCLES=40 -v <repro>:/repro:ro <image> \
  /bin/bash -c "exec node /repro/zombie-repro.mjs"

RED — showcase-harness:red-main, pid1=node (2026-08-12T20:19:28Z)

baseline zombieCount=0 procCount=1 threadCount=7 cgroupPidsCurrent=7 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=1 pre-kill zombieCount=0 procCount=7 threadCount=76 cgroupPidsCurrent=76 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=1 zombieCount=5 procCount=6 threadCount=16 cgroupPidsCurrent=16 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=2 pre-kill zombieCount=5 procCount=12 threadCount=83 cgroupPidsCurrent=83 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=2 zombieCount=10 procCount=11 threadCount=21 cgroupPidsCurrent=21 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=10 pre-kill zombieCount=45 procCount=52 threadCount=120 cgroupPidsCurrent=120 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=10 zombieCount=50 procCount=51 threadCount=61 cgroupPidsCurrent=61 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=20 pre-kill zombieCount=95 procCount=102 threadCount=174 cgroupPidsCurrent=174 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=20 zombieCount=100 procCount=101 threadCount=111 cgroupPidsCurrent=111 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=30 pre-kill zombieCount=145 procCount=152 threadCount=219 cgroupPidsCurrent=219 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=30 zombieCount=150 procCount=151 threadCount=161 cgroupPidsCurrent=161 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=40 pre-kill zombieCount=195 procCount=202 threadCount=271 cgroupPidsCurrent=271 cgroupPidsMax=1000 selfPid=1 pid1=node
cycle=40 zombieCount=200 procCount=201 threadCount=211 cgroupPidsCurrent=211 cgroupPidsMax=1000 selfPid=1 pid1=node
final zombieCount=200 procCount=201 threadCount=211 cgroupPidsCurrent=211 cgroupPidsMax=1000 selfPid=1 pid1=node
SUMMARY cycles=40 zombiesBefore=0 zombiesAfter=200 pidsBefore=7 pidsAfter=211 launchFailure=none

All 200 leaked processes are ppid=1, state Z (tail of the final /proc table):

 2610     1 Z   1 headless_shell <defunct>
 2612     1 Z   1 headless_shell <defunct>
 2646     1 Z   1 headless_shell <defunct>
 2661     1 Z   1 headless_shell <defunct>
 2662     1 Z   1 headless_shell <defunct>
 2678     1 Z   1 headless_shell <defunct>
 2680     1 Z   1 headless_shell <defunct>
 2717     1 Z   1 headless_shell <defunct>

GREEN — showcase-harness:green-tini, pid1=tini (2026-08-12T20:19:46Z)

baseline zombieCount=0 procCount=2 threadCount=8 cgroupPidsCurrent=8 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=1 pre-kill zombieCount=0 procCount=8 threadCount=76 cgroupPidsCurrent=76 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=1 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=2 pre-kill zombieCount=0 procCount=8 threadCount=78 cgroupPidsCurrent=78 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=2 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=10 pre-kill zombieCount=0 procCount=8 threadCount=79 cgroupPidsCurrent=79 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=10 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=20 pre-kill zombieCount=0 procCount=8 threadCount=76 cgroupPidsCurrent=76 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=20 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=30 pre-kill zombieCount=0 procCount=8 threadCount=77 cgroupPidsCurrent=77 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=30 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=40 pre-kill zombieCount=0 procCount=8 threadCount=79 cgroupPidsCurrent=79 cgroupPidsMax=1000 selfPid=7 pid1=tini
cycle=40 zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
final zombieCount=0 procCount=2 threadCount=12 cgroupPidsCurrent=12 cgroupPidsMax=1000 selfPid=7 pid1=tini
SUMMARY cycles=40 zombiesBefore=0 zombiesAfter=0 pidsBefore=8 pidsAfter=12 launchFailure=none

grep -c defunct over the GREEN run: 0. procCount returns to 2
(tini + node) after every cycle — the browser's 6 processes appear pre-kill
(procCount=8, threadCount 76–79) and are fully gone post-kill.

RED (pid1=node) GREEN (pid1=tini)
image id b86686e9a06d d666b823f16b
cycles 40 40
zombies after 200 0
zombies per crashed browser +5 0
pids.current before → after 7 → 211 8 → 12
<defunct> rows in final table 200 0
launchFailure none none

Signals / non-zero exit, both images, this run

[showcase-harness:RED   MODE=term-graceful] exitCode=0
    CHILD mode=term-graceful pid=1 ppid=0
    CHILD received SIGTERM at pid=1 — draining
[showcase-harness:RED   MODE=exit-42]   exitCode=42
[showcase-harness:RED   MODE=abort]     exitCode=133
    RED  /proc/1/comm = bash

[showcase-harness:GREEN MODE=term-graceful] exitCode=0
    CHILD mode=term-graceful pid=7 ppid=1
    CHILD received SIGTERM at pid=7 — draining     <- tini FORWARDED it to node
[showcase-harness:GREEN MODE=exit-42]   exitCode=42
[showcase-harness:GREEN MODE=abort]     exitCode=134
    GREEN /proc/1/comm = tini, child self=7

SIGTERM reaches node (handler fires at pid=7), non-zero exits survive
(42 → 42; abort → 134 = 128+6), so Railway's restart-on-crash is intact.

The prod leak, measured live the same day

resource_snapshots in prod PocketBase, immediately before the mitigation
restart on the unfixed digest sha256:80a0c5c2…:

2026-08-12 20:10:00.674Z worker-7abf6 heartbeat pids=1000/1000 zombies=758 procs=778 threads=1000
2026-08-12 20:09:59.783Z worker-5a213 heartbeat pids=1000/1000 zombies=761 procs=781 threads=1000
2026-08-12 20:09:54.868Z worker-de14c heartbeat pids=837/1000  zombies=744 procs=753 threads=837

and immediately after it (init rows): pids=164–169/1000 zombies=0 procs=16.
A new zombie was already recorded at 2026-08-12 20:12:27.182Z worker-de14c … zombies=1.

Cross-arch

Local images are arm64 (/usr/bin/tini 68592 bytes); prod builds amd64.
Measured on amd64 directly: Package: tini / Architecture: amd64 / Version: 0.19.0-1+b3, /usr/bin/tini 27792 bytes, tini version 0.19.0;
package download 267,204 bytes, 749 kB on disk.

Deploy note

computePromoteClosure(["showcase-harness"]) = pocketbase(0), harness(1), dashboard(1), harness-workers(1) — the workers are in the promote scope.
Prod startCommand is null and no repo consumer overrides the entrypoint,
so Railway uses the image's ENTRYPOINT+CMD. PR #5750 is CLOSED unmerged, so
promoting harness-workers resets multiRegionConfig.us-west2.numReplicas to
1 and it must be re-asserted to 6 and read back after the promote.


CHANGE 2 — nothing alarmed (worker PID-saturation alarm)

Commit 7f28e9bd39.

The gap

The measured prod condition on 2026-08-12 20:09–20:10Z was pids=1000/1000,
1000/1000, 837/1000 across three workers, 320 timeout after 600000ms
abort rows, an e2e-smoke run 42 minutes into a 15-minute cadence with 3 jobs
still pending, prod d6 534/784 vs staging 744/788. No alarm fired, and this
was the second occurrence (2026-08-03, 2026-08-10).

The documented pool-unrecoverable alarm did not fire by construction: it is
raised only when BrowserPool's self-heal circuit-breaker exhausts
selfHealMaxHardRecoveries. A worker that is PID-starved but still heartbeating
never reaches that state — it launches browsers fine, it just cannot fork the
process tree a probe needs.

The signal was already on the wire and read by nobody:

  • worker/registration.ts:192 writes capacity_pids_current /
    capacity_pids_max onto the worker's workers row on its ~75s heartbeat
    (DEFAULT_WORKER_HEARTBEAT_MS = 75_000).
  • control-plane/fleet-health.ts lists that entire roster every 15s
    (DEFAULT_FLEET_HEALTH_INTERVAL_MS) — and its own comment on the row type
    said "the capacity gauges are ignored here."
  • Nothing in non-test source compared pidsCurrent to pidsMax.

Where the alarm goes, and why

Control-plane, not worker. writers/status-writer.ts documents fleet-cp
as "the only authoritative fleet writer; workers never write status directly",
so a worker cannot raise a system: health key. fleet-health already holds
the roster read this needs, on a 15s cadence, so the alarm costs zero extra PB
traffic.

Routed to #oss-alerts, not to the browser-pool webhook.
SLACK_WEBHOOK_BROWSER_POOL_UNRECOVERABLE appears nowhere in this repo
outside its own definition
— grep finds it only in orchestrator.ts — so it
is unset everywhere and that alarm has no receiver even when it does fire.
SLACK_WEBHOOK_OSS_ALERTS is a real wired secret that the family-silence
monitor and the D0-gone monitor already post through. Routing a new alarm to a
known-unwired webhook would reproduce the exact gap this closes.

Thresholds

  • Alarm at pids.current / pids.max >= 0.75. At the observed leak rate
    (~1000 PIDs over ~7 days) that is roughly 36 hours of lead time — more than a
    working day. A busy worker's context budget is nowhere near 750 PIDs.
  • Latched per worker, clearing at 0.65. The monitor ticks every 15s; an
    unlatched alarm would page ~8600 times across that 36-hour window. An alarm
    that fires constantly is worse than none, so createFleetHealthMonitor now
    fails loud at construction on a ratio pair with no hysteresis gap.
  • Evaluated before the online/stale branch, because the failing worker is
    fully online — it heartbeats on time throughout.
  • Unmeasured gauges never alarm. registration.ts maps the pool's -1
    sentinel to null; pidUsageRatio returns null for null/absent/negative
    current or non-positive max, and null is never read as zero.

RED → GREEN (change 2)

Driver exercises the real chain end-to-end, faking only the OS cgroup read
(BrowserPoolOptions.cgroupPidsReader, an existing injectable seam) and the PB
transport. The column names are whatever the real registration writer emits and
whatever the real fleet-health reader consumes, so a column drift fails this
driver:

BrowserPool.budget()            [real, probes/helpers/browser-pool.ts]
  -> workerCapacityFromBudget   [real, fleet/contracts.ts]
  -> registerWorker()           [real, fleet/worker/registration.ts]
  -> workers row
  -> createFleetHealthMonitor().checkOnce()
                                [real, fleet/control-plane/fleet-health.ts]
  -> alarm sink

Identical command both sides; only the source differs:

./node_modules/.bin/tsx <scratch>/drive-alarm.mts

RED — unmodified source

=== A1 SATURATED 900/1000 (ratio 0.90) ===
  pool.budget() pids      : 900/1000
  workers row gauges      : capacity_pids_current=900 capacity_pids_max=1000
  fleet-health cycles run : 1
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : <field does not exist>
  error-level log events  : <none>

=== A2 CEILING   1000/1000 (ratio 1.00) ===
  pool.budget() pids      : 1000/1000
  workers row gauges      : capacity_pids_current=1000 capacity_pids_max=1000
  fleet-health cycles run : 1
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : <field does not exist>
  error-level log events  : <none>

=== A6 LATCH     900/1000 over 5 cycles ===
  fleet-health cycles run : 5
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : <field does not exist>
  error-level log events  : <none>

The exact prod condition — a worker at the ceiling — produces zero alarms.

GREEN — with this change

=== A1 SATURATED 900/1000 (ratio 0.90) ===
  pool.budget() pids      : 900/1000
  workers row gauges      : capacity_pids_current=900 capacity_pids_max=1000
  fleet-health cycles run : 1
  ALARM HOOK CALLS        : 1
  result.pidSaturated     : 1
  error-level log events  : ["fleet.health.worker-pid-saturated"]
  ALARM PAYLOAD           : {"workerId":"worker-drv","pidsCurrent":900,"pidsMax":1000,"ratio":0.9,"threshold":0.75,"lastHeartbeatAt":"2026-08-12T20:44:54.244Z","observedAt":"2026-08-12T20:44:54.244Z"}

=== A2 CEILING   1000/1000 (ratio 1.00) ===
  ALARM HOOK CALLS        : 1
  result.pidSaturated     : 1
  error-level log events  : ["fleet.health.worker-pid-saturated"]
  ALARM PAYLOAD           : {"workerId":"worker-drv","pidsCurrent":1000,"pidsMax":1000,"ratio":1,"threshold":0.75,"lastHeartbeatAt":"2026-08-12T20:44:54.253Z","observedAt":"2026-08-12T20:44:54.253Z"}

The alarm must also stay QUIET — same run, same command

=== A3 QUIET     500/1000 (ratio 0.50) ===
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : 0
  error-level log events  : <none>

=== A4 QUIET     740/1000 (ratio 0.74, just under) ===
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : 0
  error-level log events  : <none>

=== A5 QUIET     -1/-1 (cgroup unreadable) ===
  pool.budget() pids      : -1/-1
  workers row gauges      : capacity_pids_current=null capacity_pids_max=null
  ALARM HOOK CALLS        : 0
  result.pidSaturated     : 0
  error-level log events  : <none>

=== A6 LATCH     900/1000 over 5 cycles ===
  fleet-health cycles run : 5
  ALARM HOOK CALLS        : 1        <- once, not five times

A4 pins the boundary at 0.74. A5 pins the off-Linux case: the -1 sentinel
lands as null on the row and stays silent rather than reading as 0. A6
pins the latch — 5 saturated cycles, 1 alarm.


CHANGE 3 — saturated workers kept claiming (PID headroom claim gate)

Commit 63ef4081c2.

The defect

fleet/worker/worker-loop.ts had exactly one conditional in the claim loop:

if (budget.available <= 0) { … idle … }

and available is free Playwright browser-context slots and nothing else —
browser-pool.ts: available: Math.max(0, this.maxContexts - this.liveContextCount).
Context slots have no relationship to cgroup PIDs. A worker whose container has
leaked to pids=1000/1000 therefore still advertises full capacity, keeps
winning claims, cannot fork the browser tree, and burns each job's entire
600000ms lease before aborting. That is the mechanism behind the 320 abort rows.

Blast radius — what happens when ALL workers are saturated

The gate deliberately reuses the same decline-and-idle path as the existing
no-budget branch, which is what makes total saturation safe:

  • the job is never claimed, so it is never dropped and never requeued — it
    stays pending for a healthy worker, or for this one after a redeploy;
  • the loop then sleeps a full pollIntervalMs, so a fully-saturated fleet
    idles at the poll cadence instead of spinning;
  • the queue stalls visibly: probe_jobs rows pile up pending, a rising-edge
    fleet.worker.pid-headroom-exhausted warn says why (warn → stderr → Sentry;
    steady state drops to debug so a multi-hour stall does not flood), and
    change 2's system:worker-pid-saturation alarm fired at 0.75 before this
    gate engaged at 0.90.

A stalled, alarmed queue is recoverable by redeploy. Claim-fail-repeat silently
burned the whole cadence.

Why the gate is 0.90 and the alarm is 0.75

They do different jobs and must not be equal. 0.75 pages an operator while the
worker is still perfectly able to run jobs; gating dispatch that early would
convert a warning into ~36 hours of withheld fleet capacity. 0.90 is where we
stop trusting the worker to fork at all — 100 free PIDs at the prod ceiling.
That reserve is chosen, not derived: the per-job PID cost of a chromium
context tree is not measured
, hence the WORKER_PID_CLAIM_GATE_RATIO
override. The invariant that matters is ordering — the alarm always fires before
capacity is withdrawn.

The gate is inert when the cgroup gauges are unreadable (pidUsageRatio →
null: off-Linux, every macOS dev box), so local workers claim exactly as
before.


RED → GREEN (change 3)

Driver runs the real startWorkerLoop against the real BrowserPool
budget path, faking only the cgroup read and the queue transport. The queue fake
holds a real pending list, so "was the job dropped / does it stay pending" is
directly observed, not inferred. budget() calls are counted as a
loop-iteration proxy for the spin check.

Identical command both sides:

./node_modules/.bin/tsx <scratch>/drive-gate.mts

RED — unmodified source

=== B1 SATURATED  1 worker @ 1000/1000, 3 jobs pending ===
  workers=1  cgroup pids=1000/1000  contexts available=24
  window                  : 600ms @ poll 50ms
  queue.claimNext CALLS   : 15
  jobs CLAIMED            : 3 ["job-1","job-2","job-3"]
  jobs STILL PENDING      : 0 []
  jobs REPORTED           : 3
  loop iterations         : 15

=== B2 ALL-SATURATED  3 workers @ 1000/1000, 3 jobs pending ===
  workers=3  cgroup pids=1000/1000  contexts available=24
  queue.claimNext CALLS   : 39
  jobs CLAIMED            : 3 ["job-1","job-2","job-3"]
  jobs STILL PENDING      : 0 []
  jobs REPORTED           : 3
  loop iterations         : 39

A worker at the PID ceiling claims all three jobs. In prod each of those
becomes a 600000ms abort.

GREEN — with this change

=== B1 SATURATED  1 worker @ 1000/1000, 3 jobs pending ===
  workers=1  cgroup pids=1000/1000  contexts available=24
  window                  : 600ms @ poll 50ms
  queue.claimNext CALLS   : 0
  jobs CLAIMED            : 0 []
  jobs STILL PENDING      : 3 ["job-1","job-2","job-3"]
  jobs REPORTED           : 0
  loop iterations         : 12 (spin check: bounded by window/poll)

claimNext is never called; all three jobs are still pending — not dropped,
not requeued.

ALL workers saturated — the blast-radius case

=== B2 ALL-SATURATED  3 workers @ 1000/1000, 3 jobs pending ===
  workers=3  cgroup pids=1000/1000  contexts available=24
  window                  : 600ms @ poll 50ms
  queue.claimNext CALLS   : 0
  jobs CLAIMED            : 0 []
  jobs STILL PENDING      : 3 ["job-1","job-2","job-3"]
  jobs REPORTED           : 0
  loop iterations         : 36 (spin check: bounded by window/poll)

Zero claims, 3 of 3 jobs still pending, and 36 iterations across 3 workers
over a 600ms window at a 50ms poll — i.e. 12 per worker, the poll cadence. No
spin, no loss.

The gate must NOT engage below threshold — same run, same command

=== B3 HEALTHY  1 worker @ 100/1000, 3 jobs pending ===
  queue.claimNext CALLS   : 15
  jobs CLAIMED            : 3   jobs STILL PENDING : 0   jobs REPORTED : 3

=== B4 UNDER-GATE  1 worker @ 890/1000, 3 jobs pending ===
  queue.claimNext CALLS   : 15
  jobs CLAIMED            : 3   jobs STILL PENDING : 0   jobs REPORTED : 3

=== B5 UNMEASURED  1 worker @ -1/-1, 3 jobs pending ===
  queue.claimNext CALLS   : 15
  jobs CLAIMED            : 3   jobs STILL PENDING : 0   jobs REPORTED : 3

B4 is the load-bearing one: 0.89 is above change 2's 0.75 alarm and below
this gate. The operator has been paged and the worker keeps working — which is
the whole reason the two thresholds differ. B5 pins the off-Linux case.


Tests and gates (changes 2 and 3)

showcase/harness, on the pushed head 63ef4081c2:

Gate Command Result
Typecheck npx tsc --noEmit -p tsconfig.json exit 0
Lint npx oxlint src/fleet src/orchestrator.ts 0 errors; warning count unchanged vs base (2 on fleet-health.ts before and after)
Format npx oxfmt --write clean
Unit suite vitest run 3696 passed, 18 skipped, 1 failed — 175/178 files pass

The single failure is src/probes/frontend-matrix.test.ts — pre-existing.
Verified by stashing this branch's changes and re-running it on the unmodified
tree, where it fails identically (1 failed | 5 passed).

14 tests are new (3682 → 3696).

Mutation-tested for vacuity. With the four source files reverted to
e66fb1af13 and the new test files kept, 11 of the new tests fail:

Test Files  2 failed (2)
     Tests  11 failed | 80 passed (91)

FAIL fleet-health.test.ts > PID saturation > alarms on an ONLINE worker whose PID gauges cross the threshold
FAIL fleet-health.test.ts > PID saturation > stays silent below the threshold, including just under it
FAIL fleet-health.test.ts > PID saturation > stays silent when the gauges are UNMEASURED (null / unbounded max)
FAIL fleet-health.test.ts > PID saturation > is EDGE-triggered: a sustained saturation alarms once, not every cycle
FAIL fleet-health.test.ts > PID saturation > re-arms only after the worker drops below the CLEAR ratio
FAIL fleet-health.test.ts > PID saturation > never lets a throwing alarm hook abort the cycle
FAIL fleet-health.test.ts > PID saturation > fails loud on a ratio config that would alarm every cycle
FAIL worker-loop.test.ts  > PID headroom gate > declines to claim at the PID ceiling — the job is never claimed, so it stays pending
FAIL worker-loop.test.ts  > PID headroom gate > declines at the gate ratio boundary (0.90)
FAIL worker-loop.test.ts  > PID headroom gate > honours an injected gate ratio
FAIL fleet-health.test.ts > checkOnce > never throws when the roster read fails — returns an empty cycle

The three that pass on both sides are the sub-threshold controls (still claims just BELOW the gate, claims normally on a healthy worker, stays INERT when the cgroup gauges are unreadable) — they are supposed to be unchanged by the
fix, and they are.

New env knobs (all optional, all defaulted)

Var Default Effect
WORKER_PID_SATURATION_RATIO 0.75 Control-plane alarm threshold.
WORKER_PID_SATURATION_CLEAR_RATIO 0.65 Alarm latch hysteresis clear.
WORKER_PID_CLAIM_GATE_RATIO 0.90 Worker claim-gate threshold.

An out-of-range override on the two alarm ratios falls back to the default
rather than tripping the fail-loud guard and taking the control-plane down over
a typo'd env var.

Not verified

  • Neither change 2 nor change 3 has been exercised against live prod or
    staging PocketBase
    ; both red-greens are local, on the real modules with the
    cgroup read and PB/queue transport injected.
  • No Slack post was sent. SLACK_WEBHOOK_OSS_ALERTS was not set in the
    driver, so the send leg was not exercised end-to-end — only that its failure
    is swallowed without costing the durable status row.
  • The per-job PID cost of a chromium context tree is not measured, so the
    0.90 gate's 100-PID reserve is a chosen value.

@github-actions

github-actions Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 41 services digest-pinned.

Run 2026-08-12 13:54:59 PDT — 0 finding(s).

…ID 1

harness-workers leaked one cgroup PID slot per orphaned chromium grandchild.
Node as PID 1 only waitpid()s processes it spawned, so every browser crash
stranded ~5 <defunct> renderers permanently. Prod climbed to
pids.current=1000/1000 with zombieCount=757 over 6d22h uptime, after which no
browser could launch and ~295 d6 cells went abort fleet-wide.

Install tini in the existing playwright apt layer and run it as PID 1 via
exec-form ENTRYPOINT. No -g, so signal delivery to node is unchanged and
orchestrator.ts's SIGTERM drain still runs; tini propagates the child's exit
status so a crash still exits non-zero and Railway still restarts.
@jpr5
jpr5 force-pushed the fix/showcase-harness-pid-reaper branch from 6704379 to e66fb1a Compare August 12, 2026 20:21
@jpr5
jpr5 marked this pull request as ready for review August 12, 2026 20:21
@pkg-pr-new

pkg-pr-new Bot commented Aug 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

@copilotkit/a2ui-renderer

pnpm add https://pkg.pr.new/@copilotkit/a2ui-renderer@6333

@copilotkit/agentcore-runner

pnpm add https://pkg.pr.new/@copilotkit/agentcore-runner@6333

@copilotkit/angular

pnpm add https://pkg.pr.new/@copilotkit/angular@6333

@copilotkit/channels

pnpm add https://pkg.pr.new/@copilotkit/channels@6333

@copilotkit/channels-core

pnpm add https://pkg.pr.new/@copilotkit/channels-core@6333

@copilotkit/channels-discord

pnpm add https://pkg.pr.new/@copilotkit/channels-discord@6333

@copilotkit/channels-intelligence

pnpm add https://pkg.pr.new/@copilotkit/channels-intelligence@6333

@copilotkit/channels-slack

pnpm add https://pkg.pr.new/@copilotkit/channels-slack@6333

@copilotkit/channels-teams

pnpm add https://pkg.pr.new/@copilotkit/channels-teams@6333

@copilotkit/channels-telegram

pnpm add https://pkg.pr.new/@copilotkit/channels-telegram@6333

@copilotkit/channels-ui

pnpm add https://pkg.pr.new/@copilotkit/channels-ui@6333

@copilotkit/channels-whatsapp

pnpm add https://pkg.pr.new/@copilotkit/channels-whatsapp@6333

@copilotkit/core

pnpm add https://pkg.pr.new/@copilotkit/core@6333

@copilotkit/react-core

pnpm add https://pkg.pr.new/@copilotkit/react-core@6333

@copilotkit/react-native

pnpm add https://pkg.pr.new/@copilotkit/react-native@6333

@copilotkit/react-textarea

pnpm add https://pkg.pr.new/@copilotkit/react-textarea@6333

@copilotkit/react-ui

pnpm add https://pkg.pr.new/@copilotkit/react-ui@6333

@copilotkit/runtime

pnpm add https://pkg.pr.new/@copilotkit/runtime@6333

@copilotkit/runtime-client-gql

pnpm add https://pkg.pr.new/@copilotkit/runtime-client-gql@6333

@copilotkit/sdk-js

pnpm add https://pkg.pr.new/@copilotkit/sdk-js@6333

@copilotkit/shared

pnpm add https://pkg.pr.new/@copilotkit/shared@6333

@copilotkit/sqlite-runner

pnpm add https://pkg.pr.new/@copilotkit/sqlite-runner@6333

@copilotkit/voice

pnpm add https://pkg.pr.new/@copilotkit/voice@6333

@copilotkit/vue

pnpm add https://pkg.pr.new/@copilotkit/vue@6333

@copilotkit/web-components

pnpm add https://pkg.pr.new/@copilotkit/web-components@6333

@copilotkit/web-inspector

pnpm add https://pkg.pr.new/@copilotkit/web-inspector@6333

commit: e66fb1a

jpr5 added 2 commits August 12, 2026 13:51
Prod harness-workers replicas reach the platform-fixed pids.max=1000
ceiling roughly every 7 days and NOTHING alarmed. Measured 2026-08-10
20:09-20:10Z: pids=1000/1000 zombies=758, 1000/1000 zombies=761,
837/1000 zombies=744, with 320 `timeout after 600000ms` abort rows and
an e2e-smoke run 42 minutes into a 15-minute cadence with 3 jobs still
pending. The documented pool-unrecoverable alarm did not fire: it only
trips when the self-heal breaker gives up, which a PID-starved but
still-heartbeating worker never reaches.

The signal was already on the wire and read by nobody. The worker's
~75s heartbeat writes capacity_pids_current / capacity_pids_max onto
its `workers` row (worker/registration.ts), and fleet-health lists that
whole roster every 15s — its own comment said "the capacity gauges are
ignored here". Nothing in non-test source compared them.

Alarm control-plane-side rather than worker-side, because status-writer
documents `fleet-cp` as the only authoritative fleet writer ("workers
never write status directly"), and because fleet-health already holds
the roster read this needs.

- fleet-health raises a rising-edge alarm at pids.current/pids.max >=
  0.75 (~36h of lead time at the observed leak rate), evaluated BEFORE
  the online/stale branch since the failing worker is fully ONLINE.
- Latched per worker with a 0.65 hysteresis clear: the monitor ticks
  every 15s, so an unlatched alarm would page ~8600 times across the
  lead-time window. Construction fails loud on a ratio pair with no gap.
- Unmeasured gauges (null off-Linux, unbounded pids.max) never alarm --
  pidUsageRatio returns null and null is never read as zero.
- Routed to a system:worker-pid-saturation status row plus #oss-alerts
  via SLACK_WEBHOOK_OSS_ALERTS, the target family-silence and the
  D0-gone monitor already post to. Deliberately NOT
  SLACK_WEBHOOK_BROWSER_POOL_UNRECOVERABLE, which appears nowhere in
  this repo outside its own definition and is unset everywhere -- an
  alarm nobody receives is the gap being closed.
worker-loop's claim gate had exactly one conditional --
`if (budget.available <= 0)` -- and `available` is free Playwright
browser-CONTEXT slots (maxContexts - liveContextCount), nothing else. A
worker whose container has leaked PIDs to the cgroup ceiling therefore
still advertises full capacity and keeps winning claims it cannot
possibly run: the driver cannot fork, so each job burns its entire
600000ms lease and lands as an abort. Measured 2026-08-10: workers at
pids=1000/1000 with 758-761 zombies, 320 `timeout after 600000ms` rows.

Decline the claim above 0.90 of pids.max. Deliberately far above the
control-plane's 0.75 saturation ALARM: the two thresholds do different
jobs. 0.75 pages an operator while the worker is still perfectly able to
run jobs; gating dispatch that early would convert a warning into ~36h
of withheld fleet capacity. 0.90 leaves 100 free PIDs at the prod
ceiling -- a chosen reserve, not a derived one (the per-job PID cost of
a chromium context tree is not measured), hence the env override. The
ordering that matters is that the alarm always fires before capacity is
withdrawn.

BLAST RADIUS -- reuses the SAME decline-and-idle path as the existing
no-budget branch, which is what makes an all-workers-saturated fleet
safe: the job is never claimed, so it is never dropped and never
requeued; it simply stays `pending`. The loop then sleeps a full
pollIntervalMs, so a fully-saturated fleet idles at the poll cadence
instead of spinning. The queue stalls VISIBLY -- pending rows pile up,
the rising-edge warn says why, and the control-plane's
system:worker-pid-saturation alarm fired at 0.75 before this gate
engaged at 0.90. A stalled, alarmed queue is recoverable by redeploy;
claim-fail-repeat silently burned the whole cadence.

The gate is INERT when the cgroup gauges are unreadable (pidUsageRatio
-> null: off-Linux, every macOS dev box), so local workers claim exactly
as before.
@jpr5 jpr5 changed the title fix(showcase/harness): reap orphaned chromium children with tini as PID 1 fix(showcase/harness): reap chromium zombies, alarm on PID saturation, stop saturated workers claiming Aug 12, 2026
@jpr5
jpr5 merged commit 7fd4c5e into main Aug 12, 2026
21 checks passed
@jpr5
jpr5 deleted the fix/showcase-harness-pid-reaper branch August 12, 2026 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant