@cat-factory/local-server 0.32.3 → 0.33.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.
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAUpE,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAO7F,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,qBAAqB,CAAA;AAmD5B,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CAmclF;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,EAAE,CAc3E"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAUpE,OAAO,KAAK,EAAqC,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAO7F,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,qBAAqB,CAAA;AAmD5B,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,eAAe,CA8dlF;AAOD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,EAAE,CAc3E"}
package/dist/container.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CryptoIdGenerator, DrizzleEnvironmentUserHandlerRepository, DrizzleGitHubInstallationRepository, DrizzleLocalSettingsRepository, DrizzleRunnerPoolConnectionRepository, ProvisioningLogRecorder, SystemClock, buildNodeContainer, buildNodeResolveTransport, createDrizzleRepositories, executionRuntime, loadNodeConfig, withProvisioningLog, } from '@cat-factory/node-server';
2
- import { InProcessWorkRunner, composeMothership, isMothershipMode, } from './mothership.js';
2
+ import { SqliteWorkRunner, composeMothership, isMothershipMode, } from './mothership.js';
3
3
  import { ConflictError } from '@cat-factory/kernel';
4
4
  import { WorkspaceSettingsService } from '@cat-factory/orchestration';
5
5
  import { buildInfrastructureCapabilities, logger, RunnerJobClient } from '@cat-factory/server';
@@ -338,11 +338,23 @@ export function buildLocalContainer(options) {
338
338
  active: localTestInfraSupported ? 'local-compose' : 'environment-provider',
339
339
  },
340
340
  });
341
- // Mothership mode has no pg-boss: drive runs in-process through the SAME advance/poll loop
342
- // with real timer-backed sleeps. Bound to the execution service AFTER the container is built
343
- // (the service doesn't exist yetchicken-and-egg with createCore).
344
- const inProcessRunner = mothership
345
- ? new InProcessWorkRunner(executionRuntime(config, env).drive, logger)
341
+ // Mothership mode has no pg-boss: drive runs in-process through the SAME advance/poll loop with
342
+ // real timer-backed sleeps, backed by the durable local-sqlite work queue (so a crash/restart
343
+ // re-drives what was in flightthe durability pg-boss gives the Node facade). Bound to the
344
+ // execution service AFTER the container is built (the service doesn't exist yet — chicken-and-egg
345
+ // with createCore). The lease/sweeper timings reuse the same execution-runtime derivation the
346
+ // pg-boss queue/sweeper use, so durable recovery behaves consistently across the two runners.
347
+ const runtime = mothership ? executionRuntime(config, env) : undefined;
348
+ const inProcessRunner = mothership && runtime
349
+ ? new SqliteWorkRunner(mothership.workQueue, {
350
+ drive: runtime.drive,
351
+ leaseMs: runtime.queue.expireInSeconds * 1000,
352
+ reArmDelayMs: Math.max(1000, runtime.drive.ciPollIntervalMs),
353
+ errorBackoffMs: Math.max(1000, runtime.drive.ciPollIntervalMs),
354
+ sweepIntervalMs: runtime.sweeper.intervalMs,
355
+ maxAttempts: runtime.queue.retryLimit,
356
+ concurrency: runtime.concurrency,
357
+ }, logger)
346
358
  : undefined;
347
359
  const container = buildNodeContainer({
348
360
  ...options,
@@ -427,8 +439,10 @@ export function buildLocalContainer(options) {
427
439
  },
428
440
  });
429
441
  // Bind the in-process work runner to the now-built execution service, so `startRun` /
430
- // `signalDecision` drive runs in-process (mothership mode; no-op otherwise).
431
- inProcessRunner?.bind(container.executionService);
442
+ // `signalDecision` drive runs in-process (mothership mode; no-op otherwise). The kind-spanning
443
+ // agent-runs reader powers the storage-reconciliation backstop (re-drive a run still `running` in
444
+ // storage that lost its queue row) — the no-pg-boss analogue of the stale-run sweeper.
445
+ inProcessRunner?.bind(container.executionService, container.agentRunRepository);
432
446
  // Surface the local-mode settings service so the dedicated local-settings panel can
433
447
  // read/write the warm-pool + checkout config (the controller 503s when this is absent,
434
448
  // which is the case on every non-local facade). Also expose the PAT-login registry so the
@@ -437,9 +451,17 @@ export function buildLocalContainer(options) {
437
451
  ...container,
438
452
  vcsIdentity,
439
453
  ...(localSettingsService ? { localSettings: { service: localSettingsService } } : {}),
440
- // Release the local credential SQLite handle on shutdown (mothership mode owns it; the
441
- // boot path calls this from its SIGTERM/SIGINT handler). No-op otherwise.
442
- ...(mothership ? { onShutdown: mothership.close } : {}),
454
+ // On shutdown (mothership mode; the boot path calls this from its SIGTERM/SIGINT handler):
455
+ // stop the work runner's recovery poll FIRST so it can't touch the queue mid-close, then
456
+ // release both local SQLite handles (credentials + work queue). No-op otherwise.
457
+ ...(mothership
458
+ ? {
459
+ onShutdown: () => {
460
+ inProcessRunner?.stop();
461
+ mothership.close();
462
+ },
463
+ }
464
+ : {}),
443
465
  };
444
466
  }
445
467
  /** Values that explicitly DISABLE native mode (so `LOCAL_NATIVE_AGENTS=false` means off). */
