@descryy/runtime-controller 0.2.1 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/LICENSE +6 -0
  2. package/dist/attach-fencing.d.ts +109 -0
  3. package/dist/attach-fencing.d.ts.map +1 -0
  4. package/dist/attach-fencing.js +215 -0
  5. package/dist/attach-fencing.js.map +1 -0
  6. package/dist/capability-registry.d.ts +0 -15
  7. package/dist/capability-registry.d.ts.map +1 -1
  8. package/dist/capability-registry.js +9 -19
  9. package/dist/capability-registry.js.map +1 -1
  10. package/dist/collector-version.d.ts +1 -8
  11. package/dist/collector-version.d.ts.map +1 -1
  12. package/dist/collector-version.js +1 -8
  13. package/dist/collector-version.js.map +1 -1
  14. package/dist/container-sandbox.d.ts +66 -150
  15. package/dist/container-sandbox.d.ts.map +1 -1
  16. package/dist/container-sandbox.js +62 -143
  17. package/dist/container-sandbox.js.map +1 -1
  18. package/dist/controller.d.ts +49 -106
  19. package/dist/controller.d.ts.map +1 -1
  20. package/dist/controller.js +65 -123
  21. package/dist/controller.js.map +1 -1
  22. package/dist/dependency-version-check.d.ts +19 -73
  23. package/dist/dependency-version-check.d.ts.map +1 -1
  24. package/dist/dependency-version-check.js +18 -67
  25. package/dist/dependency-version-check.js.map +1 -1
  26. package/dist/env.d.ts +4 -10
  27. package/dist/env.d.ts.map +1 -1
  28. package/dist/env.js +4 -10
  29. package/dist/env.js.map +1 -1
  30. package/dist/environment-metadata.d.ts +9 -17
  31. package/dist/environment-metadata.d.ts.map +1 -1
  32. package/dist/environment-metadata.js +12 -29
  33. package/dist/environment-metadata.js.map +1 -1
  34. package/dist/environment-version-check.d.ts +22 -65
  35. package/dist/environment-version-check.d.ts.map +1 -1
  36. package/dist/environment-version-check.js +24 -66
  37. package/dist/environment-version-check.js.map +1 -1
  38. package/dist/execution-safety.d.ts +54 -112
  39. package/dist/execution-safety.d.ts.map +1 -1
  40. package/dist/execution-safety.js +48 -102
  41. package/dist/execution-safety.js.map +1 -1
  42. package/dist/index.d.ts +2 -10
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +1 -0
  45. package/dist/index.js.map +1 -1
  46. package/dist/orchestration.d.ts +24 -39
  47. package/dist/orchestration.d.ts.map +1 -1
  48. package/dist/orchestration.js +39 -75
  49. package/dist/orchestration.js.map +1 -1
  50. package/dist/process-collector.d.ts +8 -22
  51. package/dist/process-collector.d.ts.map +1 -1
  52. package/dist/process-collector.js +23 -55
  53. package/dist/process-collector.js.map +1 -1
  54. package/dist/process-manager.d.ts +65 -80
  55. package/dist/process-manager.d.ts.map +1 -1
  56. package/dist/process-manager.js +80 -103
  57. package/dist/process-manager.js.map +1 -1
  58. package/dist/readiness.d.ts +28 -70
  59. package/dist/readiness.d.ts.map +1 -1
  60. package/dist/readiness.js +73 -95
  61. package/dist/readiness.js.map +1 -1
  62. package/dist/sandbox.d.ts +60 -105
  63. package/dist/sandbox.d.ts.map +1 -1
  64. package/dist/sandbox.js +78 -121
  65. package/dist/sandbox.js.map +1 -1
  66. package/package.json +8 -3
@@ -1,35 +1,25 @@
1
1
  /**
2
- * Process manager (plan §5): command execution, working directory,
3
- * environment variables, process-group tracking, stdout/stderr capture,
4
- * exit-code capture, cleanup with a shutdown grace period, and orphan-
5
- * process prevention.
2
+ * Process manager (§5): command execution, cwd, env, process-group tracking,
3
+ * stdout/stderr capture, exit-code capture, graceful shutdown, orphan prevention.
6
4
  *
7
- * Orphan prevention and group-kill use POSIX process groups
8
- * (`detached: true` + `process.kill(-pid, signal)`), matching this
9
- * project's Linux development and CI targets. Not portable to Windows as
10
- * written — out of scope for the V1 fixture-app slice (plan §34).
5
+ * Orphan prevention and group-kill use POSIX process groups (`detached: true` +
6
+ * `process.kill(-pid, signal)`) -- not portable to Windows, out of scope for the V1
7
+ * fixture-app slice (§34).
11
8
  */
