@hearsay-tools/squawk 0.18.0-dev.7338 → 0.18.0-dev.7351

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 (33) hide show
  1. package/dist/ci-wait/controller.d.ts +4 -4
  2. package/dist/delegation/owned-workspace-release.d.ts +3 -1
  3. package/dist/delegation/owned-workspace-release.js +2 -2
  4. package/dist/delegation/owned-workspace-release.js.map +1 -1
  5. package/dist/delegation/provision.js +1 -1
  6. package/dist/delegation/provision.js.map +1 -1
  7. package/dist/delegation/routes.d.ts +66 -66
  8. package/dist/delegation/transport.d.ts +15 -15
  9. package/dist/delegation/worker-cleanup.d.ts +20 -0
  10. package/dist/delegation/worker-cleanup.js +103 -9
  11. package/dist/delegation/worker-cleanup.js.map +1 -1
  12. package/dist/delegation/workspace-removal.d.ts +13 -4
  13. package/dist/delegation/workspace-removal.js +91 -30
  14. package/dist/delegation/workspace-removal.js.map +1 -1
  15. package/dist/git-worktree-lock-helper.d.ts +21 -0
  16. package/dist/git-worktree-lock-helper.js +143 -19
  17. package/dist/git-worktree-lock-helper.js.map +1 -1
  18. package/dist/git-worktree-lock.d.ts +21 -4
  19. package/dist/git-worktree-lock.js +17 -3
  20. package/dist/git-worktree-lock.js.map +1 -1
  21. package/dist/git-worktree.d.ts +5 -0
  22. package/dist/git-worktree.js +96 -14
  23. package/dist/git-worktree.js.map +1 -1
  24. package/dist/project-migration/engine.js +1 -1
  25. package/dist/project-migration/engine.js.map +1 -1
  26. package/dist/runs/store.d.ts +72 -72
  27. package/dist/server/repo-branches.js +1 -1
  28. package/dist/server/repo-branches.js.map +1 -1
  29. package/dist/server/reports-api.d.ts +2 -2
  30. package/dist/server/server.d.ts +58 -58
  31. package/dist/workflows/continuation-admission.d.ts +72 -72
  32. package/dist/workflows/run/wait-engine.d.ts +72 -72
  33. package/package.json +4 -4
@@ -1000,6 +1000,10 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1000
1000
  };
1001
1001
  } | {
1002
1002
  output: {
1003
+ ok: false;
1004
+ code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
1005
+ message: string;
1006
+ } | {
1003
1007
  ok: true;
1004
1008
  task: {
1005
1009
  id: string;
@@ -1011,10 +1015,6 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
1011
1015
  url?: string | undefined;
1012
1016
  };
1013
1017
  note: string;
1014
- } | {
1015
- ok: false;
1016
- code: "automations_off" | "conflict" | "invalid_request" | "not_found" | "unavailable";
1017
- message: string;
1018
1018
  };
1019
1019
  outputFormat: "json";
1020
1020
  status: import("hono/utils/http-status").ContentfulStatusCode;
@@ -4,4 +4,6 @@ import type { PreviewHostLike } from '../preview/registration.ts';
4
4
  * through the delegation cleanup's own fenced removal. */
5
5
  export declare function releaseThenRemoveOwnedWorkspace(deps: {
6
6
  previewHost?: Pick<PreviewHostLike, 'release'> | undefined;
7
- }, repoRoot: string, workspace: WorkerWorkspace, assertCurrent?: () => void, assertUnheld?: () => void): Promise<WorkerDestroyResult>;
7
+ }, repoRoot: string, workspace: WorkerWorkspace, assertCurrent?: () => void, assertUnheld?: () => void, lock?: {
8
+ waitMs?: number;
9
+ }): Promise<WorkerDestroyResult>;
@@ -1,9 +1,9 @@
1
1
  import { removeOwnedWorkspace } from './workspace-removal.js';
2
2
  /** A destroyed owned worker's checkout: the same rule as `releaseThenRemoveWorktree` (`git-worktree-release.ts`),
3
3
  * through the delegation cleanup's own fenced removal. */
