@vellumai/assistant 0.10.8-dev.202607130516.157ae8a → 0.10.8-dev.202607131107.073396f

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 (41) hide show
  1. package/openapi.yaml +7 -63
  2. package/package.json +1 -1
  3. package/src/__tests__/memory-jobs-worker-backoff.test.ts +4 -6
  4. package/src/__tests__/plugin-import-boundary-guard.test.ts +3 -1
  5. package/src/__tests__/plugin-import-boundary-reverse-guard.test.ts +0 -1
  6. package/src/__tests__/{scheduler-worker-standdown.test.ts → run-due-schedules.test.ts} +5 -55
  7. package/src/__tests__/schedule-retry.test.ts +22 -15
  8. package/src/__tests__/scheduler-recurrence.test.ts +15 -23
  9. package/src/__tests__/scheduler-reuse-conversation.test.ts +19 -27
  10. package/src/__tests__/scheduler-wake.test.ts +8 -16
  11. package/src/background-wake/background-wake-routes.test.ts +2 -3
  12. package/src/cli/commands/memory/__tests__/worker.test.ts +8 -5
  13. package/src/cli/commands/memory/index.help.ts +7 -10
  14. package/src/cli/commands/memory/worker.ts +29 -39
  15. package/src/cli/commands/schedules-worker.ts +10 -43
  16. package/src/cli/commands/schedules.help.ts +8 -13
  17. package/src/config/schema.ts +0 -2
  18. package/src/config/schemas/memory-lifecycle.ts +0 -12
  19. package/src/config/schemas/memory.ts +0 -4
  20. package/src/daemon/shutdown-handlers.ts +3 -16
  21. package/src/plugins/defaults/memory/__tests__/shutdown-hook.test.ts +8 -7
  22. package/src/{persistence → plugins/defaults/memory}/__tests__/worker-control.test.ts +8 -10
  23. package/src/plugins/defaults/memory/hooks/shutdown.ts +8 -11
  24. package/src/plugins/defaults/memory/jobs-worker.ts +28 -101
  25. package/src/plugins/defaults/memory/paths.ts +3 -2
  26. package/src/plugins/defaults/memory/routes/__tests__/memory-worker-routes.test.ts +201 -0
  27. package/src/plugins/defaults/memory/routes/memory-worker-routes.ts +162 -0
  28. package/src/plugins/defaults/memory/startup.ts +6 -7
  29. package/src/{persistence → plugins/defaults/memory}/worker-control.ts +12 -21
  30. package/src/plugins/defaults/memory/worker.ts +2 -2
  31. package/src/runtime/routes/__tests__/schedule-worker-routes.test.ts +16 -66
  32. package/src/runtime/routes/background-wake-routes.ts +0 -1
  33. package/src/runtime/routes/index.ts +1 -1
  34. package/src/runtime/routes/schedule-worker-routes.ts +16 -84
  35. package/src/schedule/__tests__/worker-control.test.ts +3 -3
  36. package/src/schedule/scheduler.ts +21 -66
  37. package/src/schedule/worker-control.ts +11 -21
  38. package/src/schedule/worker.ts +3 -4
  39. package/src/config/schemas/schedules.ts +0 -35
  40. package/src/runtime/routes/__tests__/memory-worker-routes.test.ts +0 -318
  41. package/src/runtime/routes/memory-worker-routes.ts +0 -227
@@ -95,23 +95,15 @@ mock.module("../daemon/process-message.js", () => ({
95
95
  processMessageImpl(conversationId, message),
96
96
  }));
97
97
 
98
- import { loadRawConfig, saveRawConfig } from "../config/loader.js";
99
98
  import { deleteConversation } from "../persistence/conversation-crud.js";
100
99
  import { getDb } from "../persistence/db-connection.js";
101
100
  import { initializeDb } from "../persistence/db-init.js";
102
101
  import { assistantEventHub } from "../runtime/assistant-event-hub.js";
103
102
  import { createSchedule, getScheduleRuns } from "../schedule/schedule-store.js";