12
9
  import type { FilesystemPolicy, NetworkPolicy, ProcessHandle, ResourceLimits, ServiceAttachConfiguration } from "@descryy/runtime-contracts";
10
+ import { type AttachFence } from "./attach-fencing.ts";
13
11
  /**
14
- * Binds port 0 (OS picks a free one), reads it, releases it immediately.
15
- * A real gap remains between "free when checked" and "still free when the
16
- * real service binds it" (RT-024's own class of gap, one layer down) --
17
- * unavoidable without binding the real service directly to the probe
18
- * socket, which `spawnProcess`'s child-process model doesn't support, and
19
- * which no ordinary application would cooperate with anyway.
12
+ * Binds port 0, reads it, releases immediately. A real gap remains between "free
13
+ * when checked" and "still free when the child binds it" (RT-024's gap, one layer
14
+ * down) -- unavoidable without binding the real service directly to the probe
15
+ * socket, which the child-process model doesn't support.
20
16
  *
21
- * **Examined for a fix and deliberately not "fixed".** Holding the probe
22
- * socket open for longer does not narrow the window, it widens it: the
23
- * child cannot bind while we hold the port, and the dominant term is the
24
- * child's own startup, not our release. Retrying on the child's bind error
25
- * would mean parsing that error out of process output, which is
26
- * per-language text and has no place in a language-neutral controller.
27
- * What was done instead is to make the one symptom legible: `awaitReadiness`
28
- * now names the endpoint it probed, so a collision reads as "nothing
29
- * answered on this port" rather than as an unexplained application failure.
30
- * In practice the window is a handful of milliseconds and readiness always
31
- * runs afterwards, so a genuine collision fails loudly -- it is just no
32
- * longer misattributed.
17
+ * **Examined and deliberately not "fixed".** Holding the probe socket longer widens
18
+ * the window rather than narrowing it (the child can't bind while we hold it).
19
+ * Instead, `awaitReadiness` names the endpoint it probed, so a collision reads as
20
+ * "nothing answered on this port" rather than an unexplained failure. Window is a
21
+ * handful of ms in practice; a genuine collision still fails loudly, just correctly
22
+ * attributed.
33
23
  */
34
24
  export declare function allocateEphemeralPort(): Promise<number>;