4
- export async function releaseThenRemoveOwnedWorkspace(deps, repoRoot, workspace, assertCurrent, assertUnheld) {
4
+ export async function releaseThenRemoveOwnedWorkspace(deps, repoRoot, workspace, assertCurrent, assertUnheld, lock = {}) {
5
5
  return removeOwnedWorkspace(repoRoot, workspace, assertCurrent, async () => {
6
6
  await deps.previewHost?.release(workspace.ownerRunId).catch(() => undefined);
7
- }, assertUnheld);
7
+ }, assertUnheld, lock);
8
8
  }
9
9
  //# sourceMappingURL=owned-workspace-release.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"owned-workspace-release.js","sourceRoot":"","sources":["../../src/delegation/owned-workspace-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D;0DAC0D;AAC1D,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,IAAoE,EACpE,QAAgB,EAChB,SAA0B,EAC1B,aAA0B,EAC1B,YAAyB;IAEzB,OAAO,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC,EAAE,YAAY,CAAC,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"owned-workspace-release.js","sourceRoot":"","sources":["../../src/delegation/owned-workspace-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D;0DAC0D;AAC1D,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,IAAoE,EACpE,QAAgB,EAChB,SAA0B,EAC1B,aAA0B,EAC1B,YAAyB,EACzB,IAAI,GAAwB,EAAE;IAE9B,OAAO,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC"}