104
- import { runScheduleDueWorkOnce } from "../schedule/scheduler.js";
103
+ import { runDueSchedulesOnce } from "../schedule/scheduler.js";
105
104
 
106
105
  await initializeDb();
107
106
 
108
- // The schedule worker is on by default, which stands the daemon's in-process
109
- // scheduler down. These tests exercise that in-process execution path directly,
110
- // so pin the worker flag off for this test process.
111
- const rawConfig = loadRawConfig();
112
- rawConfig.schedules = { worker: { enabled: false } };
113
- saveRawConfig(rawConfig);
114
-
115
107
  /** Access the underlying bun:sqlite Database for raw parameterized queries. */
116
108
  function getRawDb(): import("bun:sqlite").Database {
117
109
  return (getDb() as unknown as { $client: import("bun:sqlite").Database })
@@ -173,7 +165,7 @@ describe("scheduler conversation reuse", () => {
173
165
  // WHEN the schedule fires for the first time
174
166
  forceScheduleDue(schedule.id);
175
167
 
176
- await runScheduleDueWorkOnce();
168
+ await runDueSchedulesOnce();
177
169
 
178
170
  // THEN a conversation is created and recorded
179
171
  expect(processedMessages).toHaveLength(1);
@@ -190,7 +182,7 @@ describe("scheduler conversation reuse", () => {
190
182
  forceScheduleDue(schedule.id);
191
183
  processedMessages.length = 0;
192
184
 
193
- await runScheduleDueWorkOnce();
185
+ await runDueSchedulesOnce();
194
186
 
195
187
  // THEN the same conversation is reused
196
188
  expect(processedMessages).toHaveLength(1);
@@ -225,7 +217,7 @@ describe("scheduler conversation reuse", () => {
225
217
  // WHEN the schedule fires for the first time
226
218
  forceScheduleDue(schedule.id);
227
219
 
228
- await runScheduleDueWorkOnce();
220
+ await runDueSchedulesOnce();
229
221
 
230
222
  expect(processedMessages).toHaveLength(1);
231
223
  const firstConversationId = processedMessages[0].conversationId;
@@ -235,7 +227,7 @@ describe("scheduler conversation reuse", () => {
235
227
  forceScheduleDue(schedule.id);
236
228
  processedMessages.length = 0;
237
229
 
238
- await runScheduleDueWorkOnce();
230
+ await runDueSchedulesOnce();
239
231
 
240
232
  // THEN a fresh conversation is created instead of reusing the first
241
233
  expect(processedMessages).toHaveLength(1);
@@ -261,7 +253,7 @@ describe("scheduler conversation reuse", () => {
261
253
  // WHEN the schedule fires for the first time
262
254
  forceScheduleDue(schedule.id);
263
255
 
264
- await runScheduleDueWorkOnce();
256
+ await runDueSchedulesOnce();
265
257
 
266
258
  expect(processedMessages).toHaveLength(1);
267
259
  const firstConversationId = processedMessages[0].conversationId;
@@ -270,7 +262,7 @@ describe("scheduler conversation reuse", () => {
270
262
  forceScheduleDue(schedule.id);
271
263
  processedMessages.length = 0;
272
264
 
273
- await runScheduleDueWorkOnce();
265
+ await runDueSchedulesOnce();
274
266
 
275
267
  // THEN a different conversation is created
276
268
  expect(processedMessages).toHaveLength(1);
@@ -296,7 +288,7 @@ describe("scheduler conversation reuse", () => {
296
288
 
297
289
  forceScheduleDue(schedule.id);
298
290
 
299
- await runScheduleDueWorkOnce();
291
+ await runDueSchedulesOnce();
300
292
 
301
293
  expect(processedMessages).toHaveLength(1);
302
294
  const firstConversationId = processedMessages[0].conversationId;
@@ -308,7 +300,7 @@ describe("scheduler conversation reuse", () => {
308
300
  forceScheduleDue(schedule.id);
309
301
  processedMessages.length = 0;
310
302
 
311
- await runScheduleDueWorkOnce();
303
+ await runDueSchedulesOnce();
312
304
 
313
305
  // THEN a new conversation is created (not the deleted one)
314
306
  expect(processedMessages).toHaveLength(1);
@@ -332,7 +324,7 @@ describe("scheduler conversation reuse", () => {
332
324
  });
333
325
 
334
326
  // WHEN the schedule fires
335
- await runScheduleDueWorkOnce();
327
+ await runDueSchedulesOnce();
336
328
 
337
329
  // THEN the message is processed with a new conversation
338
330
  expect(processedMessages).toHaveLength(1);
@@ -371,7 +363,7 @@ describe("scheduler conversation reuse", () => {
371
363
  return { messageId: "test-message-id" };
372
364
  };
373
365
 
374
- await runScheduleDueWorkOnce();
366
+ await runDueSchedulesOnce();
375
367
 
376
368
  expect(processedMessages).toHaveLength(1);
377
369
  const successConversationId = processedMessages[0].conversationId;
@@ -381,7 +373,7 @@ describe("scheduler conversation reuse", () => {
381
373
  processedMessages.length = 0;
382
374
  shouldFail = true;
383
375
 
384
- await runScheduleDueWorkOnce();
376
+ await runDueSchedulesOnce();
385
377
 
386
378
  // The failed run created a different conversation (since it failed
387
379
  // before the run could reuse — actually it does reuse the same one
@@ -393,7 +385,7 @@ describe("scheduler conversation reuse", () => {
393
385
  processedMessages.length = 0;
394
386
  shouldFail = false;
395
387
 
396
- await runScheduleDueWorkOnce();
388
+ await runDueSchedulesOnce();
397
389
 
398
390
  // THEN the third run reuses the conversation from the first successful run
399
391
  // (the lookup queries for status="ok", so it picks the first run's conversation)
@@ -421,7 +413,7 @@ describe("scheduler conversation reuse", () => {
421
413
  });
422
414
 
423
415
  forceScheduleDue(schedule.id);
424
- await runScheduleDueWorkOnce();
416
+ await runDueSchedulesOnce();
425
417
 
426
418
  const runs1 = getScheduleRuns(schedule.id);
427
419
  expect(runs1[0].status).toBe("ok");
@@ -438,7 +430,7 @@ describe("scheduler conversation reuse", () => {
438
430
  };
439
431
  };
440
432
 
441
- await runScheduleDueWorkOnce();
433
+ await runDueSchedulesOnce();
442
434
 
443
435
  // THEN the run is recorded as an error (not "ok") and carries the code
444
436
  const runs2 = getScheduleRuns(schedule.id);
@@ -474,7 +466,7 @@ describe("scheduler talk-mode runner option propagation", () => {
474
466
  });
475
467
  forceScheduleDue(schedule.id);
476
468
 
477
- await runScheduleDueWorkOnce();
469
+ await runDueSchedulesOnce();
478
470
 
479
471
  expect(runBackgroundJobOptions).toHaveLength(1);
480
472
  const opts = runBackgroundJobOptions[0]!;
@@ -496,7 +488,7 @@ describe("scheduler talk-mode runner option propagation", () => {
496
488
  });
497
489
  forceScheduleDue(schedule.id);
498
490
 
499
- await runScheduleDueWorkOnce();
491
+ await runDueSchedulesOnce();
500
492
 
501
493
  expect(runBackgroundJobOptions).toHaveLength(1);
502
494
  expect(runBackgroundJobOptions[0]!.suppressFailureNotifications).toBe(
@@ -522,7 +514,7 @@ describe("scheduler talk-mode runner option propagation", () => {
522
514
  forceScheduleDue(schedule.id);
523
515
  runBackgroundJobBootstrapFails = true;
524
516
 
525
- await runScheduleDueWorkOnce();
517
+ await runDueSchedulesOnce();
526
518
 
527
519
  const runs = getScheduleRuns(schedule.id);
528
520
  expect(runs.length).toBe(1);
@@ -561,7 +553,7 @@ describe("scheduler talk-mode runner option propagation", () => {
561
553
  }
562
554
  },
563
555
  });
564
- await runScheduleDueWorkOnce();
556
+ await runDueSchedulesOnce();
565
557
  subscription.dispose();
566
558
 
567
559
  expect(sseCalls).toHaveLength(1);
@@ -16,21 +16,13 @@ mock.module("../daemon/process-message.js", () => ({
16
16
  processMessage: mockProcessMessage,
17
17
  }));
18
18
 
19
- import { loadRawConfig, saveRawConfig } from "../config/loader.js";
20
19
  import { getDb } from "../persistence/db-connection.js";
21
20
  import { initializeDb } from "../persistence/db-init.js";
22
21
  import { createSchedule } from "../schedule/schedule-store.js";
23
- import { runScheduleDueWorkOnce } from "../schedule/scheduler.js";
22
+ import { runDueSchedulesOnce } from "../schedule/scheduler.js";
24
23
 
25
24
  await initializeDb();
26
25
 
27
- // The schedule worker is on by default, which stands the daemon's in-process
28
- // scheduler down. These tests exercise that in-process execution path directly,
29
- // so pin the worker flag off for this test process.
30
- const rawConfig = loadRawConfig();
31
- rawConfig.schedules = { worker: { enabled: false } };
32
- saveRawConfig(rawConfig);
33
-
34
26
  /** Access the underlying bun:sqlite Database for raw parameterized queries. */
35
27
  function getRawDb(): import("bun:sqlite").Database {
36
28
  return (getDb() as unknown as { $client: import("bun:sqlite").Database })
@@ -70,7 +62,7 @@ describe("scheduler wake mode", () => {
70
62
  forceScheduleDue(schedule.id);
71
63
 
72
64
  // WHEN the scheduler fires
73
- await runScheduleDueWorkOnce();
65
+ await runDueSchedulesOnce();
74
66
 
75
67
  // THEN wakeAgentForOpportunity is called with the correct arguments
76
68
  expect(mockWakeAgentForOpportunity).toHaveBeenCalledTimes(1);
@@ -103,7 +95,7 @@ describe("scheduler wake mode", () => {
103
95
  forceScheduleDue(schedule.id);
104
96
 
105
97
  // WHEN the scheduler fires
106
- await runScheduleDueWorkOnce();
98
+ await runDueSchedulesOnce();
107
99
 
108
100
  // THEN wakeAgentForOpportunity is NOT called
109
101
  expect(mockWakeAgentForOpportunity).not.toHaveBeenCalled();
@@ -132,7 +124,7 @@ describe("scheduler wake mode", () => {
132
124
  forceScheduleDue(schedule.id);
133
125
 
134
126
  // WHEN the scheduler fires
135
- await runScheduleDueWorkOnce();
127
+ await runDueSchedulesOnce();
136
128
 
137
129
  // THEN the one-shot is marked as completed (status = 'fired')
138
130
  const row = getRawDb()
@@ -155,7 +147,7 @@ describe("scheduler wake mode", () => {
155
147
  forceScheduleDue(schedule.id);
156
148
 
157
149
  // WHEN the scheduler fires
158
- await runScheduleDueWorkOnce();
150
+ await runDueSchedulesOnce();
159
151
 
160
152
  // THEN the one-shot is reverted to 'active' for retry (failOneShot behavior)
161
153
  const row = getRawDb()
@@ -187,7 +179,7 @@ describe("scheduler wake mode", () => {
187
179
  forceScheduleDue(schedule.id);
188
180
 
189
181
  // WHEN the first tick runs
190
- await runScheduleDueWorkOnce();
182
+ await runDueSchedulesOnce();
191
183
 
192
184
  // THEN the job is NOT completed — it's reverted to 'active' for retry
193
185
  const rowAfterFirst = getRawDb()
@@ -197,7 +189,7 @@ describe("scheduler wake mode", () => {
197
189
  expect(rowAfterFirst?.retry_count).toBe(1);
198
190
 
199
191
  // WHEN the second tick fires
200
- await runScheduleDueWorkOnce();
192
+ await runDueSchedulesOnce();
201
193
 
202
194
  // THEN the job IS completed (status = 'fired')
203
195
  const rowAfterSecond = getRawDb()
@@ -232,7 +224,7 @@ describe("scheduler wake mode", () => {
232
224
  ]);
233
225
 
234
226
  // WHEN the scheduler fires
235
- await runScheduleDueWorkOnce();
227
+ await runDueSchedulesOnce();
236
228
 
237
229
  // THEN the job is permanently failed (status = 'cancelled', enabled = false)
238
230
  const row = getRawDb()
@@ -83,7 +83,6 @@ function schedulerResultFixture(
83
83
  completed: 0,
84
84
  failed: 0,
85
85
  skipped: 0,
86
- stillPending: 0,
87
86
  ...overrides,
88
87
  };
89
88
  }
@@ -573,7 +572,7 @@ describe("background wake runtime routes", () => {
573
572
  skipped: 0,
574
573
  }));
575
574
  const schedulerRunDue = mock(async () =>
576
- schedulerResultFixture({ skipped: 2, stillPending: 2 }),
575
+ schedulerResultFixture({ skipped: 2 }),
577
576
  );
578
577
  setBackgroundWakeRuntime({
579
578
  heartbeat: {
@@ -725,7 +724,7 @@ describe("background wake runtime routes", () => {
725
724
 
726
725
  test("drain-due runs scheduler work even when pending work remains", async () => {
727
726
  const schedulerRunDue = mock(async () =>
728
- schedulerResultFixture({ claimed: 1, completed: 1, stillPending: 1 }),
727
+ schedulerResultFixture({ claimed: 1, completed: 1 }),
729
728
  );
730
729
  setBackgroundWakeRuntime({
731
730
  heartbeat: {
@@ -144,7 +144,6 @@ describe("memory worker start", () => {
144
144
  result: {
145
145
  pid: 4242,
146
146
  alreadyRunning: false,
147
- workerEnabled: true,
148
147
  pidPath: "/x/memory-worker.pid",
149
148
  },
150
149
  });
@@ -160,7 +159,6 @@ describe("memory worker start", () => {
160
159
  const result = {
161
160
  pid: 7,
162
161
  alreadyRunning: true,
163
- workerEnabled: true,
164
162
  pidPath: "/x/p.pid",
165
163
  };
166
164
  responses.set("memory_worker_start", { ok: true, result });
@@ -194,7 +192,7 @@ describe("memory worker stop", () => {
194
192
  test("calls memory_worker_stop and renders the signalled PID", async () => {
195
193
  responses.set("memory_worker_stop", {
196
194
  ok: true,
197
- result: { workerWasRunning: true, pid: 555, workerEnabled: false },
195
+ result: { workerWasRunning: true, pid: 555 },
198
196
  });
199
197
 
200
198
  const { exitCode } = await runCommand(["memory", "worker", "stop"]);
@@ -216,8 +214,13 @@ describe("memory worker status", () => {
216
214
  const result = {
217
215
  status: "running",
218
216
  pid: 321,
219
- workerEnabled: true,
220
- syncRunner: { status: "not_running" },
217
+ embedding: {
218
+ enabled: true,
219
+ degraded: false,
220
+ provider: "local",
221
+ model: "Xenova/all-MiniLM-L6-v2",
222
+ reason: null,
223
+ },
221
224
  };
222
225
  responses.set("memory_worker_status", { ok: true, result });
223
226
 
@@ -766,12 +766,11 @@ Examples:
766
766
  helpText: `
767
767
  The memory worker processes embedding, consolidation, and cleanup jobs in a
768
768
  separate OS process so they do not block the assistant's main event loop. The
769
- daemon owns the process, so it is spawned as a child of the daemon and shows up
770
- in \`assistant ps\`.
769
+ daemon spawns it as a child process at startup, so it shows up in
770
+ \`assistant ps\`.
771
771
 
772
- \`start\` enables memory.worker.enabled and \`stop\` disables it, so the
773
- assistant's synchronous in-process runner stands down (start) or takes back over
774
- (stop) without a restart.
772
+ \`start\` and \`stop\` manage that process on demand (respawn or SIGTERM); the
773
+ worker is spun up by default at startup.
775
774
 
776
775
  Examples:
777
776
  $ assistant memory worker start
@@ -780,8 +779,7 @@ Examples:
780
779
  subcommands: [
781
780
  {
782
781
  name: "start",
783
- description:
784
- "Start the memory worker process and enable memory.worker.enabled",
782
+ description: "Spawn the memory worker process if it is not running",
785
783
  options: [
786
784
  {
787
785
  flags: "--json",
@@ -791,8 +789,7 @@ Examples:
791
789
  },
792
790
  {
793
791
  name: "stop",
794
- description:
795
- "Stop the memory worker process and disable memory.worker.enabled",
792
+ description: "SIGTERM the memory worker process",
796
793
  options: [
797
794
  {
798
795
  flags: "--json",
@@ -803,7 +800,7 @@ Examples:
803
800
  {
804
801
  name: "status",
805
802
  description:
806
- "Report worker process state, memory.worker.enabled, and the synchronous runner",
803
+ "Report the memory worker process liveness and embedding-backend status",
807
804
  options: [
808
805
  {
809
806
  flags: "--json",
@@ -1,24 +1,17 @@
1
1
  /**
2
2
  * `assistant memory worker` CLI subgroup.
3
3
  *
4
- * Manages the memory jobs worker as its own OS process — separate from the
5
- * daemon's main event loop. This prevents long-running embedding jobs from
6
- * blocking user-facing HTTP traffic.
4
+ * The memory jobs worker processes embedding, consolidation, and cleanup jobs
5
+ * as its own OS process — a child of the daemon spawned at startup — so
6
+ * long-running jobs don't block user-facing HTTP traffic. It is spun up by
7
+ * default; these commands manage the process lifecycle on demand.
7
8
  *
8
- * Subcommands:
9
+ * Subcommands (thin IPC wrappers; the daemon owns the process so it is spawned
10
+ * as a child of the daemon and appears in `assistant ps`):
9
11
  *
10
- * - `start` — spawn the worker process and enable `memory.worker.enabled`,
11
- * standing the daemon's synchronous in-process runner down.
12
- * - `stop` — SIGTERM the worker process and disable `memory.worker.enabled`,
13
- * handing the queue back to the synchronous in-process runner.
14
- * - `status` — report the worker process state, the `memory.worker.enabled`
15
- * config value, and whether the synchronous in-process runner is going.
16
- *
17
- * All three are thin IPC wrappers: the daemon owns the
18
- * worker process so it is spawned as a *child of the daemon* — which is what
19
- * makes it appear in `assistant ps` and lets the daemon tear it down on
20
- * shutdown. (If the CLI spawned the worker itself, the short-lived CLI process
21
- * would be its parent and the worker would be reparented to init.)
12
+ * - `start` — spawn the worker process if it is not already running.
13
+ * - `stop` — SIGTERM the worker process.
14
+ * - `status` — report the worker process state and the embedding backend.
22
15
  */
23
16
 
24
17
  import type { Command } from "commander";
@@ -28,29 +21,29 @@ import { subcommand } from "../../lib/cli-command-help.js";
28
21
  import { log } from "../../logger.js";
29
22
  import { shouldOutputJson, writeOutput } from "../../output.js";
30
23
 
31
- interface WorkerProcessState {
32
- status: "running" | "not_running";
33
- pid?: number;
34
- }
35
-
36
24
  interface StartResponse {
37
25
  pid: number;
38
26
  alreadyRunning: boolean;
39
- workerEnabled: true;
40
27
  pidPath: string;
41
28
  }
42
29
 
43
30
  interface StopResponse {
44
31
  workerWasRunning: boolean;
45
32
  pid?: number;
46
- workerEnabled: false;
33
+ }
34
+
35
+ interface EmbeddingStatus {
36
+ enabled: boolean;
37
+ degraded: boolean;
38
+ provider: "local" | "openai" | "gemini" | "ollama" | null;
39
+ model: string | null;
40
+ reason: string | null;
47
41
  }
48
42
 
49
43
  interface StatusResponse {
50
44
  status: "running" | "not_running";
51
45
  pid?: number;
52
- workerEnabled: boolean;
53
- syncRunner: WorkerProcessState;
46
+ embedding: EmbeddingStatus;
54
47
  }
55
48
 
56
49
  // ---------------------------------------------------------------------------
@@ -63,7 +56,9 @@ export function registerMemoryWorkerCommand(memory: Command): void {
63
56
  subcommand(worker, "start").action(
64
57
  async (_opts: { json?: boolean }, cmd: Command) => {
65
58
  const r = await cliIpcCall<StartResponse>("memory_worker_start");
66
- if (!r.ok) return exitFromIpcResult(r);
59
+ if (!r.ok) {
60
+ return exitFromIpcResult(r);
61
+ }
67
62
  const res = r.result!;
68
63
 
69
64
  if (shouldOutputJson(cmd)) {
@@ -75,16 +70,15 @@ export function registerMemoryWorkerCommand(memory: Command): void {
75
70
  ? `Memory worker is already running (PID ${res.pid})`
76
71
  : `Memory worker started (PID ${res.pid})`,
77
72
  );
78
- log.info(
79
- "Enabled memory.worker.enabled; the synchronous in-process runner will stand down",
80
- );
81
73
  },
82
74
  );
83
75
 
84
76
  subcommand(worker, "stop").action(
85
77
  async (_opts: { json?: boolean }, cmd: Command) => {
86
78
  const r = await cliIpcCall<StopResponse>("memory_worker_stop");
87
- if (!r.ok) return exitFromIpcResult(r);
79
+ if (!r.ok) {
80
+ return exitFromIpcResult(r);
81
+ }
88
82
  const res = r.result!;
89
83
 
90
84
  if (shouldOutputJson(cmd)) {
@@ -96,16 +90,15 @@ export function registerMemoryWorkerCommand(memory: Command): void {
96
90
  } else {
97
91
  log.info("Memory worker process was not running");
98
92
  }
99
- log.info(
100
- "Disabled memory.worker.enabled; the synchronous in-process runner will take over",
101
- );
102
93
  },
103
94
  );
104
95
 
105
96
  subcommand(worker, "status").action(
106
97
  async (_opts: { json?: boolean }, cmd: Command) => {
107
98
  const r = await cliIpcCall<StatusResponse>("memory_worker_status");
108
- if (!r.ok) return exitFromIpcResult(r);
99
+ if (!r.ok) {
100
+ return exitFromIpcResult(r);
101
+ }
109
102
  const res = r.result!;
110
103
 
111
104
  if (shouldOutputJson(cmd)) {
@@ -117,13 +110,10 @@ export function registerMemoryWorkerCommand(memory: Command): void {
117
110
  } else {
118
111
  log.info("Memory worker process is not running");
119
112
  }
120
- log.info(`memory.worker.enabled: ${res.workerEnabled}`);
121
- if (res.syncRunner.status === "running") {
113
+ if (res.embedding.degraded) {
122
114
  log.info(
123
- `Synchronous in-process runner is running (PID ${res.syncRunner.pid})`,
115
+ `Embedding backend degraded${res.embedding.reason ? `: ${res.embedding.reason}` : ""}`,
124
116
  );
125
- } else {
126
- log.info("Synchronous in-process runner is not running");
127
117
  }
128
118
  },
129
119
  );
@@ -1,28 +1,18 @@
1
1
  /**
2
2
  * `assistant schedules worker` CLI subgroup.
3
3
  *
4
- * Manages the schedule worker as its own OS process — separate from the
5
- * assistant's main event loop. Scheduled jobs run there, so expensive
6
- * scheduled work does not compete with user-facing traffic and keeps running
7
- * during a main-thread freeze.
4
+ * The schedule worker runs scheduled jobs as its own OS process — a child of
5
+ * the assistant spawned at startup — so expensive scheduled work does not
6
+ * compete with user-facing traffic and keeps running during a main-thread
7
+ * freeze. It is spun up by default; these commands manage the process lifecycle
8
+ * on demand.
8
9
  *
9
- * Subcommands:
10
+ * Subcommands (thin IPC wrappers; the assistant owns the process so it is
11
+ * spawned as a child of the assistant and appears in `assistant ps`):
10
12
  *
11
- * - `start` — spawn the worker process and enable
12
- * `schedules.worker.enabled`, so the assistant's scheduler leaves
13
- * schedule execution to the worker.
14
- * - `stop` — SIGTERM the worker process and disable
15
- * `schedules.worker.enabled`, handing schedule execution back to the
16
- * assistant's scheduler.
17
- * - `status` — report the worker process state, the
18
- * `schedules.worker.enabled` config value, and whether the assistant's
19
- * in-process scheduler is currently executing schedules.
20
- *
21
- * All three are thin IPC wrappers (transport: "ipc"): the assistant owns the
22
- * worker process so it is spawned as a *child of the assistant* — which is
23
- * what makes it appear in `assistant ps` and lets the assistant tear it down
24
- * on shutdown. (If the CLI spawned the worker itself, the short-lived CLI
25
- * process would be its parent and the worker would be reparented to init.)
13
+ * - `start` — spawn the worker process if it is not already running.
14
+ * - `stop` — SIGTERM the worker process.
15
+ * - `status` — report the worker process state.
26
16
  */
27
17
 
28
18
  import type { Command } from "commander";
@@ -32,29 +22,20 @@ import { subcommand } from "../lib/cli-command-help.js";
32
22
  import { log } from "../logger.js";
33
23
  import { shouldOutputJson, writeOutput } from "../output.js";
34
24
 
35
- interface WorkerProcessState {
36
- status: "running" | "not_running";
37
- pid?: number;
38
- }
39
-
40
25
  interface StartResponse {
41
26
  pid: number;
42
27
  alreadyRunning: boolean;
43
- workerEnabled: true;
44
28
  pidPath: string;
45
29
  }
46
30
 
47
31
  interface StopResponse {
48
32
  workerWasRunning: boolean;
49
33
  pid?: number;
50
- workerEnabled: false;
51
34
  }
52
35
 
53
36
  interface StatusResponse {
54
37
  status: "running" | "not_running";
55
38
  pid?: number;
56
- workerEnabled: boolean;
57
- inProcessScheduler: WorkerProcessState;
58
39
  }
59
40
 
60
41
  // ---------------------------------------------------------------------------
@@ -81,9 +62,6 @@ export function registerSchedulesWorkerCommand(schedules: Command): void {
81
62
  ? `Schedule worker is already running (PID ${res.pid})`
82
63
  : `Schedule worker started (PID ${res.pid})`,
83
64
  );
84
- log.info(
85
- "Enabled schedules.worker.enabled; the assistant's scheduler will leave schedule execution to the worker",
86
- );
87
65
  },
88
66
  );
89
67
 
@@ -104,9 +82,6 @@ export function registerSchedulesWorkerCommand(schedules: Command): void {
104
82
  } else {
105
83
  log.info("Schedule worker process was not running");
106
84
  }
107
- log.info(
108
- "Disabled schedules.worker.enabled; the assistant's scheduler will run schedules again",
109
- );
110
85
  },
111
86
  );
112
87
 
@@ -127,14 +102,6 @@ export function registerSchedulesWorkerCommand(schedules: Command): void {
127
102
  } else {
128
103
  log.info("Schedule worker process is not running");
129
104
  }
130
- log.info(`schedules.worker.enabled: ${res.workerEnabled}`);
131
- if (res.inProcessScheduler.status === "running") {
132
- log.info(
133
- `In-process scheduler is running (PID ${res.inProcessScheduler.pid})`,
134
- );
135
- } else {
136
- log.info("In-process scheduler is not running");
137
- }
138
105
  },
139
106
  );
140
107
  }