@wjarka/cezarion 0.17.0-dev.3031 → 0.17.0-pr1973.3036

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 (44) hide show
  1. package/dist/ci-wait/tools.d.ts +4 -4
  2. package/dist/delegation/destroy-holders.d.ts +2 -0
  3. package/dist/delegation/destroy-holders.js +167 -0
  4. package/dist/delegation/destroy-holders.js.map +1 -0
  5. package/dist/delegation/idle-test-app.js +58 -20
  6. package/dist/delegation/idle-test-app.js.map +1 -1
  7. package/dist/delegation/mount-boundary.d.ts +16 -0
  8. package/dist/delegation/mount-boundary.js +126 -0
  9. package/dist/delegation/mount-boundary.js.map +1 -0
  10. package/dist/delegation/process-liveness.d.ts +3 -0
  11. package/dist/delegation/process-liveness.js +5 -0
  12. package/dist/delegation/process-liveness.js.map +1 -1
  13. package/dist/delegation/service.d.ts +1 -3
  14. package/dist/delegation/service.js +117 -24
  15. package/dist/delegation/service.js.map +1 -1
  16. package/dist/delegation/windows-workspace-identity.d.ts +10 -0
  17. package/dist/delegation/windows-workspace-identity.js +37 -0
  18. package/dist/delegation/windows-workspace-identity.js.map +1 -1
  19. package/dist/delegation/workspace.d.ts +3 -1
  20. package/dist/delegation/workspace.js +324 -29
  21. package/dist/delegation/workspace.js.map +1 -1
  22. package/dist/git-worktree-release.d.ts +1 -1
  23. package/dist/git-worktree-release.js +2 -2
  24. package/dist/git-worktree-release.js.map +1 -1
  25. package/dist/runs/private-worker-file.d.ts +5 -0
  26. package/dist/runs/private-worker-file.js +51 -0
  27. package/dist/runs/private-worker-file.js.map +1 -0
  28. package/dist/runs/store.d.ts +48 -48
  29. package/dist/runs/store.js +47 -87
  30. package/dist/runs/store.js.map +1 -1
  31. package/dist/runs/windows-worker-evidence.d.ts +9 -0
  32. package/dist/runs/windows-worker-evidence.js +71 -0
  33. package/dist/runs/windows-worker-evidence.js.map +1 -0
  34. package/dist/runs/worker-execution.js +17 -1
  35. package/dist/runs/worker-execution.js.map +1 -1
  36. package/dist/server/server.d.ts +1200 -1200
  37. package/dist/workflows/continuation-admission.d.ts +48 -48
  38. package/dist/workflows/run.d.ts +1 -3
  39. package/dist/workflows/run.js +6 -7
  40. package/dist/workflows/run.js.map +1 -1
  41. package/package.json +3 -3
  42. package/scripts/test-fallback-sandbox.mjs +39 -0
  43. package/scripts/windows-workspace-identity.cs +219 -10
  44. package/scripts/windows-workspace-identity.ps1 +6 -0