35
25
  export interface SpawnProcessOptions {
@@ -38,29 +28,24 @@ export interface SpawnProcessOptions {
38
28
  readonly args?: readonly string[];
39
29
  readonly cwd?: string;
40
30
  readonly env?: Readonly<Record<string, string | undefined>>;
41
- /** Joins the resulting ProcessHandle back to ExecutionConfiguration.services (RT-023). Omit for a process with no corresponding named service. */
31
+ /** Joins the resulting ProcessHandle back to ExecutionConfiguration.services (RT-023). Omit for no corresponding named service. */
42
32
  readonly serviceName?: string;
43
- /** The real port this process is bound to, when the caller already knows it (e.g. an ephemeral port it allocated before spawning). Recorded on the handle, not otherwise used by this function. */
33
+ /** Real port this process is bound to, when the caller already knows it. Recorded on the handle only. */
44
34
  readonly port?: number;
45
- /** §21's execution boundary (RT-070). Applied via `applyResourceLimits` -- see its own comment for the refuse-rather-than-silently-unconstrained contract. Re-applied on every (re)spawn, including `restart()`. */
35
+ /** §21 execution boundary (RT-070), via `applyResourceLimits`. Re-applied on every (re)spawn including `restart()`. */
46
36
  readonly resourceLimits?: ResourceLimits;
47
- /** §21's execution boundary, filesystem half. Applied via `applySandbox` -- see its own comment. Re-applied on every (re)spawn, including `restart()`. */
37
+ /** §21 execution boundary, filesystem half, via `applySandbox`. Re-applied on every (re)spawn. */
48
38
  readonly filesystemPolicy?: FilesystemPolicy;
49
- /** §21's execution boundary, network half. Applied via `applySandbox` -- see its own comment. Re-applied on every (re)spawn, including `restart()`. */
39
+ /** §21 execution boundary, network half, via `applySandbox`. Re-applied on every (re)spawn. */
50
40
  readonly networkPolicy?: NetworkPolicy;
51
41
  /**
52
- * Selects which real mechanism enforces `filesystemPolicy`/`networkPolicy`.
53
- * Absent means `"bwrap"` -- exactly today's behavior, unchanged.
54
- * `"container"` routes through `applyContainerSandbox` (`./container-sandbox.ts`)
55
- * instead. See `ExecutionConfiguration.sandboxBackend`'s own comment.
42
+ * Selects the mechanism enforcing `filesystemPolicy`/`networkPolicy`. Absent means
43
+ * `"bwrap"` (unchanged default); `"container"` routes through `applyContainerSandbox`.
56
44
  *
57
- * **Does not compose with `resourceLimits` in this pass**: the container
58
- * backend applies directly to `command`/`args`, skipping
59
- * `applyResourceLimits`'s `prlimit` wrap entirely (a minimal container
60
- * image is not guaranteed to carry `prlimit`, and Docker's own
61
- * `--memory`/`--cpus`/`--pids-limit` equivalent is not wired up here) --
62
- * disclosed in `container-sandbox.ts`'s own module doc, not silently
63
- * dropped.
45
+ * **Does not compose with `resourceLimits` in this pass** -- the container backend
46
+ * skips `applyResourceLimits`'s `prlimit` wrap entirely (a minimal image isn't
47
+ * guaranteed to carry `prlimit`, Docker's own limit flags aren't wired up).
48
+ * Disclosed in `container-sandbox.ts`, not silently dropped.
64
49
  */
65
50
  readonly sandboxBackend?: "bwrap" | "container";
66
51
  }
@@ -70,36 +55,34 @@ export interface ProcessExitInfo {
70
55
  }
71
56
  export interface ManagedProcess {
72
57
  handle(): ProcessHandle;
73
- /** Combined stdout+stderr captured so far, in arrival order — the backing store for log-pattern readiness checks. */
58
+ /** Combined stdout+stderr captured so far, in arrival order -- backing store for log-pattern readiness checks. */
74
59
  readOutput(): string;
75
60
  waitForExit(): Promise<ProcessExitInfo>;
76
- /** SIGTERM the process group, wait up to `gracePeriodMs`, then SIGKILL if still alive. Idempotent. */
61
+ /** SIGTERM the process group, wait up to `gracePeriodMs`, then SIGKILL. Idempotent. */
77
62
  kill(gracePeriodMs?: number): Promise<void>;
78
63
  /**
79
- * Kills the current process (if still alive — a no-op wait if it already
80
- * exited on its own) and spawns a fresh one with the SAME `command`/
81
- * `args`/`cwd`/`env`. `handle()`, `readOutput()` and `waitForExit()` all
82
- * observe the new process afterward — this is the same `ManagedProcess`
83
- * object, not a new one, so a caller holding the original reference does
84
- * not need to re-fetch anything. Readiness is the caller's job, same as
85
- * after the original `spawnProcess` — this resolves once the new process
86
- * EXISTS, not once it is ready.
64
+ * Kills the current process (no-op wait if already exited) and spawns a fresh one
65
+ * with the same command/args/cwd/env. `handle()`/`readOutput()`/`waitForExit()`
66
+ * observe the new process on the same object -- no re-fetch needed. Resolves once
67
+ * the new process exists, not once it's ready (readiness is the caller's job).
87
68
  */
88
69
  restart(gracePeriodMs?: number): Promise<void>;
70
+ /**
71
+ * The attach-time fence (RT-N3), or `null` for a process this runtime spawned
72
+ * itself -- fencing only exists to mark content that predates OBSERVATION, and
73
+ * a spawned process has no output before Descry started it. See
74
+ * `computeAttachFence` (`attach-fencing.ts`) for what it records and why.
75
+ */
76
+ attachFence(): AttachFence | null;
89
77
  }
90
78
  export declare function spawnProcess(options: SpawnProcessOptions): ManagedProcess;
91
79
  /**
92
- * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether
93
- * delivery would be possible. `ESRCH` means no such pid; `EPERM` means a
94
- * pid we don't own but that unambiguously exists, still alive for this
95
- * purpose. Any other error is treated as "exists" rather than guessed away.
80
+ * `process.kill(pid, 0)` sends no signal, only asks the kernel if delivery is
81
+ * possible. `ESRCH` = no such pid; `EPERM` = a pid we don't own but that exists.
96
82
  *
97
- * A second, deliberate copy of `packages/orchestrator/src/attach-to-running-process.ts`'s
98
- * function of the same name, not an import of it: `orchestrator` depends on
99
- * `controller` (see `orchestrator/package.json`), so the reverse import
100
- * would be circular. Tiny and pure, the same "duplicated because both
101
- * copies are easy to notice drift" precedent `attach-to-running-jvm-process.ts`'s
102
- * own `reconstructJvmSourcePath` already sets for exactly this reason.
83
+ * Deliberate second copy of `orchestrator/src/attach-to-running-process.ts`'s
84
+ * same-named function, not an import -- `orchestrator` depends on `controller`, so
85
+ * the reverse import would be circular. Tiny and pure enough to duplicate safely.
103
86
  */
104
87
  export declare function isProcessAlive(pid: number): boolean;
105
88
  export interface AttachProcessOptions {
@@ -109,25 +92,27 @@ export interface AttachProcessOptions {
109
92
  readonly port?: number;
110
93
  }
111
94
  /**
112
- * `ManagedProcess` for a service `ExecutionController.run()` attaches to
113
- * instead of spawning (`ServiceConfiguration.attach`). Reads
114
- * `attach.logFilePath` fresh on every `readOutput()` call — the same
115
- * growing-whole-buffer contract a spawned process's in-memory pipe buffer
116
- * already has (`spawnProcess`'s own `outputBuffer`), so `createPollingProcessOutputSource`
117
- * (`@descryy/runtime-orchestrator`) needs no attach-specific branch to
118
- * consume either one.
95
+ * `ManagedProcess` for a service attached to rather than spawned. Reads
96
+ * `attach.logFilePath` fresh on every `readOutput()` -- same growing-whole-buffer
97
+ * contract as a spawned process's in-memory pipe buffer.
98
+ *
99
+ * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this process,
100
+ * and `ATTACH_MODE_SCOPE_DISCLOSURE` is unconditional: attach mode never executes
101
+ * code in or applies changes to what it observes. Ending observation is the honest
102
+ * equivalent of "stop" -- the target keeps running. `restart()` throws for the same
103
+ * reason: no command exists to relaunch it with.
119
104
  *
120
- * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this
121
- * process and `ATTACH_MODE_SCOPE_DISCLOSURE` (`@descryy/runtime-contracts`)
122
- * is unconditional: attach mode "never executes code in it or applies
123
- * changes to it." `ExecutionController`'s cleanup path kills every managed
124
- * process on failure/timeout/stop — for an attached service that would mean
125
- * terminating a process this runtime does not own, silently, the exact
126
- * thing the disclosure promises never happens. Ending observation (no
127
- * further polling) is the honest equivalent of "stop" here; the target
128
- * keeps running, as it was before Descry ever attached. `restart()` throws
129
- * for the same reason: there is no command this runtime could relaunch it
130
- * with.
105
+ * **Attach fencing (RT-N3).** `computeAttachFence` snapshots, at construction time
106
+ * (i.e. the moment of attach), how much of `logFilePath` already existed and
107
+ * whether some other process also holds it open -- see `attach-fencing.ts`. Exposed
108
+ * via `attachFence()` for a caller building a `ProcessOutputSource` over
109
+ * `readOutput()` to mark pre-existing content instead of reporting it as freshly
110
+ * observed. `readOutput()` itself additionally refuses (rather than silently
111
+ * mis-reading) if the file is ever found shorter than the largest size already
112
+ * seen -- the same "cannot reconstruct a rotated/truncated buffer" rule
113
+ * `orchestrator/src/polling-output-source.ts` enforces one layer up, duplicated
114
+ * here for the same reason `isProcessAlive` is: this module cannot depend on
115
+ * that one without a cycle, and the check is small and pure enough to repeat.
131
116
  */
132
117
  export declare function attachManagedProcess(options: AttachProcessOptions): ManagedProcess;
133
118
  //# sourceMappingURL=process-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"process-manager.d.ts","sourceRoot":"","sources":["../src/process-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,E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AM,GAAG,OAAO,CAOnD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,0BAA0B,CAAC;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAID;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CAwFlF"}
@@ -1,13 +1,10 @@
1
1
  /**
2
- * Process manager (plan §5): command execution, working directory,
3
- * environment variables, process-group tracking, stdout/stderr capture,
4
- * exit-code capture, cleanup with a shutdown grace period, and orphan-
5
- * process prevention.
2
+ * Process manager (§5): command execution, cwd, env, process-group tracking,
3
+ * stdout/stderr capture, exit-code capture, graceful shutdown, orphan prevention.
6
4
  *
7
- * Orphan prevention and group-kill use POSIX process groups
8
- * (`detached: true` + `process.kill(-pid, signal)`), matching this
9
- * project's Linux development and CI targets. Not portable to Windows as
10
- * written — out of scope for the V1 fixture-app slice (plan §34).
5
+ * Orphan prevention and group-kill use POSIX process groups (`detached: true` +
6
+ * `process.kill(-pid, signal)`) -- not portable to Windows, out of scope for the V1
7
+ * fixture-app slice (§34).
11
8
  */
12
9
  import { execFile, spawn } from "node:child_process";
13
10
  import { readFileSync } from "node:fs";
@@ -16,26 +13,19 @@ import { promisify } from "node:util";
16
13
  import { applyResourceLimits } from "./execution-safety.js";
17
14
  import { applySandbox } from "./sandbox.js";
18
15
  import { applyContainerSandbox } from "./container-sandbox.js";
16
+ import { computeAttachFence } from "./attach-fencing.js";
19
17
  /**
20
- * Binds port 0 (OS picks a free one), reads it, releases it immediately.
21
- * A real gap remains between "free when checked" and "still free when the
22
- * real service binds it" (RT-024's own class of gap, one layer down) --
23
- * unavoidable without binding the real service directly to the probe
24
- * socket, which `spawnProcess`'s child-process model doesn't support, and
25
- * which no ordinary application would cooperate with anyway.
18
+ * Binds port 0, reads it, releases immediately. A real gap remains between "free
19
+ * when checked" and "still free when the child binds it" (RT-024's gap, one layer
20
+ * down) -- unavoidable without binding the real service directly to the probe
21
+ * socket, which the child-process model doesn't support.
26
22
  *
27
- * **Examined for a fix and deliberately not "fixed".** Holding the probe
28
- * socket open for longer does not narrow the window, it widens it: the
29
- * child cannot bind while we hold the port, and the dominant term is the
30
- * child's own startup, not our release. Retrying on the child's bind error
31
- * would mean parsing that error out of process output, which is
32
- * per-language text and has no place in a language-neutral controller.
33
- * What was done instead is to make the one symptom legible: `awaitReadiness`
34
- * now names the endpoint it probed, so a collision reads as "nothing
35
- * answered on this port" rather than as an unexplained application failure.
36
- * In practice the window is a handful of milliseconds and readiness always
37
- * runs afterwards, so a genuine collision fails loudly -- it is just no
38
- * longer misattributed.
23
+ * **Examined and deliberately not "fixed".** Holding the probe socket longer widens
24
+ * the window rather than narrowing it (the child can't bind while we hold it).
25
+ * Instead, `awaitReadiness` names the endpoint it probed, so a collision reads as
26
+ * "nothing answered on this port" rather than an unexplained failure. Window is a
27
+ * handful of ms in practice; a genuine collision still fails loudly, just correctly
28
+ * attributed.
39
29
  */
40
30
  export function allocateEphemeralPort() {
41
31
  return new Promise((resolve, reject) => {
@@ -63,16 +53,13 @@ export function spawnProcess(options) {
63
53
  let killStarted = false;
64
54
  let child;
65
55
  let settled = false;
66
- // Set only for the container backend (applyContainerSandbox's own
67
- // returned name) -- see kill()'s own comment for why the container
68
- // needs a real, separate stop mechanism from the bwrap path's group-kill.
56
+ // Set only for the container backend -- see kill() for why it needs a separate
57
+ // stop mechanism from bwrap's group-kill.
69
58
  let containerName = null;
70
59
  let resolveExit;
71
60
  let exitPromise;
72
- // Everything a (re)spawn needs to reset, in one place -- `restart()` calls
73
- // this again after the previous child has fully exited, and the two call
74
- // sites (initial construction, restart) must not drift into resetting
75
- // different subsets of this state.
61
+ // Everything a (re)spawn needs to reset, in one place -- construction and
62
+ // restart() must not drift into resetting different subsets of this state.
76
63
  function spawnChild() {
77
64
  startedAt = new Date().toISOString();
78
65
  exitedAt = null;
@@ -85,9 +72,7 @@ export function spawnProcess(options) {
85
72
  resolveExit = resolve;
86
73
  });
87
74
  // "container" skips applyResourceLimits entirely (see SpawnProcessOptions.
88
- // sandboxBackend's own comment on why prlimit composition isn't attempted
89
- // for this backend yet) -- every other case (the default, "bwrap")
90
- // behaves exactly as before this field existed.
75
+ // sandboxBackend) -- "bwrap" (default) is unchanged.
91
76
  const wrapped = options.sandboxBackend === "container"
92
77
  ? applyContainerSandbox({
93
78
  interpreterCommand: options.command,
@@ -118,15 +103,10 @@ export function spawnProcess(options) {
118
103
  child.stderr?.on("data", (chunk) => {
119
104
  outputBuffer += chunk.toString("utf8");
120
105
  });
121
- // Node does not call `spawn()`'s error path synchronously -- a bad
122
- // command (ENOENT) surfaces later as an `'error'` event, never a thrown
123
- // exception here, and per Node's own docs `'exit'` may never fire after
124
- // an `'error'`. An EventEmitter's unhandled `'error'` event crashes the
125
- // process, and with no `'exit'` guaranteed either, `exitPromise` would
126
- // otherwise hang forever -- both `'exit'` and `'error'` settle the same
127
- // promise exactly once, so a failed-to-spawn process reads as an
128
- // ordinary never-became-ready process (no pid, no output, no readiness
129
- // success) rather than crashing the caller or hanging its cleanup.
106
+ // A bad command (ENOENT) surfaces as an `'error'` event, not a thrown exception,
107
+ // and per Node's docs `'exit'` may never fire after `'error'`. Both events settle
108
+ // the same promise exactly once, so a failed spawn reads as an ordinary
109
+ // never-became-ready process rather than crashing the caller or hanging cleanup.
130
110
  function settle(info) {
131
111
  if (settled)
132
112
  return;
@@ -164,22 +144,16 @@ export function spawnProcess(options) {
164
144
  return;
165
145
  }
166
146
  if (containerName !== null) {
167
- // Real finding from this backend's own escape tests, not assumed up
168
- // front: the local `docker` CLI process is not the container -- it
169
- // runs under `dockerd`, a separate process tree entirely. Signaling
170
- // the CLI's process group (the mechanism below, correct for bwrap,
171
- // which execs the sandboxed process directly) left a real orphaned
172
- // container running in testing. `docker stop` targets the actual
173
- // container by name and is the real stop mechanism for this backend;
174
- // `--rm` (set by applyContainerSandbox) then removes it once stopped.
175
- // Still falls through to the group-kill below afterward, as a
176
- // backstop for the local CLI process itself.
147
+ // Found via escape testing: the local `docker` CLI process is not the
148
+ // container -- it runs under `dockerd`, a separate process tree.
149
+ // Signaling the CLI's process group left a real orphaned container running.
150
+ // `docker stop` (by name) is the real stop mechanism here; `--rm` then
151
+ // removes it. Still falls through to group-kill below as a CLI backstop.
177
152
  try {
178
153
  await execFileAsync("docker", ["stop", "--time", String(Math.max(1, Math.round(gracePeriodMs / 1000))), containerName]);
179
154
  }
180
155
  catch {
181
- // Already stopped/removed (e.g. the process exited on its own
182
- // first) -- not an error worth surfacing to the caller.
156
+ // Already stopped/removed -- not worth surfacing.
183
157
  }
184
158
  }
185
159
  signalGroup(pid, "SIGTERM");
@@ -190,11 +164,9 @@ export function spawnProcess(options) {
190
164
  }
191
165
  }
192
166
  async function restart(gracePeriodMs = DEFAULT_GRACE_PERIOD_MS) {
193
- // Safe whether the process is still alive, already exited on its own,
194
- // or already mid-kill -- `kill()` is idempotent in all three cases and
195
- // this always waits for the OLD child to be fully gone before
196
- // `spawnChild()` reassigns `child`/`exitPromise`/etc., so no event from
197
- // the outgoing process can land on the incoming one's state.
167
+ // Safe regardless of the old process's state -- kill() is idempotent, and this
168
+ // waits for it to be fully gone before spawnChild() reassigns state, so no
169
+ // outgoing event can land on the incoming process.
198
170
  await kill(gracePeriodMs);
199
171
  spawnChild();
200
172
  }
@@ -204,20 +176,17 @@ export function spawnProcess(options) {
204
176
  waitForExit: () => exitPromise,
205
177
  kill,
206
178
  restart,
179
+ // A spawned process has no output that predates this runtime observing it.
180
+ attachFence: () => null,
207
181
  };
208
182
  }
209
183
  /**
210
- * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether
211
- * delivery would be possible. `ESRCH` means no such pid; `EPERM` means a
212
- * pid we don't own but that unambiguously exists, still alive for this
213
- * purpose. Any other error is treated as "exists" rather than guessed away.
184
+ * `process.kill(pid, 0)` sends no signal, only asks the kernel if delivery is
185
+ * possible. `ESRCH` = no such pid; `EPERM` = a pid we don't own but that exists.
214
186
  *
215
- * A second, deliberate copy of `packages/orchestrator/src/attach-to-running-process.ts`'s
216
- * function of the same name, not an import of it: `orchestrator` depends on
217
- * `controller` (see `orchestrator/package.json`), so the reverse import
218
- * would be circular. Tiny and pure, the same "duplicated because both
219
- * copies are easy to notice drift" precedent `attach-to-running-jvm-process.ts`'s
220
- * own `reconstructJvmSourcePath` already sets for exactly this reason.
187
+ * Deliberate second copy of `orchestrator/src/attach-to-running-process.ts`'s
188
+ * same-named function, not an import -- `orchestrator` depends on `controller`, so
189
+ * the reverse import would be circular. Tiny and pure enough to duplicate safely.
221
190
  */
222
191
  export function isProcessAlive(pid) {
223
192
  try {
@@ -230,25 +199,27 @@ export function isProcessAlive(pid) {
230
199
  }
231
200
  const DEFAULT_ATTACH_POLL_INTERVAL_MS = 50;
232
201
  /**
233
- * `ManagedProcess` for a service `ExecutionController.run()` attaches to
234
- * instead of spawning (`ServiceConfiguration.attach`). Reads
235
- * `attach.logFilePath` fresh on every `readOutput()` call — the same
236
- * growing-whole-buffer contract a spawned process's in-memory pipe buffer
237
- * already has (`spawnProcess`'s own `outputBuffer`), so `createPollingProcessOutputSource`
238
- * (`@descryy/runtime-orchestrator`) needs no attach-specific branch to
239
- * consume either one.
202
+ * `ManagedProcess` for a service attached to rather than spawned. Reads
203
+ * `attach.logFilePath` fresh on every `readOutput()` -- same growing-whole-buffer
204
+ * contract as a spawned process's in-memory pipe buffer.
240
205
  *
241
- * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this
242
- * process and `ATTACH_MODE_SCOPE_DISCLOSURE` (`@descryy/runtime-contracts`)
243
- * is unconditional: attach mode "never executes code in it or applies
244
- * changes to it." `ExecutionController`'s cleanup path kills every managed
245
- * process on failure/timeout/stop — for an attached service that would mean
246
- * terminating a process this runtime does not own, silently, the exact
247
- * thing the disclosure promises never happens. Ending observation (no
248
- * further polling) is the honest equivalent of "stop" here; the target
249
- * keeps running, as it was before Descry ever attached. `restart()` throws
250
- * for the same reason: there is no command this runtime could relaunch it
251
- * with.
206
+ * **`kill()` is a deliberate no-op, not a stub.** Descry did not spawn this process,
207
+ * and `ATTACH_MODE_SCOPE_DISCLOSURE` is unconditional: attach mode never executes
208
+ * code in or applies changes to what it observes. Ending observation is the honest
209
+ * equivalent of "stop" -- the target keeps running. `restart()` throws for the same
210
+ * reason: no command exists to relaunch it with.
211
+ *
212
+ * **Attach fencing (RT-N3).** `computeAttachFence` snapshots, at construction time
213
+ * (i.e. the moment of attach), how much of `logFilePath` already existed and
214
+ * whether some other process also holds it open -- see `attach-fencing.ts`. Exposed
215
+ * via `attachFence()` for a caller building a `ProcessOutputSource` over
216
+ * `readOutput()` to mark pre-existing content instead of reporting it as freshly
217
+ * observed. `readOutput()` itself additionally refuses (rather than silently
218
+ * mis-reading) if the file is ever found shorter than the largest size already
219
+ * seen -- the same "cannot reconstruct a rotated/truncated buffer" rule
220
+ * `orchestrator/src/polling-output-source.ts` enforces one layer up, duplicated
221
+ * here for the same reason `isProcessAlive` is: this module cannot depend on
222
+ * that one without a cycle, and the check is small and pure enough to repeat.
252
223
  */
253
224
  export function attachManagedProcess(options) {
254
225
  const { pid, logFilePath } = options.attach;
@@ -256,6 +227,8 @@ export function attachManagedProcess(options) {
256
227
  throw new Error(`attachManagedProcess: pid ${String(pid)} for "${options.processId}" is not running — attach requires ` +
257
228
  `a target that already exists.`);
258
229
  }
230
+ const fence = computeAttachFence(pid, logFilePath);
231
+ let maxObservedByteLength = fence.attachOffsetBytes;
259
232
  const startedAt = new Date().toISOString();
260
233
  let exitedAt = null;
261
234
  let exitPromise = null;
@@ -265,16 +238,12 @@ export function attachManagedProcess(options) {
265
238
  }
266
239
  return {
267
240
  processId: options.processId,
268
- // No command to report — this runtime never launched this process,
269
- // so there is nothing here that isn't a guess. Disclosed rather than
270
- // fabricated.
241
+ // No real command to report -- disclosed rather than guessed.
271
242
  command: `<attached: pid ${String(pid)}, ${logFilePath}>`,
272
243
  pid,
273
244
  startedAt,
274
245
  exitedAt,
275
- // Neither is observable for a process we did not spawn and do not
276
- // reap — see this function's own module doc on why `kill()` never
277
- // signals it, which is exactly what would let us learn either.
246
+ // Not observable for a process we don't spawn or reap.
278
247
  exitCode: null,
279
248
  signal: null,
280
249
  serviceName: options.serviceName ?? null,
@@ -283,13 +252,23 @@ export function attachManagedProcess(options) {
283
252
  };
284
253
  }
285
254
  function readOutput() {
255
+ let content;
286
256
  try {
287
- return readFileSync(logFilePath, "utf8");
257
+ content = readFileSync(logFilePath, "utf8");
288
258
  }
289
259
  catch (error) {
290
260
  const detail = error instanceof Error ? error.message : String(error);
291
261
  throw new Error(`attachManagedProcess: could not read log file "${logFilePath}" for pid ${String(pid)}: ${detail}`);
292
262
  }
263
+ const byteLength = Buffer.byteLength(content, "utf8");
264
+ if (byteLength < maxObservedByteLength) {
265
+ throw new Error(`attachManagedProcess: log file "${logFilePath}" for pid ${String(pid)} shrank from ${String(maxObservedByteLength)} ` +
266
+ `to ${String(byteLength)} bytes between reads -- this looks like log rotation or truncation, not new output. ` +
267
+ "The file-tail contract can't reconstruct a rotated/truncated buffer without either duplicating or dropping " +
268
+ `lines. Reported rather than guessed. (This run's own attach offset was ${String(fence.attachOffsetBytes)} bytes.)`);
269
+ }
270
+ maxObservedByteLength = byteLength;
271
+ return content;
293
272
  }
294
273
  function waitForExit() {
295
274
  exitPromise ??= new Promise((resolve) => {
@@ -306,25 +285,23 @@ export function attachManagedProcess(options) {
306
285
  return exitPromise;
307
286
  }
308
287
  function kill() {
309
- // Deliberate no-op — see this function's own module doc.
288
+ // Deliberate no-op -- see module doc above.
310
289
  return Promise.resolve();
311
290
  }
312
291
  function restart() {
313
292
  return Promise.reject(new Error(`attachManagedProcess: cannot restart an attached process (pid ${String(pid)}) — Descry did not spawn ` +
314
293
  `it and has no command to relaunch it with.`));
315
294
  }
316
- return { handle, readOutput, waitForExit, kill, restart };
295
+ return { handle, readOutput, waitForExit, kill, restart, attachFence: () => fence };
317
296
  }
318
297
  const execFileAsync = promisify(execFile);
319
298
  function signalGroup(pid, signal) {
320
299
  try {
321
- // Negative pid targets the whole process group (the child is its
322
- // leader, per `detached: true`), not just the immediate process --
323
- // this is the orphan-prevention mechanism.
300
+ // Negative pid targets the whole process group (orphan-prevention mechanism).
324
301
  process.kill(-pid, signal);
325
302
  }
326
303
  catch {
327
- // Group already gone -- nothing to signal, not an error.
304
+ // Group already gone -- not an error.
328
305
  }
329
306
  }
330
307
  function sleep(ms) {
@@ -1 +1 @@
1
- {"version":3,"file":"process-manager.js","sourceRoot":"","sources":["../src/process-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,YAAY,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC5B,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE;YACnB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,OAAO,KAAK,I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