@@ -1 +1 @@
1
- {"version":3,"file":"container.js","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,uCAAuC,EACvC,mCAAmC,EACnC,8BAA8B,EAC9B,qCAAqC,EACrC,uBAAuB,EACvB,WAAW,EACX,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AAE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AAA;AACpD,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { type ContainerRuntimeAdapter, type ContainerExec, type RuntimeId, creat
6
6
  export { linkRepo, type LinkRepoOptions, type LinkedRepo } from './linkRepo.js';
7
7
  export { createLocalGitHubClient, StaticTokenAppRegistry } from './github.js';
8
8
  export { createLocalCredentialStore, type LocalCredentialStore } from './sqlite/credentialStore.js';
9
- export { composeMothership, isMothershipMode, InProcessWorkRunner, type MothershipComposition, } from './mothership.js';
9
+ export { composeMothership, isMothershipMode, SqliteWorkRunner, type SqliteWorkRunnerOptions, type MothershipComposition, } from './mothership.js';
10
10
  export { registerAgentKind, registerAgentKinds, clearRegisteredAgentKinds, type AgentKindDefinition, } from '@cat-factory/agents';
11
11
  export { registerPipeline, registerPipelines, clearRegisteredPipelines } from '@cat-factory/kernel';
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,KAAK,oCAAoC,GAC1C,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAA;AAE/E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAO7E,OAAO,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kBAAkB,EAClB,yBAAyB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA"}
package/dist/index.js CHANGED
@@ -22,10 +22,10 @@ export { createLocalGitHubClient, StaticTokenAppRegistry } from './github.js';
22
22
  // public; the raw db opener and the repo classes stay internal until the 1b composition
23
23
  // step proves a consumer needs them.
24
24
  export { createLocalCredentialStore } from './sqlite/credentialStore.js';
25
- // Mothership composition: the remote (RPC) + local-sqlite repository set, the in-process work
26
- // runner that replaces pg-boss, and the boot-mode probe. `startLocal()` selects the no-Postgres
27
- // boot automatically when LOCAL_MOTHERSHIP_URL is set.
28
- export { composeMothership, isMothershipMode, InProcessWorkRunner, } from './mothership.js';
25
+ // Mothership composition: the remote (RPC) + local-sqlite repository set, the durable
26
+ // SQLite-backed work runner that replaces pg-boss, and the boot-mode probe. `startLocal()` selects
27
+ // the no-Postgres boot automatically when LOCAL_MOTHERSHIP_URL is set.
28
+ export { composeMothership, isMothershipMode, SqliteWorkRunner, } from './mothership.js';
29
29
  // Installation-level extension points, re-exported for parity with the Node facade so
30
30
  // a local deployment can register custom agent kinds / pipelines before `startLocal()`.
31
31
  export { registerAgentKind, registerAgentKinds, clearRegisteredAgentKinds, } from '@cat-factory/agents';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,kFAAkF;AAClF,iFAAiF;AACjF,sFAAsF;AACtF,yEAAyE;AACzE,gFAAgF;AAChF,4DAA4D;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EACL,6BAA6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B,EAChB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,qFAAqF;AACrF,gFAAgF;AAChF,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAyC,MAAM,eAAe,CAAA;AAC/E,6EAA6E;AAC7E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAE7E,0FAA0F;AAC1F,sFAAsF;AACtF,wFAAwF;AACxF,wFAAwF;AACxF,qCAAqC;AACrC,OAAO,EAAE,0BAA0B,EAA6B,MAAM,6BAA6B,CAAA;AACnG,sFAAsF;AACtF,mGAAmG;AACnG,uEAAuE;AACvE,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,iBAAiB,CAAA;AAExB,sFAAsF;AACtF,wFAAwF;AACxF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,yBAAyB,GAE1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -1,25 +1,28 @@
1
1
  import { type CoreRepositories, type DriveConfig, driveExecution } from '@cat-factory/node-server';
2
2
  import { type Logger } from '@cat-factory/server';
3
- import type { WorkRunner } from '@cat-factory/kernel';
3
+ import type { AgentRunRepository, WorkRunner } from '@cat-factory/kernel';
4
4
  import { type LocalCredentialStore } from './sqlite/credentialStore.js';
5
+ import { SqliteWorkQueue } from './sqlite/workQueue.js';
5
6
  /** True when this local node should boot in mothership mode (a mothership URL is configured). */
6
7
  export declare function isMothershipMode(env: NodeJS.ProcessEnv): boolean;
7
8
  /** The composed mothership persistence: remote org repos + the local credential store. */
8
9
  export interface MothershipComposition {
9
10
  /**
10
- * The full {@link CoreRepositories} surface, every entry remote (RPC-backed). The pilot
11
- * allow-list gates which repo+method actually executes on the mothership; an
12
- * un-allow-listed call returns `unknown_method`. IMPORTANT: the pilot table exposes only the
13
- * six core domain repos, which is NOT enough for a board load or a run end-to-end those
14
- * touch many more repos (mounts, settings, presets, notifications, …) that are still
15
- * un-allow-listed (and the direct-db repos in `buildNodeContainer` have no db here), so they
16
- * currently throw. The widened surface is the gating phase in docs/initiatives/mothership-mode.md
17
- * (this PR must stay a draft until it lands).
11
+ * The full {@link CoreRepositories} surface, every entry remote (RPC-backed). The server-side
12
+ * allow-list (`REMOTE_PERSISTENCE_METHODS`) gates which repo+method actually executes on the
13
+ * mothership; an un-allow-listed call returns `unknown_method`. The allow-list covers the
14
+ * board-load + run paths (resolved by the Phase-3 merge gatesee
15
+ * docs/initiatives/mothership-mode.md), so a board loads and a run drives to a persisted
16
+ * terminal state over this registry; the remaining `pending` org methods (the live per-repo
17
+ * checklist in the tracker) are widened slice by slice. Credentials are NOT here — they stay
18
+ * local (the `node:sqlite` store), composed over the top of this registry by the facade.
18
19
  */
19
20
  repos: CoreRepositories;
20
21
  /** The local-sqlite credential store (kept on the laptop, sealed with the local key). */
21
22
  credentialStore: LocalCredentialStore;
22
- /** Close the underlying SQLite db (call on shutdown). */
23
+ /** The durable local-sqlite execution work queue (the no-pg-boss durability substrate). */
24
+ workQueue: SqliteWorkQueue;
25
+ /** Close the underlying SQLite databases (call on shutdown). */
23
26
  close(): void;
24
27
  }
25
28
  /**
@@ -33,36 +36,107 @@ export interface MothershipComposition {
33
36
  * cannot authenticate a single call, so fail fast at boot rather than 403 on first read.
34
37
  */
35
38
  export declare function composeMothership(env: NodeJS.ProcessEnv): MothershipComposition;
39
+ type ExecutionService = Parameters<typeof driveExecution>[0];
40
+ /** Timing + sizing knobs for the durable work runner, derived from the execution runtime config. */
41
+ export interface SqliteWorkRunnerOptions {
42
+ /** The advance/poll drive config (poll intervals + budgets). */
43
+ drive: DriveConfig;
44
+ /** Lease for an in-flight drive; an `active` row past it is treated as crash-orphaned. */
45
+ leaseMs: number;
46
+ /** Delay before re-polling a re-armed unbounded gate (≈ the gate poll interval). */
47
+ reArmDelayMs: number;
48
+ /** Backoff before retrying a drive that threw. */
49
+ errorBackoffMs: number;
50
+ /** Periodic recovery poll: reclaim queued + lease-expired rows (the crash-recovery backstop). */
51
+ sweepIntervalMs: number;
52
+ /** Max drive attempts before a poison run is evicted (parity with pg-boss `retryLimit`). */
53
+ maxAttempts: number;
54
+ /** How many runs to drive in parallel on this node (parity with pg-boss worker concurrency). */
55
+ concurrency: number;
56
+ }
36
57
  /**
37
- * The in-process work runner: the no-Postgres analogue of {@link PgBossWorkRunner}. A
38
- * mothership-mode node has no pg-boss, so it drives runs in this process by calling the SAME
39
- * `driveExecution` advance/poll loop (with real timer-backed sleeps) in the background.
58
+ * The durable SQLite-backed work runner: the no-Postgres analogue of {@link PgBossWorkRunner}. A
59
+ * mothership-mode node has no pg-boss, so it drives runs in this process but unlike PR 1's
60
+ * best-effort in-memory runner, the intent "this run needs driving" is persisted in a local
61
+ * `node:sqlite` {@link SqliteWorkQueue}, so a crash or restart re-drives what was in flight. It
62
+ * mirrors pg-boss's `exclusive` advance queue:
40
63
  *
41
- * It serialises per execution — at most one drive per run at a time so a `signalDecision`
42
- * (or a re-armed human-review gate) that arrives mid-drive coalesces into exactly one
43
- * follow-up drive once the current one returns, mirroring pg-boss's `exclusive` queue
44
- * semantics (one live advance per run, duplicate sends suppressed). The execution service is
45
- * bound after the container is built (it does not exist when the runner is constructed).
64
+ * - one row per run (the queue's PRIMARY KEY) = pg-boss's `singletonKey` dedup;
65
+ * - a `startRun` / `signalDecision` (re)queues the run and kicks the drain loop;
66
+ * - the drain loop claims drivable runs up to `concurrency` and drives each via the SAME
67
+ * `driveExecution` advance/poll loop the Node facade uses (real timer-backed sleeps);
68
+ * - a signal arriving mid-drive coalesces into exactly one follow-up via the row's `rerun` flag;
69
+ * - a re-armed unbounded gate (human review) is deferred for `reArmDelayMs` then re-polled — the
70
+ * in-process analogue of the stale-run sweeper re-enqueuing it. A re-arm is a SUCCESSFUL drive,
71
+ * so it resets the retry budget: an unbounded gate re-arms forever without ever being mistaken
72
+ * for a poison pill;
73
+ * - `maxAttempts` bounds CONSECUTIVE drive FAILURES (not total claims): a poison run is evicted
74
+ * AND failed loudly, while a healthy run that re-arms / coalesces keeps its budget;
75
+ * - a periodic recovery poll + a boot-time orphan reset reclaim runs left `active` by a dead
76
+ * process, and a storage-reconciliation pass re-enqueues any run still `running` in storage that
77
+ * lost its queue row (the two legs of the durability pg-boss gets from Postgres, here from the
78
+ * SQLite file + the `agent_runs` source of truth).
46
79
  *
47
- * NOTE (single process, best effort): unlike pg-boss there is no durable queue or stale-run
48
- * sweeper, so a crash loses in-flight drives acceptable for a single-developer local node,
49
- * and the durable SQLite work queue is PR 2 in the initiative.
80
+ * The execution service is bound after the container is built (it does not exist when the runner is
81
+ * constructed). The `running` set tracks which runs THIS process is driving, so the claim loop and
82
+ * the recovery poll never double-drive an in-flight run.
50
83
  */
51
- export declare class InProcessWorkRunner implements WorkRunner {
52
- private readonly cfg;
84
+ export declare class SqliteWorkRunner implements WorkRunner {
85
+ private readonly queue;
86
+ private readonly opts;
53
87
  private readonly log;
88
+ private readonly now;
54
89
  private exec?;
55
- /** Per-execution state: `running` = a drive is active, `rerun` = another was requested mid-drive. */
56
- private readonly inflight;
57
- constructor(cfg: DriveConfig, log: Logger);
58
- /** Bind the execution service once the container is built (chicken-and-egg with `createCore`). */
59
- bind(exec: Parameters<typeof driveExecution>[0]): void;
90
+ private staleRuns?;
91
+ private readonly running;
92
+ private sweepTimer?;
93
+ private stopped;
94
+ constructor(queue: SqliteWorkQueue, opts: SqliteWorkRunnerOptions, log: Logger, now?: () => number);
95
+ /**
96
+ * Bind the execution service once the container is built, recover any runs orphaned by a previous
97
+ * process, drive what's queued, and start the periodic recovery poll. `staleRuns` (the
98
+ * kind-spanning `agent_runs` reader) enables the storage-reconciliation backstop — re-driving a
99
+ * run that storage reports `running` but that has no queue row at all (its row was lost, or never
100
+ * enqueued because a prior process died). Idempotent: a second call clears the previous sweep
101
+ * timer before re-arming, so it never leaks an interval.
102
+ */
103
+ bind(exec: ExecutionService, staleRuns?: AgentRunRepository): void;
104
+ /** Stop the recovery poll (shutdown). In-flight drives are left to finish or die with the process. */
105
+ stop(): void;
60
106
  startRun(workspaceId: string, executionId: string): Promise<void>;
61
107
  signalDecision(workspaceId: string, executionId: string): Promise<void>;
62
108
  cancelRun(): Promise<void>;
63
- private schedule;
64
- private drive;
65
- /** Re-arm a polling gate after its poll interval (the in-process analogue of the sweeper). */
66
- private rearmAfterDelay;
109
+ /**
110
+ * (Re)queue a run and kick the drain loop. If a drive is already in flight for it, flag the row
111
+ * for a coalesced re-drive (the finishing driver re-queues it); otherwise force it claimable now
112
+ * (covers a fresh run, an idle run, and waking a deferred gate re-poll early). The `running` set
113
+ * read is race-free: a drive only reaches `settle` synchronously between awaits, with the run
114
+ * still in `running`, so an in-flight run is never misclassified as idle.
115
+ */
116
+ private wake;
117
+ /** Claim and launch drives up to the concurrency cap. Synchronous; each drive re-drains on finish. */
118
+ private drain;
119
+ private driveClaimed;
120
+ /** Re-run the drain loop after `delayMs` (a deferred gate re-poll / error backoff). Unref'd. */
121
+ private scheduleKick;
122
+ /**
123
+ * Fail an evicted run loudly. A run is evicted only after `maxAttempts` CONSECUTIVE drive errors —
124
+ * which (because `driveExecution` funnels every recoverable error into `failRun` itself) means
125
+ * the persistence path kept throwing, e.g. the mothership was unreachable. Mark it `evicted` so
126
+ * it leaves the `running` limbo it would otherwise sit in forever; best-effort, since the same
127
+ * broken persistence may make this `failRun` throw too (logged, not rethrown).
128
+ */
129
+ private failEvicted;
130
+ /**
131
+ * The second leg of pg-boss-style durability (the stale-run sweeper): re-enqueue any run that
132
+ * storage still reports `running` but that has NO queue row — its row was lost, or the enqueue
133
+ * never happened because a prior process died between the storage write and the enqueue. The
134
+ * queue-local recovery (orphan reset + lease reclaim) only covers rows that EXIST; this reconciles
135
+ * the queue against the source of truth. `enqueueIfAbsent` makes it safe: a run already deferred /
136
+ * driving keeps its row untouched. Best-effort — the remote `agentRunRepository` may not yet
137
+ * allow-list `listStale` (mothership gating phase), so a throw is swallowed.
138
+ */
139
+ private reconcileStorage;
67
140
  }
141
+ export {};
68
142
  //# sourceMappingURL=mothership.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mothership.d.ts","sourceRoot":"","sources":["../src/mothership.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAClG,OAAO,EAEL,KAAK,MAAM,EAEZ,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,KAAK,oBAAoB,EAA8B,MAAM,6BAA6B,CAAA;AAUnG,iGAAiG;AACjG,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAEhE;AAaD,0FAA0F;AAC1F,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;OASG;IACH,KAAK,EAAE,gBAAgB,CAAA;IACvB,yFAAyF;IACzF,eAAe,EAAE,oBAAoB,CAAA;IACrC,yDAAyD;IACzD,KAAK,IAAI,IAAI,CAAA;CACd;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,qBAAqB,CAiB/E;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,mBAAoB,YAAW,UAAU;IAMlD,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,GAAG;IANtB,OAAO,CAAC,IAAI,CAAC,CAAsC;IACnD,qGAAqG;IACrG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;IAElE,YACmB,GAAG,EAAE,WAAW,EAChB,GAAG,EAAE,MAAM,EAC1B;IAEJ,kGAAkG;IAClG,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,cAAc,CAA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,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5E;IAEK,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAG/B;IAED;;;;;;OAMG;IACH,OAAO,CAAC,IAAI;IASZ,sGAAsG;IACtG,OAAO,CAAC,KAAK;YAmBC,YAAY;IAyC1B,gGAAgG;IAChG,OAAO,CAAC,YAAY;IAKpB;;;;;;OAMG;YACW,WAAW;IAyBzB;;;;;;;;OAQG;YACW,gBAAgB;CAuB/B"}
@@ -4,6 +4,7 @@ import { mkdirSync } from 'node:fs';
4
4
  import { driveExecution } from '@cat-factory/node-server';
5
5
  import { HttpPersistenceRpcClient, createRemoteRepositoryRegistry, } from '@cat-factory/server';
6
6
  import { createLocalCredentialStore } from './sqlite/credentialStore.js';
7
+ import { SqliteWorkQueue, createWorkQueue } from './sqlite/workQueue.js';
7
8
  // Mothership mode (docs/initiatives/mothership-mode.md): the local node keeps NO main
8
9
  // database. Org/durable state lives on a hosted "mothership" cat-factory (Node or Cloudflare)
9
10
  // and is reached over the authenticated `/internal/persistence` machine API; agent/model
@@ -17,14 +18,24 @@ export function isMothershipMode(env) {
17
18
  }
18
19
  /** Resolve the on-disk path for the local credential SQLite store (`:memory:` honoured for tests). */
19
20
  function credentialDbPath(env) {
20
- const explicit = env.LOCAL_MOTHERSHIP_CREDENTIAL_DB?.trim();
21
- if (explicit)
22
- return explicit;
23
- // Default to a stable per-user file so credentials survive restarts (the whole point of a
24
- // local store). Created under the developer's home dir; ensure the directory exists.
21
+ return localDbPath(env.LOCAL_MOTHERSHIP_CREDENTIAL_DB, 'credentials.sqlite');
22
+ }
23
+ /** Resolve the on-disk path for the durable execution work queue (`:memory:` honoured for tests). */
24
+ function workQueueDbPath(env) {
25
+ return localDbPath(env.LOCAL_MOTHERSHIP_WORK_DB, 'work-queue.sqlite');
26
+ }
27
+ /**
28
+ * Resolve a local SQLite file path: an explicit override wins (incl. `:memory:` for tests), else a
29
+ * stable per-user file under `~/.cat-factory` so the store survives restarts (the whole point of a
30
+ * durable local store). Ensures the directory exists.
31
+ */
32
+ function localDbPath(explicit, fileName) {
33
+ const override = explicit?.trim();
34
+ if (override)
35
+ return override;
25
36
  const dir = join(homedir(), '.cat-factory');
26
37
  mkdirSync(dir, { recursive: true });
27
- return join(dir, 'credentials.sqlite');
38
+ return join(dir, fileName);
28
39
  }
29
40
  /**
30
41
  * Compose the mothership persistence from env. Builds the machine-authed RPC client +
@@ -50,96 +61,242 @@ export function composeMothership(env) {
50
61
  const client = new HttpPersistenceRpcClient({ baseUrl, token });
51
62
  const repos = createRemoteRepositoryRegistry(client);
52
63
  const credentialStore = createLocalCredentialStore(credentialDbPath(env));
53
- return { repos, credentialStore, close: () => credentialStore.close() };
64
+ const workQueue = createWorkQueue(workQueueDbPath(env));
65
+ return {
66
+ repos,
67
+ credentialStore,
68
+ workQueue,
69
+ close: () => {
70
+ credentialStore.close();
71
+ workQueue.close();
72
+ },
73
+ };
54
74
  }
55
75
  /**
56
- * The in-process work runner: the no-Postgres analogue of {@link PgBossWorkRunner}. A
57
- * mothership-mode node has no pg-boss, so it drives runs in this process by calling the SAME
58
- * `driveExecution` advance/poll loop (with real timer-backed sleeps) in the background.
76
+ * The durable SQLite-backed work runner: the no-Postgres analogue of {@link PgBossWorkRunner}. A
77
+ * mothership-mode node has no pg-boss, so it drives runs in this process but unlike PR 1's
78
+ * best-effort in-memory runner, the intent "this run needs driving" is persisted in a local
79
+ * `node:sqlite` {@link SqliteWorkQueue}, so a crash or restart re-drives what was in flight. It
80
+ * mirrors pg-boss's `exclusive` advance queue:
59
81
  *
60
- * It serialises per execution — at most one drive per run at a time so a `signalDecision`
61
- * (or a re-armed human-review gate) that arrives mid-drive coalesces into exactly one
62
- * follow-up drive once the current one returns, mirroring pg-boss's `exclusive` queue
63
- * semantics (one live advance per run, duplicate sends suppressed). The execution service is
64
- * bound after the container is built (it does not exist when the runner is constructed).
82
+ * - one row per run (the queue's PRIMARY KEY) = pg-boss's `singletonKey` dedup;
83
+ * - a `startRun` / `signalDecision` (re)queues the run and kicks the drain loop;
84
+ * - the drain loop claims drivable runs up to `concurrency` and drives each via the SAME
85
+ * `driveExecution` advance/poll loop the Node facade uses (real timer-backed sleeps);
86
+ * - a signal arriving mid-drive coalesces into exactly one follow-up via the row's `rerun` flag;
87
+ * - a re-armed unbounded gate (human review) is deferred for `reArmDelayMs` then re-polled — the
88
+ * in-process analogue of the stale-run sweeper re-enqueuing it. A re-arm is a SUCCESSFUL drive,
89
+ * so it resets the retry budget: an unbounded gate re-arms forever without ever being mistaken
90
+ * for a poison pill;
91
+ * - `maxAttempts` bounds CONSECUTIVE drive FAILURES (not total claims): a poison run is evicted
92
+ * AND failed loudly, while a healthy run that re-arms / coalesces keeps its budget;
93
+ * - a periodic recovery poll + a boot-time orphan reset reclaim runs left `active` by a dead
94
+ * process, and a storage-reconciliation pass re-enqueues any run still `running` in storage that
95
+ * lost its queue row (the two legs of the durability pg-boss gets from Postgres, here from the
96
+ * SQLite file + the `agent_runs` source of truth).
65
97
  *
66
- * NOTE (single process, best effort): unlike pg-boss there is no durable queue or stale-run
67
- * sweeper, so a crash loses in-flight drives acceptable for a single-developer local node,
68
- * and the durable SQLite work queue is PR 2 in the initiative.
98
+ * The execution service is bound after the container is built (it does not exist when the runner is
99
+ * constructed). The `running` set tracks which runs THIS process is driving, so the claim loop and
100
+ * the recovery poll never double-drive an in-flight run.
69
101
  */
70
- export class InProcessWorkRunner {
71
- cfg;
102
+ export class SqliteWorkRunner {
103
+ queue;
104
+ opts;
72
105
  log;
106
+ now;
73
107
  exec;
74
- /** Per-execution state: `running` = a drive is active, `rerun` = another was requested mid-drive. */
75
- inflight = new Map();
76
- constructor(cfg, log) {
77
- this.cfg = cfg;
108
+ staleRuns;
109
+ running = new Set();
110
+ sweepTimer;
111
+ stopped = false;
112
+ constructor(queue, opts, log, now = Date.now) {
113
+ this.queue = queue;
114
+ this.opts = opts;
78
115
  this.log = log;
116
+ this.now = now;
79
117
  }
80
- /** Bind the execution service once the container is built (chicken-and-egg with `createCore`). */
81
- bind(exec) {
118
+ /**
119
+ * Bind the execution service once the container is built, recover any runs orphaned by a previous
120
+ * process, drive what's queued, and start the periodic recovery poll. `staleRuns` (the
121
+ * kind-spanning `agent_runs` reader) enables the storage-reconciliation backstop — re-driving a
122
+ * run that storage reports `running` but that has no queue row at all (its row was lost, or never
123
+ * enqueued because a prior process died). Idempotent: a second call clears the previous sweep
124
+ * timer before re-arming, so it never leaks an interval.
125
+ */
126
+ bind(exec, staleRuns) {
82
127
  this.exec = exec;
128
+ this.staleRuns = staleRuns;
129
+ // Boot recovery: any row left `active` was orphaned when a previous process died (this process
130
+ // drives nothing yet), so reclaim it for an immediate re-drive.
131
+ const orphans = this.queue.resetOrphans();
132
+ if (orphans > 0) {
133
+ this.log.warn({ orphans }, 'mothership work queue: re-driving runs orphaned by a prior process');
134
+ }
135
+ this.drain();
136
+ // Boot-time storage reconciliation: re-enqueue any run `running` in storage with no queue row
137
+ // (the second leg of pg-boss-style durability — the stale-run sweeper). Best-effort.
138
+ void this.reconcileStorage();
139
+ // Backstop for runs whose deferred re-arm / error-backoff kick was lost, or whose lease lapsed:
140
+ // a periodic drain reclaims every queued + lease-expired row, evicts exhausted runs, and
141
+ // reconciles storage orphans. Unref'd so it never holds the process open on its own.
142
+ if (this.sweepTimer)
143
+ clearInterval(this.sweepTimer);
144
+ this.sweepTimer = setInterval(() => {
145
+ this.drain();
146
+ void this.reconcileStorage();
147
+ }, this.opts.sweepIntervalMs);
148
+ this.sweepTimer.unref?.();
149
+ }
150
+ /** Stop the recovery poll (shutdown). In-flight drives are left to finish or die with the process. */
151
+ stop() {
152
+ this.stopped = true;
153
+ if (this.sweepTimer)
154
+ clearInterval(this.sweepTimer);
155
+ this.sweepTimer = undefined;
83
156
  }
84
157
  async startRun(workspaceId, executionId) {
85
- this.schedule(workspaceId, executionId);
158
+ this.wake(workspaceId, executionId);
86
159
  }
87
160
  async signalDecision(workspaceId, executionId) {
88
- // The decision is already persisted (to the mothership); re-drive so the parked run resumes.
89
- this.schedule(workspaceId, executionId);
161
+ // The decision is already persisted (to the mothership); (re)queue so the parked run resumes.
162
+ this.wake(workspaceId, executionId);
90
163
  }
91
164
  async cancelRun() {
92
165
  // Best-effort: the run is finalized via ExecutionService.stopRun; an in-flight drive is a
93
- // no-op once the run is terminal (advanceInstance returns noop).
166
+ // no-op once the run is terminal (advanceInstance returns noop), and its row is settled away.
94
167
  }
95
- schedule(workspaceId, executionId) {
96
- if (this.inflight.has(executionId)) {
97
- // A drive is already running for this run coalesce into one follow-up.
98
- this.inflight.set(executionId, 'rerun');
99
- return;
168
+ /**
169
+ * (Re)queue a run and kick the drain loop. If a drive is already in flight for it, flag the row
170
+ * for a coalesced re-drive (the finishing driver re-queues it); otherwise force it claimable now
171
+ * (covers a fresh run, an idle run, and waking a deferred gate re-poll early). The `running` set
172
+ * read is race-free: a drive only reaches `settle` synchronously between awaits, with the run
173
+ * still in `running`, so an in-flight run is never misclassified as idle.
174
+ */
175
+ wake(workspaceId, executionId) {
176
+ if (this.running.has(executionId)) {
177
+ this.queue.markRerun(executionId);
100
178
  }
101
- this.inflight.set(executionId, 'running');
102
- void this.drive(workspaceId, executionId);
179
+ else {
180
+ this.queue.enqueue(workspaceId, executionId, this.now());
181
+ }
182
+ this.drain();
103
183
  }
104
- async drive(workspaceId, executionId) {
105
- if (!this.exec) {
106
- this.inflight.delete(executionId);
107
- this.log.error({ executionId }, 'in-process work runner driven before bind()');
184
+ /** Claim and launch drives up to the concurrency cap. Synchronous; each drive re-drains on finish. */
185
+ drain() {
186
+ if (!this.exec || this.stopped)
108
187
  return;
188
+ // First reap poison runs (consecutive-failure budget exhausted): delete the row AND fail the
189
+ // run loudly, so it surfaces as a terminal failure instead of silently vanishing from the queue
190
+ // while storage still reports it `running`.
191
+ for (const evicted of this.queue.evictExhausted(this.now(), this.opts.maxAttempts, this.running)) {
192
+ void this.failEvicted(evicted.workspaceId, evicted.executionId, evicted.attempts);
193
+ }
194
+ while (this.running.size < this.opts.concurrency) {
195
+ const job = this.queue.claim(this.now(), this.opts.leaseMs, this.running);
196
+ if (!job)
197
+ break;
198
+ void this.driveClaimed(job.workspaceId, job.executionId);
109
199
  }
200
+ }
201
+ async driveClaimed(workspaceId, executionId) {
202
+ const exec = this.exec;
203
+ if (!exec)
204
+ return;
205
+ this.running.add(executionId);
110
206
  try {
111
- // Loop while a re-run was requested mid-drive (a coalesced signal); single-threaded JS
112
- // makes the read-then-act on `inflight` race-free between awaits.
113
- for (;;) {
114
- this.inflight.set(executionId, 'running');
115
- const outcome = await driveExecution(this.exec, workspaceId, executionId, this.cfg, {
116
- log: this.log,
117
- });
118
- const rerun = this.inflight.get(executionId) === 'rerun';
119
- // A re-armed unbounded-wait gate (human review) released the drive without finishing;
120
- // with no stale-run sweeper here, re-arm it ourselves after the gate's poll interval so
121
- // it polls again rather than stalling. Skip the delayed re-arm when a signal already
122
- // queued an immediate re-drive (`rerun`): looping below covers it, and arming both would
123
- // leave a stray timer that amplifies polling on every gate+signal coincidence.
124
- if (outcome.rearmedGate && !rerun) {
125
- this.rearmAfterDelay(workspaceId, executionId);
126
- }
127
- if (!rerun)
128
- break;
207
+ const outcome = await driveExecution(exec, workspaceId, executionId, this.opts.drive, {
208
+ log: this.log,
209
+ });
210
+ // Shutting down: don't touch the (closing) queue; the in-memory cleanup below still runs.
211
+ if (this.stopped)
212
+ return;
213
+ if (outcome.rearmedGate) {
214
+ // A re-armed unbounded-wait gate (human review) released without finishing — a SUCCESSFUL
215
+ // drive, so it resets the retry budget and is never evicted as poison no matter how long
216
+ // the human takes. If a signal coalesced mid-drive, deferRearm re-queues it NOW (the
217
+ // trailing drain() picks it up); otherwise it holds the run off the queue until the gate's
218
+ // poll interval, then re-polls the in-process analogue of the sweeper re-enqueuing it.
219
+ // The future lease doubles as crash recovery.
220
+ const { requeued } = this.queue.deferRearm(executionId, this.now() + this.opts.reArmDelayMs);
221
+ if (!requeued)
222
+ this.scheduleKick(this.opts.reArmDelayMs);
223
+ }
224
+ else {
225
+ // Standstill (or a coalesced signal): settle deletes the row, or re-queues it for one more
226
+ // drive — the trailing drain() below picks the re-queued run straight back up.
227
+ this.queue.settle(executionId);
129
228
  }
130
229
  }
131
230
  catch (err) {
132
- this.log.error({ workspaceId, executionId, err: err instanceof Error ? err.message : String(err) }, 'in-process execution driver failed');
231
+ if (this.stopped)
232
+ return;
233
+ this.log.error({ workspaceId, executionId, err: err instanceof Error ? err.message : String(err) }, 'mothership in-process execution driver failed');
234
+ // Hold the run for a backoff'd retry, bumping the consecutive-failure count; once it reaches
235
+ // the cap the next drain evicts it (and fails it loudly) rather than re-driving forever.
236
+ this.queue.deferFailure(executionId, this.now() + this.opts.errorBackoffMs);
237
+ this.scheduleKick(this.opts.errorBackoffMs);
133
238
  }
134
239
  finally {
135
- this.inflight.delete(executionId);
240
+ this.running.delete(executionId);
136
241
  }
242
+ // Pick up a coalesced re-drive of this run plus any other queued run a freed slot now allows.
243
+ this.drain();
244
+ }
245
+ /** Re-run the drain loop after `delayMs` (a deferred gate re-poll / error backoff). Unref'd. */
246
+ scheduleKick(delayMs) {
247
+ const timer = setTimeout(() => this.drain(), Math.max(1, delayMs));
248
+ timer.unref?.();
137
249
  }
138
- /** Re-arm a polling gate after its poll interval (the in-process analogue of the sweeper). */
139
- rearmAfterDelay(workspaceId, executionId) {
140
- const delay = Math.max(1000, this.cfg.ciPollIntervalMs);
141
- const timer = setTimeout(() => this.schedule(workspaceId, executionId), delay);
142
- timer.unref?.(); // never keep the process alive on a re-arm timer alone
250
+ /**
251
+ * Fail an evicted run loudly. A run is evicted only after `maxAttempts` CONSECUTIVE drive errors —
252
+ * which (because `driveExecution` funnels every recoverable error into `failRun` itself) means
253
+ * the persistence path kept throwing, e.g. the mothership was unreachable. Mark it `evicted` so
254
+ * it leaves the `running` limbo it would otherwise sit in forever; best-effort, since the same
255
+ * broken persistence may make this `failRun` throw too (logged, not rethrown).
256
+ */
257
+ async failEvicted(workspaceId, executionId, attempts) {
258
+ this.log.error({ workspaceId, executionId, attempts }, 'mothership work queue: evicting run after repeated drive failures');
259
+ try {
260
+ await this.exec?.failRun(workspaceId, executionId, `Execution driver failed ${attempts} times in a row; giving up.`, 'evicted', null);
261
+ }
262
+ catch (err) {
263
+ this.log.error({ workspaceId, executionId, err: err instanceof Error ? err.message : String(err) }, 'mothership work queue: failed to mark an evicted run failed');
264
+ }
265
+ }
266
+ /**
267
+ * The second leg of pg-boss-style durability (the stale-run sweeper): re-enqueue any run that
268
+ * storage still reports `running` but that has NO queue row — its row was lost, or the enqueue
269
+ * never happened because a prior process died between the storage write and the enqueue. The
270
+ * queue-local recovery (orphan reset + lease reclaim) only covers rows that EXIST; this reconciles
271
+ * the queue against the source of truth. `enqueueIfAbsent` makes it safe: a run already deferred /
272
+ * driving keeps its row untouched. Best-effort — the remote `agentRunRepository` may not yet
273
+ * allow-list `listStale` (mothership gating phase), so a throw is swallowed.
274
+ */
275
+ async reconcileStorage() {
276
+ if (!this.staleRuns || this.stopped)
277
+ return;
278
+ let recovered = 0;
279
+ try {
280
+ const stale = await this.staleRuns.listStale(this.now() - this.opts.leaseMs);
281
+ if (this.stopped)
282
+ return;
283
+ for (const ref of stale) {
284
+ if (ref.kind !== 'execution')
285
+ continue;
286
+ if (this.running.has(ref.id))
287
+ continue;
288
+ if (this.queue.enqueueIfAbsent(ref.workspaceId, ref.id, this.now()))
289
+ recovered++;
290
+ }
291
+ }
292
+ catch {
293
+ // listStale not reachable / not allow-listed yet — the backstop is best-effort.
294
+ return;
295
+ }
296
+ if (recovered > 0) {
297
+ this.log.warn({ recovered }, 'mothership work queue: re-enqueued runs still running in storage with no queue row');
298
+ this.drain();
299
+ }
143
300
  }
144
301
  }
145
302
  //# sourceMappingURL=mothership.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mothership.js","sourceRoot":"","sources":["../src/mothership.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MA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AC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC5E,IAAI,IAAI,CAAC,OAAO;gBAAE,OAAM;YACxB,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACxB,IAAI,GAAG,CAAC,IAAI,KAAK,WAAW;oBAAE,SAAQ;gBACtC,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAAE,SAAQ;gBACtC,IAAI,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC;oBAAE,SAAS,EAAE,CAAA;YAClF,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,gFAAgF;YAChF,OAAM;QACR,CAAC;QACD,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,IAAI,CACX,EAAE,SAAS,EAAE,EACb,oFAAoF,CACrF,CAAA;YACD,IAAI,CAAC,KAAK,EAAE,CAAA;QACd,CAAC;IACH,CAAC;CACF"}
package/dist/server.js CHANGED
@@ -75,8 +75,10 @@ export async function startLocal(options = {}) {
75
75
  *
76
76
  * The periodic Postgres-backed sweepers the Node `start()` runs (retention, recurring-pipeline
77
77
  * fire, notification escalation, Kaizen) are intentionally NOT started here: they prune/scan
78
- * stores that live on the mothership (its own cron owns them), and the durable SQLite work
79
- * queue + telemetry sync are later initiative slices (PR 2 / PR 5).
78
+ * stores that live on the mothership (its own cron owns them). Durable execution IS now provided
79
+ * locally the container's work runner is backed by a file-based `node:sqlite` work queue (the
80
+ * no-pg-boss analogue), so a crash/restart re-drives in-flight runs; telemetry local-first sync
81
+ * remains a later initiative slice (PR 5).
80
82
  */
81
83
  async function startLocalMothership(env, host) {
82
84
  logger.info({ mothership: env.LOCAL_MOTHERSHIP_URL }, 'local mode: booting in MOTHERSHIP mode (no local Postgres; org state served remotely)');
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE5E,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAA;AAEzC,kFAAkF;AAClF,qFAAqF;AACrF,mFAAmF;AACnF,+EAA+E;AAC/E,gFAAgF;AAChF,kFAAkF;AAClF,uBAAuB;AACvB,EAAE;AACF,mFAAmF;AACnF,sFAAsF;AACtF,yFAAyF;AACzF,0FAA0F;AAC1F,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAO,GAGH,EAAE;IAEN,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAA;IAEtC,qFAAqF;IACrF,kFAAkF;IAClF,qFAAqF;IACrF,uFAAuF;IACvF,mFAAmF;IACnF,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAEzC,sFAAsF;IACtF,uFAAuF;IACvF,qFAAqF;IACrF,MAAM,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,CAAC,SAAS,CAAC,CAAA;IAC/C,MAAM,CAAC,IAAI,CACT;QACE,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;QACpC,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS;QACzC,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,SAAS,CAAC,UAAU;KAChC,EACD,wCAAwC,CACzC,CAAA;IACD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC;QACpC,MAAM,CAAC,IAAI,CACT,oBAAoB,gBAAgB,CAAC,SAAS,CAAC,0CAA0C;YACvF,gFAAgF;YAChF,qFAAqF;YACrF,wDAAwD,CAC3D,CAAA;IACH,CAAC;IACD,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IACzE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CACT,EAAE,GAAG,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,EACjF,8BAA8B,OAAO,CAAC,MAAM,2CAA2C;YACrF,kFAAkF;YAClF,2BAA2B,CAC9B,CAAA;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { DatabaseSync } from 'node:sqlite';
2
+ /** Open (creating if absent) the work-queue SQLite database and ensure its schema. */
3
+ export declare function openWorkQueueDb(path: string): DatabaseSync;
4
+ /**
5
+ * A run claimed for driving. `attempts` is the run's CONSECUTIVE-failure count at claim time (0 for
6
+ * a healthy run); claiming does not change it — only an errored drive (`deferFailure`) does.
7
+ */
8
+ export interface ClaimedRun {
9
+ workspaceId: string;
10
+ executionId: string;
11
+ attempts: number;
12
+ }
13
+ /** A run evicted by {@link SqliteWorkQueue.evictExhausted} (its retry budget was exhausted). */
14
+ export interface EvictedRun {
15
+ workspaceId: string;
16
+ executionId: string;
17
+ attempts: number;
18
+ }
19
+ /**
20
+ * The durable SQLite-backed execution queue. All methods are synchronous (`node:sqlite`); the
21
+ * runner wraps them in the `WorkRunner` async surface. The class is pure persistence — no timers,
22
+ * no driving — so it can be unit-tested against an in-memory database.
23
+ */
24
+ export declare class SqliteWorkQueue {
25
+ private readonly db;
26
+ constructor(db: DatabaseSync);
27
+ /**
28
+ * (Re)queue a run so it is claimable now. New → a `queued` row; on conflict the row is forced
29
+ * back to `queued` with its lease cleared (so an idle, or a deferred gate-repoll, row becomes
30
+ * immediately drivable). `attempts` is preserved so a run's retry budget survives a re-trigger.
31
+ *
32
+ * The caller (`SqliteWorkRunner`) only calls this for a run it knows is NOT being driven in this
33
+ * process; a signal that arrives mid-drive goes through {@link markRerun} instead, so this never
34
+ * disturbs a genuinely in-flight drive's row.
35
+ */
36
+ enqueue(workspaceId: string, executionId: string, now: number): void;
37
+ /**
38
+ * Insert a fresh `queued` row ONLY if the run has no row at all (`ON CONFLICT DO NOTHING`), and
39
+ * report whether a row was created. The storage-reconciliation backstop uses this: it re-enqueues
40
+ * a run that storage still reports `running` but that has NO queue entry (its row was lost, or the
41
+ * enqueue never happened because a previous process died between the storage write and the
42
+ * enqueue). Crucially it must NOT disturb a run that already has a row — a genuinely deferred gate
43
+ * re-poll / error backoff is `running` in storage too, and forcing it back to `queued` would yank
44
+ * it out of its wait. Returns true when a row was inserted (a real orphan was recovered).
45
+ */
46
+ enqueueIfAbsent(workspaceId: string, executionId: string, now: number): boolean;
47
+ /**
48
+ * Flag an in-flight drive so the finishing driver re-queues the run exactly once (the coalescing
49
+ * the in-memory runner did with its `rerun` map). Only ever called while the run's row is
50
+ * `active`; returns true if it matched (it always does under that invariant — kept as a guard).
51
+ */
52
+ markRerun(executionId: string): boolean;
53
+ /**
54
+ * Reset every `active` row to `queued`. Boot recovery: a freshly started process drives nothing
55
+ * yet, so any row left `active` was orphaned when a previous process died — reclaim it for an
56
+ * immediate re-drive (the durable analogue of pg-boss retrying a crashed worker's job). Returns
57
+ * how many runs were recovered.
58
+ */
59
+ resetOrphans(): number;
60
+ /**
61
+ * Claim the oldest drivable run, or null if none. Drivable = `queued`, or `active` whose lease
62
+ * has expired (a drive orphaned by a crash, recovered once the lease lapses). Runs in `exclude`
63
+ * (being driven in THIS process) are skipped. The claim marks the row `active` with a fresh lease
64
+ * (so it is non-claimable again the instant this returns) but does NOT touch `attempts` — the
65
+ * retry budget tracks consecutive FAILURES, not claims, so eviction is the separate
66
+ * {@link evictExhausted} pass the runner makes before claiming.
67
+ */
68
+ claim(now: number, leaseMs: number, exclude: ReadonlySet<string>): ClaimedRun | null;
69
+ /**
70
+ * Evict every drivable run whose CONSECUTIVE-failure count has reached `maxAttempts` (a poison
71
+ * pill — repeated drive failures, the analogue of pg-boss dead-lettering after `retryLimit`). The
72
+ * row is deleted and returned so the runner can fail the run loudly (a notification / `failRun`)
73
+ * instead of leaving it silently stuck `running` in storage. Only considers drivable rows
74
+ * (`queued` or lease-expired `active`) and skips `exclude` (a run being driven right now), so it
75
+ * never reaps a healthy in-flight drive. Runs before the claim pass on each drain.
76
+ */
77
+ evictExhausted(now: number, maxAttempts: number, exclude: ReadonlySet<string>): EvictedRun[];
78
+ /**
79
+ * Settle a SUCCESSFUL drive that reached a standstill: if a signal arrived mid-drive (`rerun`),
80
+ * re-queue the run for one more drive and report `requeued: true`; otherwise delete its row. Both
81
+ * are success outcomes, so `attempts` is reset to 0 — the run cleared its work, so its retry
82
+ * budget starts fresh.
83
+ */
84
+ settle(executionId: string): {
85
+ requeued: boolean;
86
+ };
87
+ /**
88
+ * Settle a re-armed unbounded gate (human review): the drive SUCCEEDED but the gate needs another
89
+ * poll cycle. If a signal coalesced mid-drive (`rerun`), re-queue the run immediately (drivable
90
+ * now, `requeued: true`) so the new decision is acted on without waiting out the gate interval;
91
+ * otherwise hold it `active` with a future lease until `notBefore`, then re-poll. Either way
92
+ * `attempts` resets to 0 — a re-arm is a healthy drive, NOT a failure, so it never counts toward
93
+ * the poison-pill budget (an unbounded gate re-arms indefinitely). The future lease doubles as
94
+ * crash recovery: if the process dies during the wait, the lease lapses and the run is reclaimed.
95
+ */
96
+ deferRearm(executionId: string, notBefore: number): {
97
+ requeued: boolean;
98
+ };
99
+ /**
100
+ * Hold a run that ERRORED off the claim queue until `notBefore` (a backoff before retrying),
101
+ * bumping `attempts` so a genuinely poison run is evicted once it reaches the cap. The lease
102
+ * doubles as crash recovery: if the process dies during the backoff, the lease lapses and the run
103
+ * is reclaimed. This is the ONLY method that grows the retry budget.
104
+ */
105
+ deferFailure(executionId: string, notBefore: number): void;
106
+ /** Count rows, optionally filtered by state (for tests / observability). */
107
+ size(state?: 'queued' | 'active'): number;
108
+ close(): void;
109
+ }
110
+ /** Open the work queue at `path` (a file under the developer's config dir, or `:memory:` in tests). */
111
+ export declare function createWorkQueue(path: string): SqliteWorkQueue;
112
+ //# sourceMappingURL=workQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workQueue.d.ts","sourceRoot":"","sources":["../../src/sqlite/workQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA4C1C,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAQ1D;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,gGAAgG;AAChG,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAQD;;;;GAIG;AACH,qBAAa,eAAe;IACd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AAM,GAAG,eAAe,CAE7D"}
@@ -0,0 +1,259 @@
1
+ import { DatabaseSync } from 'node:sqlite';
2
+ // The mothership-mode DURABLE execution work queue.
3
+ //
4
+ // A mothership-mode local node has no Postgres and therefore no pg-boss, so it cannot use the
5
+ // Node facade's `PgBossWorkRunner`. PR 1 shipped a best-effort `InProcessWorkRunner` whose
6
+ // "queue" lived only in memory — a crash or restart lost every in-flight drive, and there was
7
+ // no stale-run recovery (the NOTE that runner carried). This module is the durable replacement
8
+ // (initiative PR 2): a file-based `node:sqlite` queue that persists the intent "this run needs
9
+ // driving", so a restart re-drives what was in flight, mirroring the durability pg-boss gives the
10
+ // Node facade. It belongs to the local-sqlite bucket (docs/initiatives/mothership-mode.md) — a
11
+ // local-facade-only differentiator with no cross-runtime symmetry obligation.
12
+ //
13
+ // `node:sqlite`'s `DatabaseSync` is synchronous and single-process, so every method here runs to
14
+ // completion with no other JavaScript interleaving — a select-then-update is inherently atomic,
15
+ // which is exactly the property pg-boss buys with row locks. The semantics mirror pg-boss's
16
+ // `exclusive` advance queue:
17
+ // - `execution_id` is the PRIMARY KEY, so there is at most one row per run — the equivalent of
18
+ // pg-boss's `singletonKey` dedup (a re-enqueue for a run already queued is a no-op).
19
+ // - a row is `queued` (needs a drive, free to claim) or `active` (being driven; `lease_until`
20
+ // is the crash-detection deadline). `rerun` records that a signal arrived mid-drive so the
21
+ // finishing driver re-queues exactly once (coalescing), like the in-memory runner did.
22
+ // - `attempts` counts CONSECUTIVE FAILED drives (the retry budget) — NOT the number of times a
23
+ // run was driven. A successful drive (a standstill, a coalesced re-queue, or an unbounded-gate
24
+ // re-arm) resets it to 0; only an errored drive bumps it (`deferFailure`). So a run that
25
+ // re-arms or coalesces signals forever is never mistaken for a poison pill — eviction
26
+ // (`evictExhausted`) fires ONLY on genuinely repeated failures, the analogue of pg-boss
27
+ // dead-lettering a job after `retryLimit` consecutive failures (a re-armed gate, which pg-boss
28
+ // completes successfully and re-enqueues fresh, likewise keeps its budget intact here).
29
+ const SCHEMA = `
30
+ CREATE TABLE IF NOT EXISTS execution_work_queue (
31
+ execution_id TEXT PRIMARY KEY,
32
+ workspace_id TEXT NOT NULL,
33
+ state TEXT NOT NULL,
34
+ rerun INTEGER NOT NULL DEFAULT 0,
35
+ lease_until INTEGER NOT NULL DEFAULT 0,
36
+ attempts INTEGER NOT NULL DEFAULT 0,
37
+ enqueued_at INTEGER NOT NULL
38
+ );
39
+ CREATE INDEX IF NOT EXISTS execution_work_queue_claimable
40
+ ON execution_work_queue (state, lease_until, enqueued_at);
41
+ `;
42
+ /** Open (creating if absent) the work-queue SQLite database and ensure its schema. */
43
+ export function openWorkQueueDb(path) {
44
+ const db = new DatabaseSync(path);
45
+ // Mirror the credential store's pragmas: WAL keeps the single writer from blocking readers,
46
+ // and the busy timeout absorbs a brief lock instead of throwing SQLITE_BUSY.
47
+ db.exec('PRAGMA journal_mode = WAL');
48
+ db.exec('PRAGMA busy_timeout = 5000');
49
+ db.exec(SCHEMA);
50
+ return db;
51
+ }
52
+ /**
53
+ * The durable SQLite-backed execution queue. All methods are synchronous (`node:sqlite`); the
54
+ * runner wraps them in the `WorkRunner` async surface. The class is pure persistence — no timers,
55
+ * no driving — so it can be unit-tested against an in-memory database.
56
+ */
57
+ export class SqliteWorkQueue {
58
+ db;
59
+ constructor(db) {
60
+ this.db = db;
61
+ }
62
+ /**
63
+ * (Re)queue a run so it is claimable now. New → a `queued` row; on conflict the row is forced
64
+ * back to `queued` with its lease cleared (so an idle, or a deferred gate-repoll, row becomes
65
+ * immediately drivable). `attempts` is preserved so a run's retry budget survives a re-trigger.
66
+ *
67
+ * The caller (`SqliteWorkRunner`) only calls this for a run it knows is NOT being driven in this
68
+ * process; a signal that arrives mid-drive goes through {@link markRerun} instead, so this never
69
+ * disturbs a genuinely in-flight drive's row.
70
+ */
71
+ enqueue(workspaceId, executionId, now) {
72
+ this.db
73
+ .prepare(`INSERT INTO execution_work_queue
74
+ (execution_id, workspace_id, state, rerun, lease_until, attempts, enqueued_at)
75
+ VALUES (?, ?, 'queued', 0, 0, 0, ?)
76
+ ON CONFLICT(execution_id) DO UPDATE SET
77
+ state = 'queued',
78
+ rerun = 0,
79
+ lease_until = 0`)
80
+ .run(executionId, workspaceId, now);
81
+ }
82
+ /**
83
+ * Insert a fresh `queued` row ONLY if the run has no row at all (`ON CONFLICT DO NOTHING`), and
84
+ * report whether a row was created. The storage-reconciliation backstop uses this: it re-enqueues
85
+ * a run that storage still reports `running` but that has NO queue entry (its row was lost, or the
86
+ * enqueue never happened because a previous process died between the storage write and the
87
+ * enqueue). Crucially it must NOT disturb a run that already has a row — a genuinely deferred gate
88
+ * re-poll / error backoff is `running` in storage too, and forcing it back to `queued` would yank
89
+ * it out of its wait. Returns true when a row was inserted (a real orphan was recovered).
90
+ */
91
+ enqueueIfAbsent(workspaceId, executionId, now) {
92
+ const res = this.db
93
+ .prepare(`INSERT INTO execution_work_queue
94
+ (execution_id, workspace_id, state, rerun, lease_until, attempts, enqueued_at)
95
+ VALUES (?, ?, 'queued', 0, 0, 0, ?)
96
+ ON CONFLICT(execution_id) DO NOTHING`)
97
+ .run(executionId, workspaceId, now);
98
+ return Number(res.changes) > 0;
99
+ }
100
+ /**
101
+ * Flag an in-flight drive so the finishing driver re-queues the run exactly once (the coalescing
102
+ * the in-memory runner did with its `rerun` map). Only ever called while the run's row is
103
+ * `active`; returns true if it matched (it always does under that invariant — kept as a guard).
104
+ */
105
+ markRerun(executionId) {
106
+ const res = this.db
107
+ .prepare(`UPDATE execution_work_queue SET rerun = 1 WHERE execution_id = ? AND state = 'active'`)
108
+ .run(executionId);
109
+ return Number(res.changes) > 0;
110
+ }
111
+ /**
112
+ * Reset every `active` row to `queued`. Boot recovery: a freshly started process drives nothing
113
+ * yet, so any row left `active` was orphaned when a previous process died — reclaim it for an
114
+ * immediate re-drive (the durable analogue of pg-boss retrying a crashed worker's job). Returns
115
+ * how many runs were recovered.
116
+ */
117
+ resetOrphans() {
118
+ const res = this.db
119
+ .prepare(`UPDATE execution_work_queue SET state = 'queued', lease_until = 0 WHERE state = 'active'`)
120
+ .run();
121
+ return Number(res.changes);
122
+ }
123
+ /**
124
+ * Claim the oldest drivable run, or null if none. Drivable = `queued`, or `active` whose lease
125
+ * has expired (a drive orphaned by a crash, recovered once the lease lapses). Runs in `exclude`
126
+ * (being driven in THIS process) are skipped. The claim marks the row `active` with a fresh lease
127
+ * (so it is non-claimable again the instant this returns) but does NOT touch `attempts` — the
128
+ * retry budget tracks consecutive FAILURES, not claims, so eviction is the separate
129
+ * {@link evictExhausted} pass the runner makes before claiming.
130
+ */
131
+ claim(now, leaseMs, exclude) {
132
+ const rows = this.db
133
+ .prepare(`SELECT execution_id, workspace_id, attempts FROM execution_work_queue
134
+ WHERE state = 'queued' OR (state = 'active' AND lease_until <= ?)
135
+ ORDER BY enqueued_at ASC`)
136
+ .all(now);
137
+ for (const row of rows) {
138
+ if (exclude.has(row.execution_id))
139
+ continue;
140
+ this.db
141
+ .prepare(`UPDATE execution_work_queue
142
+ SET state = 'active', rerun = 0, lease_until = ?
143
+ WHERE execution_id = ?`)
144
+ .run(now + leaseMs, row.execution_id);
145
+ return {
146
+ workspaceId: row.workspace_id,
147
+ executionId: row.execution_id,
148
+ attempts: row.attempts,
149
+ };
150
+ }
151
+ return null;
152
+ }
153
+ /**
154
+ * Evict every drivable run whose CONSECUTIVE-failure count has reached `maxAttempts` (a poison
155
+ * pill — repeated drive failures, the analogue of pg-boss dead-lettering after `retryLimit`). The
156
+ * row is deleted and returned so the runner can fail the run loudly (a notification / `failRun`)
157
+ * instead of leaving it silently stuck `running` in storage. Only considers drivable rows
158
+ * (`queued` or lease-expired `active`) and skips `exclude` (a run being driven right now), so it
159
+ * never reaps a healthy in-flight drive. Runs before the claim pass on each drain.
160
+ */
161
+ evictExhausted(now, maxAttempts, exclude) {
162
+ const rows = this.db
163
+ .prepare(`SELECT execution_id, workspace_id, attempts FROM execution_work_queue
164
+ WHERE (state = 'queued' OR (state = 'active' AND lease_until <= ?)) AND attempts >= ?
165
+ ORDER BY enqueued_at ASC`)
166
+ .all(now, maxAttempts);
167
+ const evicted = [];
168
+ for (const row of rows) {
169
+ if (exclude.has(row.execution_id))
170
+ continue;
171
+ this.db
172
+ .prepare('DELETE FROM execution_work_queue WHERE execution_id = ?')
173
+ .run(row.execution_id);
174
+ evicted.push({
175
+ workspaceId: row.workspace_id,
176
+ executionId: row.execution_id,
177
+ attempts: row.attempts,
178
+ });
179
+ }
180
+ return evicted;
181
+ }
182
+ /**
183
+ * Settle a SUCCESSFUL drive that reached a standstill: if a signal arrived mid-drive (`rerun`),
184
+ * re-queue the run for one more drive and report `requeued: true`; otherwise delete its row. Both
185
+ * are success outcomes, so `attempts` is reset to 0 — the run cleared its work, so its retry
186
+ * budget starts fresh.
187
+ */
188
+ settle(executionId) {
189
+ const row = this.db
190
+ .prepare('SELECT rerun FROM execution_work_queue WHERE execution_id = ?')
191
+ .get(executionId);
192
+ if (row && row.rerun) {
193
+ this.db
194
+ .prepare(`UPDATE execution_work_queue
195
+ SET state = 'queued', rerun = 0, lease_until = 0, attempts = 0
196
+ WHERE execution_id = ?`)
197
+ .run(executionId);
198
+ return { requeued: true };
199
+ }
200
+ this.db.prepare('DELETE FROM execution_work_queue WHERE execution_id = ?').run(executionId);
201
+ return { requeued: false };
202
+ }
203
+ /**
204
+ * Settle a re-armed unbounded gate (human review): the drive SUCCEEDED but the gate needs another
205
+ * poll cycle. If a signal coalesced mid-drive (`rerun`), re-queue the run immediately (drivable
206
+ * now, `requeued: true`) so the new decision is acted on without waiting out the gate interval;
207
+ * otherwise hold it `active` with a future lease until `notBefore`, then re-poll. Either way
208
+ * `attempts` resets to 0 — a re-arm is a healthy drive, NOT a failure, so it never counts toward
209
+ * the poison-pill budget (an unbounded gate re-arms indefinitely). The future lease doubles as
210
+ * crash recovery: if the process dies during the wait, the lease lapses and the run is reclaimed.
211
+ */
212
+ deferRearm(executionId, notBefore) {
213
+ const row = this.db
214
+ .prepare('SELECT rerun FROM execution_work_queue WHERE execution_id = ?')
215
+ .get(executionId);
216
+ if (row && row.rerun) {
217
+ this.db
218
+ .prepare(`UPDATE execution_work_queue
219
+ SET state = 'queued', rerun = 0, lease_until = 0, attempts = 0
220
+ WHERE execution_id = ?`)
221
+ .run(executionId);
222
+ return { requeued: true };
223
+ }
224
+ this.db
225
+ .prepare(`UPDATE execution_work_queue
226
+ SET state = 'active', rerun = 0, lease_until = ?, attempts = 0
227
+ WHERE execution_id = ?`)
228
+ .run(notBefore, executionId);
229
+ return { requeued: false };
230
+ }
231
+ /**
232
+ * Hold a run that ERRORED off the claim queue until `notBefore` (a backoff before retrying),
233
+ * bumping `attempts` so a genuinely poison run is evicted once it reaches the cap. The lease
234
+ * doubles as crash recovery: if the process dies during the backoff, the lease lapses and the run
235
+ * is reclaimed. This is the ONLY method that grows the retry budget.
236
+ */
237
+ deferFailure(executionId, notBefore) {
238
+ this.db
239
+ .prepare(`UPDATE execution_work_queue
240
+ SET state = 'active', rerun = 0, lease_until = ?, attempts = attempts + 1
241
+ WHERE execution_id = ?`)
242
+ .run(notBefore, executionId);
243
+ }
244
+ /** Count rows, optionally filtered by state (for tests / observability). */
245
+ size(state) {
246
+ const row = state
247
+ ? this.db.prepare('SELECT COUNT(*) AS n FROM execution_work_queue WHERE state = ?').get(state)
248
+ : this.db.prepare('SELECT COUNT(*) AS n FROM execution_work_queue').get();
249
+ return Number(row.n);
250
+ }
251
+ close() {
252
+ this.db.close();
253
+ }
254
+ }
255
+ /** Open the work queue at `path` (a file under the developer's config dir, or `:memory:` in tests). */
256
+ export function createWorkQueue(path) {
257
+ return new SqliteWorkQueue(openWorkQueueDb(path));
258
+ }
259
+ //# sourceMappingURL=workQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workQueue.js","sourceRoot":"","sources":["../../src/sqlite/workQueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,oDAAoD;AACpD,E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E,GAAG,CAAC,WAAW,CAAkC,CAAA;QACpD,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,EAAE;iBACJ,OAAO,CACN;;kCAEwB,CACzB;iBACA,GAAG,CAAC,WAAW,CAAC,CAAA;YACnB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;QAC3B,CAAC;QACD,IAAI,CAAC,EAAE;aACJ,OAAO,CACN;;gCAEwB,CACzB;aACA,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;QAC9B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC5B,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,WAAmB,EAAE,SAAiB;QACjD,IAAI,CAAC,EAAE;aACJ,OAAO,CACN;;gCAEwB,CACzB;aACA,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IAChC,CAAC;IAED,4EAA4E;IAC5E,IAAI,CAAC,KAA2B;QAC9B,MAAM,GAAG,GAAG,KAAK;YACf,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,gEAAgE,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC;YAC9F,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,gDAAgD,CAAC,CAAC,GAAG,EAAE,CAAA;QAC3E,OAAO,MAAM,CAAE,GAAqB,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;IACjB,CAAC;CACF;AAED,uGAAuG;AACvG,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAA;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/local-server",
3
- "version": "0.32.3",
3
+ "version": "0.33.1",
4
4
  "description": "Local-mode runtime facade for the Agent Architecture Board: the @cat-factory/node-server stack with agent jobs run as local Docker/Podman containers and GitHub accessed via a personal access token — a developer can run the whole product on their own machine.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,17 +29,17 @@
29
29
  "@cat-factory/agents": "0.24.10",
30
30
  "@cat-factory/contracts": "0.70.1",
31
31
  "@cat-factory/gitlab": "0.4.21",
32
- "@cat-factory/integrations": "0.48.2",
32
+ "@cat-factory/integrations": "0.49.0",
33
33
  "@cat-factory/kernel": "0.63.2",
34
- "@cat-factory/node-server": "0.53.3",
35
- "@cat-factory/orchestration": "0.51.3",
36
- "@cat-factory/server": "0.59.2"
34
+ "@cat-factory/node-server": "0.53.4",
35
+ "@cat-factory/orchestration": "0.51.4",
36
+ "@cat-factory/server": "0.60.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26.0.1",
40
40
  "typescript": "7.0.1-rc",
41
41
  "vitest": "^4.1.9",
42
- "@cat-factory/conformance": "0.9.63",
42
+ "@cat-factory/conformance": "0.9.64",
43
43
  "@cat-factory/gates": "0.2.51"
44
44
  },
45
45
  "scripts": {