@@ -241,6 +241,30 @@ export declare class ContinuationChecks {
241
241
  deadline: string;
242
242
  seconds: number;
243
243
  note?: string | undefined;
244
+ } | {
245
+ id: string;
246
+ source: "agent" | "cezar";
247
+ via: "ask-line" | "budget" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "no-wait" | "schedule-wakeup";
248
+ registeredAt: string;
249
+ phase: "cancelled" | "delivered" | "open" | "resolved";
250
+ resolvedAt?: string | undefined;
251
+ deliveredAt?: string | undefined;
252
+ cancelledAt?: string | undefined;
253
+ turnId: string;
254
+ kind: "process";
255
+ deadline: string;
256
+ timeoutSeconds: number;
257
+ pid: number;
258
+ startToken?: string | undefined;
259
+ exitFile?: string | undefined;
260
+ note?: string | undefined;
261
+ result?: {
262
+ outcome: "deadline" | "error" | "exit_file" | "exited";
263
+ observedAt: string;
264
+ exitCode?: number | undefined;
265
+ exitFileNote?: "not-an-exit-code" | undefined;
266
+ diagnostic?: string | undefined;
267
+ } | undefined;
244
268
  } | {
245
269
  id: string;
246
270
  source: "agent" | "cezar";
@@ -301,30 +325,6 @@ export declare class ContinuationChecks {
301
325
  reason: "outcome" | "timeout";
302
326
  } | undefined;
303
327
  wakeInputId?: string | undefined;
304
- } | {
305
- id: string;
306
- source: "agent" | "cezar";
307
- via: "ask-line" | "budget" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "no-wait" | "schedule-wakeup";
308
- registeredAt: string;
309
- phase: "cancelled" | "delivered" | "open" | "resolved";
310
- resolvedAt?: string | undefined;
311
- deliveredAt?: string | undefined;
312
- cancelledAt?: string | undefined;
313
- turnId: string;
314
- kind: "process";
315
- deadline: string;
316
- timeoutSeconds: number;
317
- pid: number;
318
- startToken?: string | undefined;
319
- exitFile?: string | undefined;
320
- note?: string | undefined;
321
- result?: {
322
- outcome: "deadline" | "error" | "exit_file" | "exited";
323
- observedAt: string;
324
- exitCode?: number | undefined;
325
- exitFileNote?: "not-an-exit-code" | undefined;
326
- diagnostic?: string | undefined;
327
- } | undefined;
328
328
  })[] | undefined;
