paperclip/server/src
Tycho 505da32def test(plugin-worker-manager): cover stdin command-channel supervision
Adds the missing test for the supervision added in this PR: a worker whose
host->worker stdin pipe dies while the process itself stays alive.

New suite server/src/__tests__/plugin-worker-stdin-supervision.test.ts, plus a
plugin-worker-persistent.cjs fixture that deliberately survives stdin EOF (ref'd
keep-alive timer, readline "close" is a no-op) so nothing but the host
supervision can end it. It spawns a real child through the existing fixture
pattern and captures it by wrapping node:child_process.fork with a
pass-through mock; the fork is real.

Two cases:

1. stdin destroyed with EPIPE while the process is alive -> the manager
   SIGKILLs the child and schedules a restart (crash event willRestart=true,
   status "backoff", diagnostics().nextRestartAt in the future). SIGKILL is the
   discriminator: this fixture never exits on its own inside the test window and
   exits 0 when asked politely, so only the supervision path can produce a
   signalled exit here.

2. Negative control for the risky arm: stdin destroyed *during* an intentional
   stop must not force-kill or restart. The fixture defers its exit after acking
   shutdown, which opens the window; the test waits for status "stopping" and
   for the shutdown to drain out of the host before killing the pipe, so it
   cannot pass by dropping the shutdown instead.

Verified by mutation, not just by going green:

- reverting plugin-worker-manager.ts to the pre-fix parent fails case 1 only
  ("worker was left alive and uncommandable after its command channel died")
  and leaves case 2 green;
- removing only the `intentionalStop ||` guard fails case 2 only
  ("expected 'SIGKILL' to be null") and leaves case 1 green.

Lives in its own file because vi.mock is file-scoped and the sibling
plugin-worker-manager.test.ts keeps an unmocked fork; that suite still passes
(30 tests across both files). Server typecheck clean. The suite is picked up by
the glob-based general-server sharding and lands in exactly one of the four
shards.
2026-08-05 12:50:11 -06:00
..
__tests__ test(plugin-worker-manager): cover stdin command-channel supervision 2026-08-05 12:50:11 -06:00
adapters fix(runtime): scope PAPERCLIP_ env-binding strip to reserved keys (#9974) 2026-07-22 07:01:57 -05:00
auth feat(mcp) [split 3/8]: add tool access policy core (#9558) 2026-07-14 14:22:39 -05:00
built-ins/agents feat(skills): make summarize-status actions-first (#10117) 2026-07-23 15:59:44 -05:00
http Upload company import packages as compressed zip uploads (fix large-company imports through Cloud) (#10531) 2026-07-30 18:48:22 -07:00
lib Add low-trust review containment (#7530) 2026-06-05 16:48:02 -05:00
middleware Let cloud tenant sessions reach companies they hold memberships in (#10524) 2026-07-30 16:36:50 -07:00
onboarding-assets [codex] Add heartbeat policy eval coverage (#9087) 2026-07-06 16:31:14 -05:00
realtime Add browser SSH terminal for custom image setup (#8911) 2026-07-03 16:44:21 -07:00
routes feat(decisions): improve desk triage and queue parity (#10785) 2026-08-03 21:31:45 -05:00
secrets feat(secrets): write through external values and deep-link details (#10196) 2026-07-27 19:08:07 -05:00
services fix(plugin-worker-manager): recover when a worker's stdin command channel dies 2026-08-03 22:16:13 -06:00
storage feat(run-logs): durable run-log store via object-storage mirror (#8984) 2026-07-14 15:45:39 -07:00
types feat(mcp) [split 3/8]: add tool access policy core (#9558) 2026-07-14 14:22:39 -05:00
agent-auth-jwt.ts Skill Studio: three-pane skill IDE with sandboxed test runs (#9241) 2026-07-09 13:08:56 -05:00
app.ts feat(decisions): add queues and prioritized attention feed (#10651) 2026-08-01 20:37:39 -05:00
attachment-types.ts fix(server): accept Office issue attachments (#8562) 2026-07-21 10:47:33 -07:00
board-claim.ts [codex] Add agent permissions and controls plan (#6386) 2026-05-22 08:12:52 -05:00
build-commit.ts fix(server): preserve source SHA without Git metadata (#9638) 2026-07-15 20:03:52 -05:00
build-version.ts fix(server): stamp the real build version into images instead of the package.json placeholder (#10257) 2026-07-25 10:06:28 -07:00
config-file.ts Fail loudly on invalid config files (#9041) 2026-07-21 10:18:45 -07:00
config.ts Add secrets provider vaults and remote import (#5429) 2026-05-09 18:22:17 -05:00
dev-runner-worktree.ts feat(workspaces): defer isolated setup until runtime start (#10653) 2026-08-02 10:37:10 -05:00
dev-server-status.ts [codex] UI and dev ops quality-of-life (#6384) 2026-05-19 15:52:39 -05:00
dev-watch-ignore.ts feat(adapters): external adapter plugin system with dynamic UI parser 2026-04-03 21:11:20 +01:00
errors.ts security(invites): widen invite-token entropy and rate-limit public invite endpoints (#8979) 2026-07-14 15:47:58 -07:00
first-admin-claim.ts [codex] Add private browser first-admin claim flow (#6755) 2026-05-27 21:15:01 -10:00
home-paths.ts feat(server): thread plural referenced-project workspaces through run prep (#10448) 2026-07-29 14:27:05 -07:00
index.ts feat(decisions): improve desk triage and queue parity (#10785) 2026-08-03 21:31:45 -05:00
instrumentation.test.ts fix(server): export manual OpenTelemetry spans (#10565) 2026-07-31 12:47:57 -07:00
instrumentation.ts feat(observability): add provider OTel spans - cache-hit flag, plugin tracer, Daytona pack/transfer spans (#10764) 2026-08-03 13:09:01 -07:00
log-redaction.ts Sync/master post pap1497 followups 2026 04 15 (#3779) 2026-04-15 21:13:56 -05:00
paths.ts
…
redaction.ts feat(secrets): add user-specific runtime secrets (#8825) 2026-07-05 05:58:20 -05:00
runtime-api.ts Prefer loopback runtime API URL for local agents (#5102) 2026-06-20 14:03:21 -07:00
server-info.ts fix(server): preserve source SHA without Git metadata (#9638) 2026-07-15 20:03:52 -05:00
shutdown.test.ts fix(server): avoid hot restart shutdown deadlock (#9670) 2026-07-16 05:09:56 -05:00
shutdown.ts fix(server): avoid hot restart shutdown deadlock (#9670) 2026-07-16 05:09:56 -05:00
startup-banner.ts Introduce bind presets for deployment setup 2026-04-11 07:09:07 -05:00
static-index-html.ts [codex] Bundle local branch fixes from PAP-10032 (#6604) 2026-05-25 07:25:26 -05:00
telemetry.ts fix: add periodic flush and graceful shutdown for server-side telemetry 2026-04-02 10:47:29 -05:00
ui-branding.ts Ensure worktree execution starts only after activation (#9374) 2026-07-10 16:11:26 -05:00
version.ts fix(server): stamp the real build version into images instead of the package.json placeholder (#10257) 2026-07-25 10:06:28 -07:00
vite-html-renderer.ts [codex] Add backup endpoint and dev runtime hardening (#4087) 2026-04-20 06:08:55 -05:00
worktree-config.ts fix(worktree): disable automatic database backups (#10520) 2026-07-30 17:35:04 -07:00