@@ -116,7 +116,7 @@ export function provisionDelegationSession(options) {
116
116
  `Collect/integrate desired results, destroy owned resources, explicitly delete child histories through the cockpit/API, then delete parent history.`,
117
117
  `Summary and bounded diff snapshots survive until parent deletion; general artifact bytes are not archived.`,
118
118
  `Branch/path strings and SHAs are historical descriptors after removal.`,
119
- `At most 32 outstanding workers (accepted, live, or not yet verifiably destroyed) and 1,024 creations per parent; destroy finished workers to free capacity. These limits bound resources and runaway spawning, not spending; 32 undelivered steering messages per worker.`,
119
+ `At most 32 outstanding workers (accepted, live, or not yet verifiably destroyed) and 1,024 creations per parent; destroy finished workers to free capacity; a worker that fails before its first step frees its own slot. These limits bound resources and runaway spawning, not spending; 32 undelivered steering messages per worker.`,
120
120
  `Review is a human gate.`,
121
121
  `Destruction may be incomplete; inspect remaining resources and retry explicitly.`,
122
122
  `Credentials are supplied only in the environment: never read, echo, forward or include them in commands, messages, prompts, events or files.`,
@@ -1 +1 @@
1
- {"version":3,"file":"provision.js","sourceRoot":"","sources":["../../src/delegation/provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAqD,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/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AAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAAE,MAAM,EAAE,CAAC;QAC/D,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC7D,MAAM,SAAS,EAAE,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF"}
@@ -27,6 +27,18 @@ export declare function delegationFailure(error: unknown): {
27
27
  export declare function createDelegationRoutes(service: DelegationService, credentials: CredentialRegistry): import("hono/hono-base").HonoBase<Env, {
28
28
  "/list": {
29
29
  $get: {
30
+ output: {
31
+ error: string;
32
+ code?: "invalid_input" | undefined;
33
+ };
34
+ outputFormat: "json";
35
+ status: 400;
36
+ input: {
37
+ query: {
38
+ offset?: string | undefined;
39
+ };
40
+ };
41
+ } | {
30
42
  output: {
31
43
  workers: {
32
44
  workerId: string;
@@ -64,18 +76,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
64
76
  offset?: string | undefined;
65
77
  };
66
78
  };
67
- } | {
68
- output: {
69
- error: string;
70
- code?: "invalid_input" | undefined;
71
- };
72
- outputFormat: "json";
73
- status: 400;
74
- input: {
75
- query: {
76
- offset?: string | undefined;
77
- };
78
- };
79
79
  };
80
80
  };
81
81
  } & {
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
221
221
  status: 200;
222
222
  input: {
223
223
  json: {
224
- workerIds: string[];
225
- timeoutSeconds?: number | undefined;
226
- mode?: "all" | "any" | "one" | undefined;
227
- } | {
228
224
  requestIds: string[];
229
225
  mode?: "all" | "any" | "one" | undefined;
230
226
  timeoutSeconds?: number | undefined;
227
+ } | {
228
+ workerIds: string[];
229
+ timeoutSeconds?: number | undefined;
230
+ mode?: "all" | "any" | "one" | undefined;
231
231
  } | {
232
232
  peerIds: string[];
233
233
  timeoutSeconds?: number | undefined;
@@ -613,6 +613,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
613
613
  } & {
614
614
  "/:workerId": {
615
615
  $get: {
616
+ output: {
617
+ error: string;
618
+ code?: "invalid_input" | undefined;
619
+ };
620
+ outputFormat: "json";
621
+ status: 400;
622
+ input: {
623
+ param: {
624
+ workerId: string;
625
+ };
626
+ };
627
+ } | {
616
628
  output: {
617
629
  workerId: string;
618
630
  parentRunId: string;
@@ -720,7 +732,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
720
732
  workerId: string;
721
733
  };
722
734
  };
723
- } | {
735
+ };
736
+ };
737
+ } & {
738
+ "/:workerId/collect": {
739
+ $post: {
724
740
  output: {
725
741
  error: string;
726
742
  code?: "invalid_input" | undefined;
@@ -731,12 +747,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
731
747
  param: {
732
748
  workerId: string;
733
749
  };
750
+ } & {
751
+ json: Record<string, never>;
734
752
  };
735
- };
736
- };
737
- } & {
738
- "/:workerId/collect": {
739
- $post: {
753
+ } | {
740
754
  output: {
741
755
  workerId: string;
742
756
  parentRunId: string;
@@ -838,7 +852,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
838
852
  } & {
839
853
  json: Record<string, never>;
840
854
  };
841
- } | {
855
+ };
856
+ };
857
+ } & {
858
+ "/:workerId/steer": {
859
+ $post: {
842
860
  output: {
843
861
  error: string;
844
862
  code?: "invalid_input" | undefined;
@@ -850,13 +868,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
850
868
  workerId: string;
851
869
  };
852
870
  } & {
853
- json: Record<string, never>;
871
+ json: {
872
+ text: string;
873
+ };
854
874
  };
855
- };
856
- };
857
- } & {
858
- "/:workerId/steer": {
859
- $post: {
875
+ } | {
860
876
  output: {
861
877
  workerId: string;
862
878
  state: "delivered" | "queued";
@@ -872,7 +888,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
872
888
  text: string;
873
889
  };
874
890
  };
875
- } | {
891
+ };
892
+ };
893
+ } & {
894
+ "/:workerId/stop": {
895
+ $post: {
876
896
  output: {
877
897
  error: string;
878
898
  code?: "invalid_input" | undefined;
@@ -884,15 +904,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
884
904
  workerId: string;
885
905
  };
886
906
  } & {
887
- json: {
888
- text: string;
889
- };
907
+ json: Record<string, never>;
890
908
  };
891
- };
892
- };
893
- } & {
894
- "/:workerId/stop": {
895
- $post: {
909
+ } | {
896
910
  output: {
897
911
  workerId: string;
898
912
  state: "stopping" | "terminated";
@@ -906,7 +920,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
906
920
  } & {
907
921
  json: Record<string, never>;
908
922
  };
909
- } | {
923
+ };
924
+ };
925
+ } & {
926
+ "/:workerId/destroy": {
927
+ $post: {
910
928
  output: {
911
929
  error: string;
912
930
  code?: "invalid_input" | undefined;
@@ -920,11 +938,7 @@ export declare function createDelegationRoutes(service: DelegationService, crede
920
938
  } & {
921
939
  json: Record<string, never>;
922
940
  };
923
- };
924
- };
925
- } & {
926
- "/:workerId/destroy": {
927
- $post: {
941
+ } | {
928
942
  output: {
929
943
  workerId: string;
930
944
  state: "complete" | "incomplete";
@@ -947,20 +961,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
947
961
  } & {
948
962
  json: Record<string, never>;
949
963
  };
950
- } | {
951
- output: {
952
- error: string;
953
- code?: "invalid_input" | undefined;
954
- };
955
- outputFormat: "json";
956
- status: 400;
957
- input: {
958
- param: {
959
- workerId: string;
960
- };
961
- } & {
962
- json: Record<string, never>;
963
- };
964
964
  } | {
965
965
  output: {
966
966
  workerId: string;
@@ -990,13 +990,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
990
990
  "/:workerId/diff": {
991
991
  $get: {
992
992
  output: {
993
- workerId: string;
994
- baselineSha: string;
995
- diff: string;
996
- truncated: boolean;
993
+ error: string;
994
+ code?: "invalid_input" | undefined;
997
995
  };
998
996
  outputFormat: "json";
999
- status: 200;
997
+ status: 400;
1000
998
  input: {
1001
999
  param: {
1002
1000
  workerId: string;
@@ -1004,11 +1002,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
1004
1002
  };
1005
1003
  } | {
1006
1004
  output: {
1007
- error: string;
1008
- code?: "invalid_input" | undefined;
1005
+ workerId: string;
1006
+ baselineSha: string;
1007
+ diff: string;
1008
+ truncated: boolean;
1009
1009
  };
1010
1010
  outputFormat: "json";
1011
- status: 400;
1011
+ status: 200;
1012
1012
  input: {
1013
1013
  param: {
1014
1014
  workerId: string;
@@ -57,6 +57,17 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
57
57
  "/discover": {
58
58
  $post: {
59
59
  output: {
60
+ runner: "claude" | "codex" | "omp" | "opencode" | "pi";
61
+ models: {
62
+ id: string;
63
+ label: string;
64
+ description: string;
65
+ effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
66
+ }[];
67
+ source: "cache" | "live" | "unavailable";
68
+ stale: boolean;
69
+ reason?: string | undefined;
70
+ } | {
60
71
  tasks: {
61
72
  id: string;
62
73
  title: string;
@@ -77,17 +88,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
77
88
  authFailureId?: string | undefined;
78
89
  runner: "claude" | "codex" | "omp" | "opencode" | "pi";
79
90
  }[];
80
- } | {
81
- runner: "claude" | "codex" | "omp" | "opencode" | "pi";
82
- models: {
83
- id: string;
84
- label: string;
85
- description: string;
86
- effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
87
- }[];
88
- source: "cache" | "live" | "unavailable";
89
- stale: boolean;
90
- reason?: string | undefined;
91
91
  };
92
92
  outputFormat: "json";
93
93
  status: 200;
@@ -196,13 +196,13 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
196
196
  status: 200;
197
197
  input: {
198
198
  json: {
199
- requestIds: string[];
200
- mode?: "all" | "any" | "one" | undefined;
201
- timeoutSeconds?: number | undefined;
202
- } | {
203
199
  workerIds: string[];
204
200
  timeoutSeconds?: number | undefined;
205
201
  mode?: "all" | "any" | "one" | undefined;
202
+ } | {
203
+ requestIds: string[];
204
+ mode?: "all" | "any" | "one" | undefined;
205
+ timeoutSeconds?: number | undefined;
206
206
  } | {
207
207
  peerIds: string[];
208
208
  timeoutSeconds?: number | undefined;
@@ -1,13 +1,23 @@
1
1
  import type { WorkerDestroyResult } from '../contract/index.js';
2
2
  import type { RunRecord } from '../runs/store.ts';
3
3
  import { type Backoff } from './retry-backoff.ts';
4
+ /** How long an explicit destroy waits in the worktree mutation lock queue: long enough for a
5
+ * settling worker's own Git work to finish (hearsay-tools/squawk#3817). */
6
+ export declare const MANUAL_DESTROY_LOCK_WAIT_MS = 30000;
7
+ /** The part of the CLI's 45 s request bound an explicit destroy may use before its lock wait ends,
8
+ * so the caller reads the answer, holder and retry time included, instead of a transport timeout. */
9
+ export declare const MANUAL_DESTROY_ANSWER_BY_MS = 40000;
4
10
  import type { DelegationProject, WorkerCleanupFactory } from './service.ts';
11
+ /** A worker that failed before any step started: no agent ran in it, so it holds no work, and its
12
+ * resources and cap slot are released without the parent asking (hearsay-tools/squawk#3817). */
13
+ export declare function failedBeforeFirstStep(store: DelegationProject['store'], run: RunRecord): boolean;
5
14
  /** Tests pass shorter cadences and termination waits through these constructor options. */
6
15
  export type WorkerCleanupOptions = {
7
16
  now?: () => number;
8
17
  backoff?: Backoff;
9
18
  attentionAttempts?: number;
10
19
  terminationTimeoutMs?: number;
20
+ manualLockWaitMs?: number;
11
21
  };
12
22
  type Serialize = <T>(key: string, operation: () => Promise<T>) => Promise<T>;
13
23
  /** What a process entry hands to `DelegationService`: one `WorkerCleanup` per registered project. */
@@ -20,6 +30,11 @@ export declare class WorkerCleanup {
20
30
  private readonly projects;
21
31
  private readonly now;
22
32
  constructor(project: DelegationProject, isAttached: () => boolean, serialized: Serialize, options?: WorkerCleanupOptions);
33
+ /** Every run change: a worker that just failed before its first step is destroyed in the background. */
34
+ private readonly onRun;
35
+ private failStartReleases;
36
+ /** One automatic destroy per fail-start worker; an incomplete one continues on the retry cadence. */
37
+ private releaseFailedStart;
23
38
  request(workerId: string, check: () => RunRecord): Promise<WorkerDestroyResult>;
24
39
  armAfterRecovery(): void;
25
40
  detach(): void;
@@ -28,6 +43,9 @@ export declare class WorkerCleanup {
28
43
  private readonly destroyBackoff;
29
44
  private readonly destroyAttentionAttempts;
30
45
  private readonly terminationTimeoutMs;
46
+ private readonly manualLockWaitMs;
47
+ /** When each armed automatic attempt is due, so an explicit destroy's answer can say when. */
48
+ private destroyRetryDue;
31
49
  private clearDestroyRetries;
32
50
  /** Called only after manager recovery, when persisted destroy intents may be retried. */
33
51
  private armDestroyRetries;
@@ -38,6 +56,8 @@ export declare class WorkerCleanup {
38
56
  /** One automatic attempt. It records the attempt and when the next is due, and from the attention
39
57
  * threshold on the cockpit says the cleanup needs attention. */
40
58
  private destroyTick;
59
+ /** An explicit destroy's lock wait: what is left of its answer budget after termination, at least 1 s. */
60
+ private manualLockWait;
41
61
  /** The project's raw `worktreeTeardown` value, read fresh at each attempt. */
42
62
  private teardownConfig;
43
63
  /** An explicit destroy (Clean up, `cez worker destroy`): always a full attempt, and it restarts the
@@ -7,6 +7,13 @@ import { describeProcesses, isCurrentProcess, recordedProcessLive } from './proc
7
7
  import { runWorktreeTeardown } from './worktree-teardown.js';
8
8
  import { loadConfig } from '../config.js';
9
9
  import { DESTROY_ATTENTION_ATTEMPTS, DESTROY_BACKOFF, retryDelayMs } from './retry-backoff.js';
10
+ import { WORKTREE_LOCK_BUSY_PREFIX } from './workspace-removal.js';
11
+ /** How long an explicit destroy waits in the worktree mutation lock queue: long enough for a
12
+ * settling worker's own Git work to finish (hearsay-tools/squawk#3817). */
13
+ export const MANUAL_DESTROY_LOCK_WAIT_MS = 30_000;
14
+ /** The part of the CLI's 45 s request bound an explicit destroy may use before its lock wait ends,
15
+ * so the caller reads the answer, holder and retry time included, instead of a transport timeout. */
16
+ export const MANUAL_DESTROY_ANSWER_BY_MS = 40_000;
10
17
  /** Why the worker's scope is not this controller's to stop: its current generation's record names
11
18
  * another live Squawk, or cannot be read. Undefined when it is ours. */
12
19
  function foreignControl(store, workerId) {
@@ -18,6 +25,12 @@ function foreignControl(store, workerId) {
18
25
  return undefined;
19
26
  return `the worker is still controlled by a live ${productName('cezar')} (pid ${record.controller.pid})`;
20
27
  }
28
+ /** A worker that failed before any step started: no agent ran in it, so it holds no work, and its
29
+ * resources and cap slot are released without the parent asking (hearsay-tools/squawk#3817). */
30
+ export function failedBeforeFirstStep(store, run) {
31
+ return run.delegation?.role === 'worker' && run.status === 'failed' && !run.delegation.destroy &&
32
+ !run.steps.some(step => step.startedAt) && store.readWorkerExecution(run.id)?.phase === 'complete';
33
+ }
21
34
  /** What a process entry hands to `DelegationService`: one `WorkerCleanup` per registered project. */
22
35
  export function workerCleanups(options = {}) {
23
36
  return (project, isAttached, serialized) => new WorkerCleanup(project, isAttached, serialized, options);
@@ -37,6 +50,47 @@ export class WorkerCleanup {
37
50
  this.destroyBackoff = options.backoff ?? DESTROY_BACKOFF;
38
51
  this.destroyAttentionAttempts = options.attentionAttempts ?? DESTROY_ATTENTION_ATTEMPTS;
39
52
  this.terminationTimeoutMs = options.terminationTimeoutMs ?? 30_000;
53
+ this.manualLockWaitMs = options.manualLockWaitMs ?? MANUAL_DESTROY_LOCK_WAIT_MS;
54
+ project.store.on('run', this.onRun);
55
+ }
56
+ /** Every run change: a worker that just failed before its first step is destroyed in the background. */
57
+ onRun = (run) => {
58
+ if (failedBeforeFirstStep(this.project.store, run))
59
+ this.releaseFailedStart(run.id);
60
+ };
61
+ failStartReleases = new Set();
62
+ /** One automatic destroy per fail-start worker; an incomplete one continues on the retry cadence. */
63
+ releaseFailedStart(workerId) {
64
+ const project = this.projects.get(this.project.id);
65
+ if (!project || this.failStartReleases.has(workerId))
66
+ return;
67
+ this.failStartReleases.add(workerId);
68
+ const check = () => {
69
+ if (this.projects.get(project.id) !== project)
70
+ throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
71
+ const current = project.store.getRun(workerId);
72
+ if (current?.delegation?.role !== 'worker' || current.delegation.workspace.ownerRunId !== workerId || current.status !== 'failed' ||
73
+ current.delegation.destroy?.phase === 'complete')
74
+ throw new DelegationPolicyError('incompatible_state', 'Worker is no longer a failed start');
75
+ // Until destroy intent is written, the worker must still be a failed start: a parent's resume
76
+ // can queue, run and fail it again while this release waits its turn. `destroyAttempt` calls
77
+ // this last with no await before it writes the intent; after that, a resume is refused.
78
+ if (!current.delegation.destroy && !failedBeforeFirstStep(project.store, current)) {
79
+ throw new DelegationPolicyError('incompatible_state', 'Worker is no longer a failed start');
80
+ }
81
+ return current;
82
+ };
83
+ // Off the store's emit: the attempt writes runs itself.
84
+ setImmediate(() => {
85
+ void this.serialized(`worker:${project.id}:${workerId}`, async () => {
86
+ if (!failedBeforeFirstStep(project.store, check()))
87
+ return;
88
+ await this.serialized(`destroy-retries:${project.id}`, () => this.destroyAttempt(project, workerId, check, 'scheduled', this.now()));
89
+ }).catch(() => undefined).finally(() => {
90
+ this.failStartReleases.delete(workerId);
91
+ this.scheduleDestroyRetry(project, workerId);
92
+ });
93
+ });
40
94
  }
41
95
  request(workerId, check) {
42
96
  const refusal = this.project.store.fallbackDeleteError(workerId, 'worktree');
@@ -44,9 +98,19 @@ export class WorkerCleanup {
44
98
  return Promise.reject(new DelegationPolicyError('incompatible_state', refusal));
45
99
  return this.destroySerialized(this.project, workerId, check);
46
100
  }
47
- armAfterRecovery() { this.armDestroyRetries(this.project.id); }
101
+ armAfterRecovery() {
102
+ this.armDestroyRetries(this.project.id);
103
+ // A fail-start that settled while no controller ran is released now. `listRuns` holds only live
104
+ // runs, and a settled failed worker is not one: read every worker.
105
+ for (const id of this.project.store.listWorkerIds()) {
106
+ const run = this.project.store.getRun(id);
107
+ if (run && failedBeforeFirstStep(this.project.store, run))
108
+ this.releaseFailedStart(id);
109
+ }
110
+ }
48
111
  detach() {
49
112
  this.clearDestroyRetries(this.project.id);
113
+ this.project.store.off('run', this.onRun);
50
114
  this.detached = true;
51
115
  }
52
116
  destroyRetryTimers = new Map();
@@ -54,11 +118,15 @@ export class WorkerCleanup {
54
118
  destroyBackoff;
55
119
  destroyAttentionAttempts;
56
120
  terminationTimeoutMs;
121
+ manualLockWaitMs;
122
+ /** When each armed automatic attempt is due, so an explicit destroy's answer can say when. */
123
+ destroyRetryDue = new Map();
57
124
  clearDestroyRetries(projectId) {
58
125
  for (const timer of this.destroyRetryTimers.get(projectId)?.values() ?? [])
59
126
  clearTimeout(timer);
60
127
  this.destroyRetryTimers.delete(projectId);
61
128
  this.destroyRetryInFlight.delete(projectId);
129
+ this.destroyRetryDue.delete(projectId);
62
130
  }
63
131
  /** Called only after manager recovery, when persisted destroy intents may be retried. */
64
132
  armDestroyRetries(projectId) {
@@ -89,8 +157,15 @@ export class WorkerCleanup {
89
157
  const { fastMs, capMs } = this.destroyBackoff;
90
158
  const nextAt = run.destroyRetry ? Date.parse(run.destroyRetry.nextAt) - this.now() : 0;
91
159
  const delay = Math.min(Math.max(fastMs, nextAt), capMs * 1.1);
160
+ let due = this.destroyRetryDue.get(project.id);
161
+ if (!due) {
162
+ due = new Map();
163
+ this.destroyRetryDue.set(project.id, due);
164
+ }
165
+ due.set(workerId, this.now() + delay);
92
166
  const timer = setTimeout(() => {
93
167
  timers.delete(workerId);
168
+ due.delete(workerId);
94
169
  if (this.projects.get(project.id) !== project)
95
170
  return;
96
171
  let inFlight = this.destroyRetryInFlight.get(project.id);
@@ -123,7 +198,7 @@ export class WorkerCleanup {
123
198
  check();
124
199
  // One automatic attempt at a time per project: attempts that coincide (every pending destroy
125
200
  // after a restart) would otherwise contend for the worktree mutation lock.
126
- await this.serialized(`destroy-retries:${project.id}`, () => this.destroyAttempt(project, workerId, check, 'scheduled')).catch(() => undefined);
201
+ await this.serialized(`destroy-retries:${project.id}`, () => this.destroyAttempt(project, workerId, check, 'scheduled', this.now())).catch(() => undefined);
127
202
  if (this.projects.get(project.id) !== project)
128
203
  return;
129
204
  const current = project.store.getRun(workerId);
@@ -135,26 +210,44 @@ export class WorkerCleanup {
135
210
  project.store.commitDestroyRetry(workerId, retry);
136
211
  });
137
212
  }
213
+ /** An explicit destroy's lock wait: what is left of its answer budget after termination, at least 1 s. */
214
+ manualLockWait(startedAt) {
215
+ return Math.max(1_000, Math.min(this.manualLockWaitMs, MANUAL_DESTROY_ANSWER_BY_MS - (this.now() - startedAt)));
216
+ }
138
217
  /** The project's raw `worktreeTeardown` value, read fresh at each attempt. */
139
218
  async teardownConfig(project) {
140
219
  return (await loadConfig(project.root, project.home)).worktreeTeardown;
141
220
  }
142
221
  /** An explicit destroy (Clean up, `cez worker destroy`): always a full attempt, and it restarts the
143
222
  * backoff, so a timer armed for a later automatic attempt is dropped and re-armed at the fast cadence. */
144
- destroySerialized(project, workerId, check) {
145
- return this.serialized(`worker:${project.id}:${workerId}`, () => this.destroyAttempt(project, workerId, check, 'manual')).finally(() => {
223
+ async destroySerialized(project, workerId, check) {
224
+ const rearm = () => {
146
225
  // A replaced registration owns its own timers under the same project id: leave them alone.
147
226
  if (this.projects.get(project.id) !== project)
148
227
  return;
149
228
  const timers = this.destroyRetryTimers.get(project.id);
150
229
  clearTimeout(timers?.get(workerId));
151
230
  timers?.delete(workerId);
231
+ this.destroyRetryDue.get(project.id)?.delete(workerId);
152
232
  this.scheduleDestroyRetry(project, workerId);
153
- });
233
+ };
234
+ let result;
235
+ // The answer budget starts when the request arrives, so time queued behind another attempt counts.
236
+ const requestedAt = this.now();
237
+ try {
238
+ result = await this.serialized(`worker:${project.id}:${workerId}`, () => this.destroyAttempt(project, workerId, check, 'manual', requestedAt));
239
+ }
240
+ finally {
241
+ rearm();
242
+ }
243
+ // A busy lock clears by itself: say when the next automatic attempt runs (hearsay-tools/squawk#3817).
244
+ const due = this.destroyRetryDue.get(project.id)?.get(workerId);
245
+ return result.error?.startsWith(WORKTREE_LOCK_BUSY_PREFIX) && due !== undefined
246
+ ? { ...result, error: `${result.error}; ${productName('Cezar')} retries automatically at ${new Date(due).toISOString()}` } : result;
154
247
  }
155
248
  /** One full destroy attempt; the caller holds the worker's serialization key. A manual attempt
156
249
  * clears the run's `destroyRetry`, which resets the backoff; a completed destroy drops it. */
157
- async destroyAttempt(project, workerId, check, mode) {
250
+ async destroyAttempt(project, workerId, check, mode, startedAt) {
158
251
  const assertAttached = () => {
159
252
  if (this.projects.get(project.id) !== project)
160
253
  throw new DelegationPolicyError('denied_scope', 'Worker scope denied');
@@ -241,10 +334,11 @@ export class WorkerCleanup {
241
334
  try {
242
335
  assertCurrent();
243
336
  // #781: release preview before the final check immediately preceding removal.
244
- result = await releaseThenRemoveOwnedWorkspace({ previewHost: project.manager.previewHost }, project.root, workspace, assertCurrent, assertSafe);
337
+ result = await releaseThenRemoveOwnedWorkspace({ previewHost: project.manager.previewHost }, project.root, workspace, assertCurrent, assertSafe, mode === 'manual' ? { waitMs: this.manualLockWait(startedAt) } : {});
245
338
  }
246
- catch {
247
- result = { workerId, state: 'incomplete', remaining: resources, error: 'Worker resources could not be verified; cleanup will retry' };
339
+ catch (error) {
340
+ result = { workerId, state: 'incomplete', remaining: resources,
341
+ error: `Worker resources could not be verified: ${(error instanceof Error ? error.message : String(error)).slice(0, 300)}; cleanup will retry` };
248
342
  }
249
343
  finally {
250
344
  release?.();