329
329
  lastWaits?: ({
330
330
  prUrl: string;
@@ -378,6 +378,30 @@ export declare class ContinuationChecks {
378
378
  deadline: string;
379
379
  seconds: number;
380
380
  note?: string | undefined;
381
+ } | {
382
+ id: string;
383
+ source: "agent" | "cezar";
384
+ via: "ask-line" | "budget" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "no-wait" | "schedule-wakeup";
385
+ registeredAt: string;
386
+ phase: "cancelled" | "delivered" | "open" | "resolved";
387
+ resolvedAt?: string | undefined;
388
+ deliveredAt?: string | undefined;
389
+ cancelledAt?: string | undefined;
390
+ turnId: string;
391
+ kind: "process";
392
+ deadline: string;
393
+ timeoutSeconds: number;
394
+ pid: number;
395
+ startToken?: string | undefined;
396
+ exitFile?: string | undefined;
397
+ note?: string | undefined;
398
+ result?: {
399
+ outcome: "deadline" | "error" | "exit_file" | "exited";
400
+ observedAt: string;
401
+ exitCode?: number | undefined;
402
+ exitFileNote?: "not-an-exit-code" | undefined;
403
+ diagnostic?: string | undefined;
404
+ } | undefined;
381
405
  } | {
382
406
  id: string;
383
407
  source: "agent" | "cezar";
@@ -438,30 +462,6 @@ export declare class ContinuationChecks {
438
462
  reason: "outcome" | "timeout";
439
463
  } | undefined;
440
464
  wakeInputId?: string | undefined;
441
- } | {
442
- id: string;
443
- source: "agent" | "cezar";
444
- via: "ask-line" | "budget" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "no-wait" | "schedule-wakeup";
445
- registeredAt: string;
446
- phase: "cancelled" | "delivered" | "open" | "resolved";
447
- resolvedAt?: string | undefined;
448
- deliveredAt?: string | undefined;
449
- cancelledAt?: string | undefined;
450
- turnId: string;
451
- kind: "process";
452
- deadline: string;
453
- timeoutSeconds: number;
454
- pid: number;
455
- startToken?: string | undefined;
456
- exitFile?: string | undefined;
457
- note?: string | undefined;
458
- result?: {
459
- outcome: "deadline" | "error" | "exit_file" | "exited";
460
- observedAt: string;
461
- exitCode?: number | undefined;
462
- exitFileNote?: "not-an-exit-code" | undefined;
463
- diagnostic?: string | undefined;
464
- } | undefined;
465
465
  })[] | undefined;
466
466
  previewServers?: {
467
467
  port: number;
@@ -400,9 +400,7 @@ export declare class RunManager {
400
400
  * dead leader's group counts only while a process holding `paths` is in it. Every signal
401
401
  * re-verifies first: a reused PID or group number is never touched. */
402
402
  private terminateRecorded;
403
- /** Destroy of a finished generation (hearsay-tools/cezarion#890): a dev server or watcher its
404
- * agent left in its process group holds the worktree, and nothing else ties it to the worker.
405
- * A record whose controller is another live cezar is not ours to act on. */
403
+ /** Destroy recorded survivors, excluding a foreign live controller (hearsay-tools/cezarion#890). */
406
404
  private terminateFinishedWorkerGroups;
407
405
  /** Best effort: a failed write leaves the working-directory scan as this process's evidence. */
408
406
  private recordWorkerProcess;
@@ -31,7 +31,7 @@ import { ProcessWaitSupervisor, probeProcessWait } from '../process-wait/supervi
31
31
  import { confineExitFile } from '../process-wait/exit-file.js';
32
32
  import { WorkerScratchCleanup } from '../delegation/scratch-cleanup.js';
33
33
  import { noJitter, ORPHAN_BACKOFF, retryDelayMs, WAKE_RETRY_BACKOFF } from '../delegation/retry-backoff.js';
34
- import { inspectExecutionGeneration, isCurrentProcess, processesWithCwdUnder, processStartToken, recordedGroupSignalable, recordedProcessLive, sharedCwdScan } from '../delegation/process-liveness.js';
34
+ import { inspectExecutionGeneration, isCurrentProcess, processesWithCwdUnder, processStartToken, recordedGroupSignalable, recordedProcessLive, sameDestroyGeneration, sharedCwdScan } from '../delegation/process-liveness.js';
35
35
  import { parseUsageLimit } from '../core/usage-limit.js';
36
36
  import { startManagedSession } from '../core/managed-session.js';
37
37
  import { createRunner } from '../core/runner-factory.js';
@@ -966,9 +966,7 @@ export class RunManager {
966
966
  if (living())
967
967
  signal('SIGKILL');
968
968
  }
969
- /** Destroy of a finished generation (hearsay-tools/cezarion#890): a dev server or watcher its
970
- * agent left in its process group holds the worktree, and nothing else ties it to the worker.
971
- * A record whose controller is another live cezar is not ours to act on. */
969
+ /** Destroy recorded survivors, excluding a foreign live controller (hearsay-tools/cezarion#890). */
972
970
  async terminateFinishedWorkerGroups(runId, timeoutMs) {
973
971
  const proof = this.store.readWorkerExecution(runId);
974
972
  if (proof?.phase !== 'complete')
@@ -979,12 +977,13 @@ export class RunManager {
979
977
  (recordedProcessLive(record.controller) && !isCurrentProcess(record.controller)))
980
978
  return;
981
979
  const groups = record.processes.filter(entry => entry.pgid !== undefined);
982
- if (!groups.length)
980
+ const pids = record.processes.filter(entry => entry.pgid === undefined && entry.startToken !== undefined && recordedProcessLive(entry));
981
+ if (!groups.length && !pids.length)
983
982
  return;
984
983
  const deadline = Date.now() + Math.min(30_000, Math.max(0, Number.isFinite(timeoutMs) ? timeoutMs : 0));
985
984
  const pause = () => new Promise(resolve => setTimeout(resolve, Math.max(0, Math.min(100, deadline - Date.now()))));
986
- const paths = [run.delegation.workspace.path, ...agentTmpDirLocationEvidence(this.dataDir, runId).paths];
987
- await this.terminateRecorded({ pids: [], groups, paths }, deadline, pause);
985
+ const workspace = run.delegation.workspace, requestedAt = run.delegation.destroy?.requestedAt, paths = [workspace.path, ...agentTmpDirLocationEvidence(this.dataDir, runId).paths];
986
+ await this.terminateRecorded({ pids, groups, paths }, deadline, pause, () => !this.disposed && sameDestroyGeneration(this.store.getRun(runId), this.store.readWorkerExecution(runId)?.generation, proof.generation, workspace, requestedAt));
988
987
  }
989
988
  /** Best effort: a failed write leaves the working-directory scan as this process's evidence. */
990
989
  recordWorkerProcess(runId, pid) {