@yu_robotics/remote-cli 1.6.253 → 1.6.259

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 (161) hide show
  1. package/dist/client/MessageHandler.d.ts +5 -12
  2. package/dist/client/MessageHandler.d.ts.map +1 -1
  3. package/dist/client/MessageHandler.js +53 -252
  4. package/dist/client/MessageHandler.js.map +1 -1
  5. package/dist/client/WebSocketClient.d.ts +0 -3
  6. package/dist/client/WebSocketClient.d.ts.map +1 -1
  7. package/dist/client/WebSocketClient.js +1 -3
  8. package/dist/client/WebSocketClient.js.map +1 -1
  9. package/dist/commands/start.d.ts +0 -5
  10. package/dist/commands/start.d.ts.map +1 -1
  11. package/dist/commands/start.js +0 -28
  12. package/dist/commands/start.js.map +1 -1
  13. package/dist/executor/AcpExecutor.d.ts.map +1 -1
  14. package/dist/executor/AcpExecutor.js.map +1 -1
  15. package/dist/executor/AgyExecutor.d.ts +4 -11
  16. package/dist/executor/AgyExecutor.d.ts.map +1 -1
  17. package/dist/executor/AgyExecutor.js +71 -101
  18. package/dist/executor/AgyExecutor.js.map +1 -1
  19. package/dist/executor/ClaudePersistentExecutor.d.ts +3 -7
  20. package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -1
  21. package/dist/executor/ClaudePersistentExecutor.js +14 -224
  22. package/dist/executor/ClaudePersistentExecutor.js.map +1 -1
  23. package/dist/executor/DshExecutor.d.ts +7 -14
  24. package/dist/executor/DshExecutor.d.ts.map +1 -1
  25. package/dist/executor/DshExecutor.js +48 -50
  26. package/dist/executor/DshExecutor.js.map +1 -1
  27. package/dist/executor/IExecutor.d.ts +3 -3
  28. package/dist/executor/IExecutor.d.ts.map +1 -1
  29. package/dist/executor/acp/AcpClient.d.ts +15 -1
  30. package/dist/executor/acp/AcpClient.d.ts.map +1 -1
  31. package/dist/executor/acp/AcpClient.js +85 -7
  32. package/dist/executor/acp/AcpClient.js.map +1 -1
  33. package/dist/executor/agy/AgyAcpDiagnostics.d.ts +8 -0
  34. package/dist/executor/agy/AgyAcpDiagnostics.d.ts.map +1 -0
  35. package/dist/executor/agy/AgyAcpDiagnostics.js +45 -0
  36. package/dist/executor/agy/AgyAcpDiagnostics.js.map +1 -0
  37. package/dist/executor/agy/AgyAcpRuntime.d.ts +9 -16
  38. package/dist/executor/agy/AgyAcpRuntime.d.ts.map +1 -1
  39. package/dist/executor/agy/AgyAcpRuntime.js +67 -151
  40. package/dist/executor/agy/AgyAcpRuntime.js.map +1 -1
  41. package/dist/executor/agy/AgySessionSelection.d.ts +7 -0
  42. package/dist/executor/agy/AgySessionSelection.d.ts.map +1 -0
  43. package/dist/executor/agy/AgySessionSelection.js +60 -0
  44. package/dist/executor/agy/AgySessionSelection.js.map +1 -0
  45. package/dist/executor/agy/AgySessionSettings.d.ts +13 -0
  46. package/dist/executor/agy/AgySessionSettings.d.ts.map +1 -0
  47. package/dist/executor/agy/AgySessionSettings.js +60 -0
  48. package/dist/executor/agy/AgySessionSettings.js.map +1 -0
  49. package/dist/executor/dsh/DshAcpClient.d.ts +1 -1
  50. package/dist/executor/dsh/DshAcpClient.d.ts.map +1 -1
  51. package/dist/executor/dsh/DshAcpClient.js +3 -1
  52. package/dist/executor/dsh/DshAcpClient.js.map +1 -1
  53. package/dist/executor/index.d.ts +1 -0
  54. package/dist/executor/index.d.ts.map +1 -1
  55. package/dist/executor/index.js +1 -0
  56. package/dist/executor/index.js.map +1 -1
  57. package/dist/index.js +0 -2
  58. package/dist/index.js.map +1 -1
  59. package/dist/maintenance/release-notes.json +1 -1
  60. package/dist/scheduling/ScheduleCapabilities.d.ts +2 -2
  61. package/dist/scheduling/ScheduleCapabilities.js +4 -4
  62. package/dist/scheduling/ScheduleCapabilities.js.map +1 -1
  63. package/dist/scheduling/SchedulePurgeVerification.js +1 -1
  64. package/dist/scheduling/SchedulePurgeVerification.js.map +1 -1
  65. package/dist/scheduling/ScheduleService.d.ts +10 -44
  66. package/dist/scheduling/ScheduleService.d.ts.map +1 -1
  67. package/dist/scheduling/ScheduleService.js +164 -715
  68. package/dist/scheduling/ScheduleService.js.map +1 -1
  69. package/dist/scheduling/agy/AgySessionSchedules.d.ts +5 -5
  70. package/dist/scheduling/agy/AgySessionSchedules.d.ts.map +1 -1
  71. package/dist/scheduling/agy/AgySessionSchedules.js +20 -17
  72. package/dist/scheduling/agy/AgySessionSchedules.js.map +1 -1
  73. package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts +2 -6
  74. package/dist/scheduling/claude/ClaudeScheduleOwnership.d.ts.map +1 -1
  75. package/dist/scheduling/claude/ClaudeScheduleOwnership.js +12 -67
  76. package/dist/scheduling/claude/ClaudeScheduleOwnership.js.map +1 -1
  77. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts +4 -26
  78. package/dist/scheduling/claude/ClaudeSessionSchedules.d.ts.map +1 -1
  79. package/dist/scheduling/claude/ClaudeSessionSchedules.js +22 -145
  80. package/dist/scheduling/claude/ClaudeSessionSchedules.js.map +1 -1
  81. package/dist/scheduling/dsh/ScheduledSessionGuard.d.ts +12 -0
  82. package/dist/scheduling/dsh/ScheduledSessionGuard.d.ts.map +1 -0
  83. package/dist/scheduling/dsh/ScheduledSessionGuard.js +96 -0
  84. package/dist/scheduling/dsh/ScheduledSessionGuard.js.map +1 -0
  85. package/dist/scheduling/dsh/SessionScheduleBridge.d.ts.map +1 -1
  86. package/dist/scheduling/dsh/SessionScheduleBridge.js +0 -25
  87. package/dist/scheduling/dsh/SessionScheduleBridge.js.map +1 -1
  88. package/dist/scheduling/dsh/SessionScheduleClient.d.ts.map +1 -1
  89. package/dist/scheduling/dsh/SessionScheduleClient.js +0 -8
  90. package/dist/scheduling/dsh/SessionScheduleClient.js.map +1 -1
  91. package/dist/scheduling/dsh/sessionLaunch.js +1 -1
  92. package/dist/scheduling/dsh/sessionLaunch.js.map +1 -1
  93. package/dist/scheduling/types.d.ts +26 -77
  94. package/dist/scheduling/types.d.ts.map +1 -1
  95. package/dist/scheduling/types.js +1 -10
  96. package/dist/scheduling/types.js.map +1 -1
  97. package/dist/service/ServiceManager.js +1 -1
  98. package/dist/thread/ThreadExecutorPool.d.ts +4 -1
  99. package/dist/thread/ThreadExecutorPool.d.ts.map +1 -1
  100. package/dist/thread/ThreadExecutorPool.js +6 -3
  101. package/dist/thread/ThreadExecutorPool.js.map +1 -1
  102. package/dist/thread/ThreadManager.d.ts.map +1 -1
  103. package/dist/thread/ThreadManager.js +23 -2
  104. package/dist/thread/ThreadManager.js.map +1 -1
  105. package/native/prebuilds/darwin-arm64/managed_native.node +0 -0
  106. package/native/prebuilds/darwin-arm64/manifest.json +1 -1
  107. package/native/prebuilds/darwin-x64/managed_native.node +0 -0
  108. package/native/prebuilds/darwin-x64/manifest.json +1 -1
  109. package/native/prebuilds/win32-arm64/managed_native.node +0 -0
  110. package/native/prebuilds/win32-arm64/manifest.json +1 -1
  111. package/native/prebuilds/win32-x64/managed_native.node +0 -0
  112. package/native/prebuilds/win32-x64/manifest.json +1 -1
  113. package/package.json +1 -1
  114. package/dist/scheduling/agy/AgyCheckpoint.d.ts +0 -35
  115. package/dist/scheduling/agy/AgyCheckpoint.d.ts.map +0 -1
  116. package/dist/scheduling/agy/AgyCheckpoint.js +0 -160
  117. package/dist/scheduling/agy/AgyCheckpoint.js.map +0 -1
  118. package/dist/service/SessionHostSupervisor.d.ts +0 -63
  119. package/dist/service/SessionHostSupervisor.d.ts.map +0 -1
  120. package/dist/service/SessionHostSupervisor.js +0 -323
  121. package/dist/service/SessionHostSupervisor.js.map +0 -1
  122. package/dist/sessionHost/HostClient.d.ts +0 -49
  123. package/dist/sessionHost/HostClient.d.ts.map +0 -1
  124. package/dist/sessionHost/HostClient.js +0 -101
  125. package/dist/sessionHost/HostClient.js.map +0 -1
  126. package/dist/sessionHost/HostProtocol.d.ts +0 -65
  127. package/dist/sessionHost/HostProtocol.d.ts.map +0 -1
  128. package/dist/sessionHost/HostProtocol.js +0 -78
  129. package/dist/sessionHost/HostProtocol.js.map +0 -1
  130. package/dist/sessionHost/HostServer.d.ts +0 -52
  131. package/dist/sessionHost/HostServer.d.ts.map +0 -1
  132. package/dist/sessionHost/HostServer.js +0 -413
  133. package/dist/sessionHost/HostServer.js.map +0 -1
  134. package/dist/sessionHost/HostStore.d.ts +0 -43
  135. package/dist/sessionHost/HostStore.d.ts.map +0 -1
  136. package/dist/sessionHost/HostStore.js +0 -206
  137. package/dist/sessionHost/HostStore.js.map +0 -1
  138. package/dist/sessionHost/RetainedFrontend.d.ts +0 -63
  139. package/dist/sessionHost/RetainedFrontend.d.ts.map +0 -1
  140. package/dist/sessionHost/RetainedFrontend.js +0 -244
  141. package/dist/sessionHost/RetainedFrontend.js.map +0 -1
  142. package/dist/sessionHost/RetainedHostLauncher.d.ts +0 -25
  143. package/dist/sessionHost/RetainedHostLauncher.d.ts.map +0 -1
  144. package/dist/sessionHost/RetainedHostLauncher.js +0 -132
  145. package/dist/sessionHost/RetainedHostLauncher.js.map +0 -1
  146. package/dist/sessionHost/RetainedRuntime.d.ts +0 -62
  147. package/dist/sessionHost/RetainedRuntime.d.ts.map +0 -1
  148. package/dist/sessionHost/RetainedRuntime.js +0 -478
  149. package/dist/sessionHost/RetainedRuntime.js.map +0 -1
  150. package/dist/sessionHost/RuntimeJournal.d.ts +0 -47
  151. package/dist/sessionHost/RuntimeJournal.d.ts.map +0 -1
  152. package/dist/sessionHost/RuntimeJournal.js +0 -103
  153. package/dist/sessionHost/RuntimeJournal.js.map +0 -1
  154. package/dist/sessionHost/entry.d.ts +0 -13
  155. package/dist/sessionHost/entry.d.ts.map +0 -1
  156. package/dist/sessionHost/entry.js +0 -107
  157. package/dist/sessionHost/entry.js.map +0 -1
  158. package/dist/update/PinnedHostBundle.d.ts +0 -49
  159. package/dist/update/PinnedHostBundle.d.ts.map +0 -1
  160. package/dist/update/PinnedHostBundle.js +0 -309
  161. package/dist/update/PinnedHostBundle.js.map +0 -1
@@ -39,9 +39,6 @@ export declare class MessageHandler {
39
39
  private readonly abortOperations;
40
40
  private readonly pendingGoalActivations;
41
41
  private automaticUpdateInProgress;
42
- private readonly automaticUpdateScheduleThreads;
43
- private automaticUpdateFailed;
44
- private automaticUpdateRecovering;
45
42
  private approvalCardsSupported;
46
43
  private streamingContextSupported;
47
44
  private delegationProgressSupported;
@@ -75,8 +72,7 @@ export declare class MessageHandler {
75
72
  private readonly scheduleCards;
76
73
  private schedules?;
77
74
  private scheduleInitialization?;
78
- private scheduleRecoveryPending;
79
- private scheduleRecoveryThreads;
75
+ private scheduleCatalogPending;
80
76
  private scheduleDelivery?;
81
77
  private readonly reviewedNativeCleanup;
82
78
  private readonly schedulePurgeHosts;
@@ -88,12 +84,9 @@ export declare class MessageHandler {
88
84
  * Handle message (supports new IncomingMessage format)
89
85
  */
90
86
  handleMessage(message: Message | IncomingMessage): Promise<void>;
91
- private scheduleContextFenced;
92
- private releaseSettledUpdateFences;
93
87
  tryBeginAutomaticUpdate(): boolean;
94
88
  prepareAutomaticUpdate(): Promise<void>;
95
- endAutomaticUpdate(failed?: boolean): Promise<void>;
96
- private restoreAfterAutomaticUpdate;
89
+ endAutomaticUpdate(_failed?: boolean): Promise<void>;
97
90
  /**
98
91
  * Handle command message — route to the correct thread executor.
99
92
  */
@@ -228,10 +221,10 @@ export declare class MessageHandler {
228
221
  private executorConfiguration;
229
222
  private scheduleGeneration;
230
223
  private scheduleDirectory;
231
- /** Fence the updater before connection/version callbacks can race catalog recovery. */
224
+ /** Fence the updater before connection/version callbacks can race catalog loading. */
232
225
  prepareScheduleStartup(): Promise<void>;
233
- /** Binding recovery waits for transport readiness and never creates an absent catalog. */
234
- private recoverSchedules;
226
+ /** Catalog loading waits for transport readiness and never creates an absent catalog. */
227
+ private loadScheduleCatalog;
235
228
  private initializeSchedules;
236
229
  private activeSchedules;
237
230
  private assertScheduleCleanupContext;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageHandler.d.ts","sourceRoot":"","sources":["../../src/client/MessageHandler.ts"],"names":[],"mappings":"AAcA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F;YAC3E,mBAAmB;IAuBjC,OAAO,CAAC,mBAAmB;YA+Db,eAAe;YASf,4BAA4B;YAgB5B,mBAAmB;IAOjC,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,uBAAuB;IAc/B,qGAAqG;YACvF,oBAAoB;IAyGlC;sEACkE;YACpD,gBAAgB;IA6D9B;gFAC4E;YAC9D,wBAAwB;YAiExB,qBAAqB;IAyEnC,8EAA8E;YAChE,sBAAsB;IAepC,OAAO,CAAC,aAAa;IAerB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,gBAAgB;IAYxB,uFAAuF;YACzE,sBAAsB;IAsBpC,mFAAmF;YACrE,eAAe;YAuDf,mBAAmB;IA0BjC,OAAO,CAAC,YAAY;YAUN,cAAc;YAuBd,oBAAoB;IAgHlC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAkC/B"}
@@ -168,7 +168,7 @@ class MessageHandler {
168
168
  threadName: threadId => this.threadManager.getThread(threadId)?.name,
169
169
  // Queued or pending work counts as busy: a confirmation must never redirect it into another session.
170
170
  isBusy: threadId => this.threadPool.isThreadBusy(threadId) || this.hasThreadQueueState(threadId)
171
- || this.abortOperations.has(threadId) || this.scheduleContextFenced(threadId) || this.isDestroyed || this.automaticUpdateInProgress
171
+ || this.abortOperations.has(threadId) || this.isDestroyed || this.automaticUpdateInProgress
172
172
  || this.delegation.hasActiveTasks(threadId) || this.settingsAdmission.hasCommand(threadId),
173
173
  setBusy: (threadId, busy) => {
174
174
  if (busy) {
@@ -194,11 +194,6 @@ class MessageHandler {
194
194
  abortOperations = new Map();
195
195
  pendingGoalActivations = new Map();
196
196
  automaticUpdateInProgress = false;
197
- // Captured before native release starts. A rejected bounded waiter does not
198
- // retire the underlying host operation or authorize changes to its context.
199
- automaticUpdateScheduleThreads = new Map();
200
- automaticUpdateFailed = false;
201
- automaticUpdateRecovering = false;
202
197
  approvalCardsSupported = false;
203
198
  streamingContextSupported = false;
204
199
  delegationProgressSupported = false;
@@ -232,8 +227,7 @@ class MessageHandler {
232
227
  scheduleCards;
233
228
  schedules;
234
229
  scheduleInitialization;
235
- scheduleRecoveryPending = false;
236
- scheduleRecoveryThreads = new Set();
230
+ scheduleCatalogPending = false;
237
231
  scheduleDelivery;
238
232
  reviewedNativeCleanup = new ReviewedNativeCleanup_1.ReviewedNativeCleanup();
239
233
  schedulePurgeHosts = new Map();
@@ -261,7 +255,7 @@ class MessageHandler {
261
255
  cancel: (owner, id) => this.schedules.cancel(owner, id),
262
256
  exclusive: async (owner, body) => {
263
257
  if (!this.schedules || this.isDestroyed || this.automaticUpdateInProgress
264
- || this.scheduleContextFenced(owner.threadId) || this.scheduleManagement.has(owner.threadId))
258
+ || this.scheduleManagement.has(owner.threadId))
265
259
  throw new Error('Schedule controls are busy.');
266
260
  this.scheduleManagement.add(owner.threadId);
267
261
  try {
@@ -460,13 +454,11 @@ class MessageHandler {
460
454
  this.scheduleResultsSupported = data.capabilities?.scheduleResultsV1 === true;
461
455
  this.scheduleCardsSupported = this.scheduleResultsSupported && data.capabilities?.scheduleCardsV1 === true;
462
456
  this.scheduleToolCardsSupported = this.scheduleCardsSupported && data.capabilities?.scheduleToolCardsV1 === true;
463
- if (this.scheduleResultsSupported) {
464
- void this.recoverSchedules().catch(() => {
465
- if (this.isDestroyed || !this.scheduleResultsSupported)
466
- return;
467
- console.warn('[Schedules] Local schedule recovery is unavailable. Use /schedule list for details.');
468
- });
469
- }
457
+ void this.loadScheduleCatalog().catch(() => {
458
+ if (this.isDestroyed)
459
+ return;
460
+ console.warn('[Schedules] Local schedule catalog is unavailable. Use /schedule list for details.');
461
+ });
470
462
  if (data.capabilities?.outputFilesV1 === true) {
471
463
  try {
472
464
  if (!this.outputFiles) {
@@ -538,40 +530,14 @@ class MessageHandler {
538
530
  });
539
531
  }
540
532
  }
541
- scheduleContextFenced(threadId) {
542
- return this.scheduleRecoveryThreads.has(threadId) || this.automaticUpdateScheduleThreads.has(threadId);
543
- }
544
- releaseSettledUpdateFences() {
545
- if (!this.automaticUpdateScheduleThreads.size || !this.schedules
546
- || this.schedules.hasUnresolvedHandoff() || this.schedules.hasUnresolvedRecovery()
547
- || this.schedules.hasPendingRecovery() || !this.schedules.canSuspendForRestart())
548
- return;
549
- for (const [threadId, generation] of this.automaticUpdateScheduleThreads) {
550
- const executor = this.threadPool.getExistingExecutor(threadId);
551
- try {
552
- if (this.scheduleGeneration(threadId) !== generation || executor?.hasPendingScheduleMutation?.()
553
- || executor?.hasUncertainShutdown?.())
554
- return;
555
- }
556
- catch {
557
- return;
558
- }
559
- }
560
- this.automaticUpdateScheduleThreads.clear();
561
- this.automaticUpdateFailed = false;
562
- }
563
533
  tryBeginAutomaticUpdate() {
564
534
  // Read-only readiness: never replay a release or a recovery just to retry an update.
565
- this.releaseSettledUpdateFences();
566
535
  this.removeExpiredQueueConfirmations();
567
536
  const hasQueuedCommands = Array.from(this.threadQueues.values()).some((queue) => queue.length > 0);
568
537
  const hasRunningThread = this.threadPool.getSummaries().some((thread) => thread.status === 'running');
569
538
  if (this.automaticUpdateInProgress
570
539
  || this.isDestroyed
571
- || this.automaticUpdateScheduleThreads.size > 0
572
- || this.schedules?.hasUnresolvedHandoff() || this.schedules?.hasUnresolvedRecovery()
573
- || this.schedules?.hasPendingRecovery()
574
- || this.scheduleRecoveryPending
540
+ || this.scheduleCatalogPending
575
541
  || this.wsClient.hasPendingTaskResults()
576
542
  || hasRunningThread
577
543
  || hasQueuedCommands
@@ -579,86 +545,25 @@ class MessageHandler {
579
545
  || this.pendingReplaces.size > 0
580
546
  || this.activeThreadOperations.size > 0
581
547
  || this.abortOperations.size > 0
582
- || this.scheduleManagement.size > 0 || this.schedules?.hasActiveSchedules() && !this.schedules.canSuspendForRestart()
583
- || this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id))) {
548
+ || this.scheduleManagement.size > 0 || this.schedules && !this.schedules.canRestartWithoutActiveWork()
549
+ || this.threadManager.listThreads().some(thread => this.settingsAdmission.isBlocked(thread.id)
550
+ || this.threadPool.getExistingExecutor(thread.id)?.hasPendingScheduleMutation?.()
551
+ || this.threadPool.getExistingExecutor(thread.id)?.hasUncertainShutdown?.())) {
584
552
  return false;
585
553
  }
586
554
  this.automaticUpdateInProgress = true;
587
- this.automaticUpdateFailed = false;
588
555
  return true;
589
556
  }
590
557
  async prepareAutomaticUpdate() {
591
558
  if (!this.automaticUpdateInProgress || this.isDestroyed)
592
559
  throw new Error('Automatic update admission expired.');
593
- if (this.schedules?.hasActiveSchedules()) {
594
- for (const thread of this.threadManager.listThreads()) {
595
- if (this.schedules.hasActiveSchedules(thread.id)) {
596
- this.automaticUpdateScheduleThreads.set(thread.id, this.scheduleGeneration(thread.id));
597
- }
598
- }
599
- await this.schedules.suspendForRestart();
600
- }
560
+ if (this.schedules && !this.schedules.canRestartWithoutActiveWork())
561
+ throw new Error('Scheduled work or delivery is active.');
601
562
  if (this.wsClient.hasPendingTaskResults())
602
563
  throw new Error('Result delivery remains pending.');
603
564
  }
604
- async endAutomaticUpdate(failed = false) {
605
- try {
606
- if (failed)
607
- this.automaticUpdateFailed = true;
608
- if (this.automaticUpdateFailed) {
609
- this.releaseSettledUpdateFences();
610
- if (this.automaticUpdateScheduleThreads.size || this.schedules?.hasUnresolvedHandoff()
611
- || this.schedules?.hasUnresolvedRecovery() || this.schedules?.hasPendingRecovery()) {
612
- throw new Error('Native schedule ownership remains unresolved; affected thread admission is retained.');
613
- }
614
- return;
615
- }
616
- await this.restoreAfterAutomaticUpdate();
617
- this.automaticUpdateScheduleThreads.clear();
618
- }
619
- catch (error) {
620
- this.automaticUpdateFailed = true;
621
- throw error;
622
- }
623
- finally {
624
- // The schedule service and exact affected contexts retain their own leases.
625
- // Releasing this global lock never cancels or forgets a native operation.
626
- this.automaticUpdateInProgress = false;
627
- }
628
- }
629
- async restoreAfterAutomaticUpdate() {
630
- if (this.schedules?.hasUnresolvedHandoff())
631
- throw new Error('Native restart handoff remains unresolved; affected thread admission is retained.');
632
- if (!this.schedules?.hasPendingRecovery()) {
633
- if (this.schedules?.hasUnresolvedRecovery())
634
- throw new Error('Native recovery remains blocked; affected thread admission is retained.');
635
- // Terminal-only handoffs still own the predecessor's local admission fence.
636
- // No job needs recreation, but the shared recovery finalizer must release it.
637
- if (this.schedules) {
638
- this.automaticUpdateRecovering = true;
639
- try {
640
- await this.schedules.recover();
641
- }
642
- finally {
643
- this.automaticUpdateRecovering = false;
644
- }
645
- }
646
- return;
647
- }
648
- if (this.isDestroyed)
649
- throw new Error('Shutdown already began; native schedules require startup recovery.');
650
- // Only finalization authorizes restoration. Reconnect during installation must
651
- // never restart native timing under the still-active installer.
652
- this.automaticUpdateRecovering = true;
653
- try {
654
- await this.schedules.recover();
655
- if (this.schedules.hasUnresolvedRecovery()) {
656
- throw new Error('Native schedule restoration remains unresolved; affected thread admission is retained.');
657
- }
658
- }
659
- finally {
660
- this.automaticUpdateRecovering = false;
661
- }
565
+ async endAutomaticUpdate(_failed = false) {
566
+ this.automaticUpdateInProgress = false;
662
567
  }
663
568
  /**
664
569
  * Handle command message — route to the correct thread executor.
@@ -667,19 +572,13 @@ class MessageHandler {
667
572
  const threadId = message.threadId ?? this.threadManager.getDefaultThread().id;
668
573
  const content = message.content?.trim() ?? '';
669
574
  this.messageOpenIds.set(message.messageId, message.openId);
670
- if ((this.automaticUpdateInProgress || this.automaticUpdateScheduleThreads.has(threadId)) && content === '/schedule list') {
575
+ if ((this.automaticUpdateInProgress) && content === '/schedule list') {
671
576
  this.messageOpenIds.set(message.messageId, message.openId);
672
577
  await this.handleScheduleCommand(message, threadId);
673
578
  return;
674
579
  }
675
- if (this.scheduleContextFenced(threadId)
676
- || (this.scheduleRecoveryThreads.size > 0 || this.automaticUpdateScheduleThreads.size > 0) && /^\/backend\s/.test(content) && !/\s@$/.test(content)) {
677
- this.sendResponse(message.messageId, threadId, { success: false,
678
- error: 'Native schedule handoff or recovery is unresolved. Use /schedule list for stored status; conflicting operations remain fenced.' });
679
- return;
680
- }
681
- if (this.scheduleRecoveryPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
682
- this.sendResponse(message.messageId, threadId, { success: false, error: 'Schedule catalog readiness is unresolved. Retry context changes after recovery or inspect /schedule list.' });
580
+ if (this.scheduleCatalogPending && /^\/(?:clear|new|backend|cd|thread\s+delete)(?:\s|$)/.test(content)) {
581
+ this.sendResponse(message.messageId, threadId, { success: false, error: 'Schedule catalog readiness is unresolved. Retry context changes after catalog loading or inspect /schedule list.' });
683
582
  return;
684
583
  }
685
584
  const clearing = content === '/clear' || content === '/new';
@@ -704,7 +603,7 @@ class MessageHandler {
704
603
  };
705
604
  this.messageOpenIds.set(message.messageId, message.openId);
706
605
  if ((0, SessionResumeService_1.isSessionControl)(content) && this.automaticUpdateInProgress) {
707
- this.sendResponse(message.messageId, threadId, { success: false, error: 'Automatic update handoff is in progress. Retry after it finishes.' });
606
+ this.sendResponse(message.messageId, threadId, { success: false, error: 'Automatic update is in progress. Retry after it finishes.' });
708
607
  return;
709
608
  }
710
609
  if ((0, SessionResumeService_1.isSessionControl)(content)) {
@@ -800,11 +699,6 @@ class MessageHandler {
800
699
  return;
801
700
  }
802
701
  const resolvedThreadId = thread.id;
803
- if (this.scheduleContextFenced(resolvedThreadId)) {
804
- this.sendResponse(messageId, resolvedThreadId, { success: false,
805
- error: 'Native schedule handoff or recovery is unresolved for this thread. Use /schedule list for stored status.' });
806
- return;
807
- }
808
702
  if (this.automaticUpdateInProgress) {
809
703
  this.sendResponse(messageId, resolvedThreadId, {
810
704
  success: false,
@@ -1284,8 +1178,6 @@ class MessageHandler {
1284
1178
  const thread = this.threadManager.getThread(request.threadId);
1285
1179
  if (!thread)
1286
1180
  throw new Error('This Worker card has expired. Use the latest Worker card.');
1287
- if (this.scheduleContextFenced(thread.id))
1288
- throw new Error('Native schedule ownership remains unresolved for this thread.');
1289
1181
  await this.delegation.resetWorkerContext(thread, request.laneId, request.generation);
1290
1182
  }
1291
1183
  catch (cause) {
@@ -1354,7 +1246,7 @@ class MessageHandler {
1354
1246
  this.threadPool.setThreadBusy(threadId, false);
1355
1247
  await workers;
1356
1248
  this.sendResponse(messageId, threadId, { success: true,
1357
- output: `${destructiveRecovery ? 'Explicit recovery stopped the Claude host; its session-only schedules were lost. ' : ''}Started a fresh conversation for direct backends and managed workers. Permanent deletion of old managed child native sessions is queued. Verified Codex, Kimi, Pi, and Claude child sessions are supported on Linux; unsupported versions, layouts, backends, platforms, and unconfirmed targets remain pending. Task artifacts and recovery evidence are retained. Pending native writers still block conflicting execution.` }, true);
1249
+ output: `${destructiveRecovery ? 'Explicit reset stopped the Claude host; its session-only schedules were lost. ' : ''}Started a fresh conversation for direct backends and managed workers. Permanent deletion of old managed child native sessions is queued. Verified Codex, Kimi, Pi, and Claude child sessions are supported on Linux; unsupported versions, layouts, backends, platforms, and unconfirmed targets remain pending. Task artifacts and recovery evidence are retained. Pending native writers still block conflicting execution.` }, true);
1358
1250
  }
1359
1251
  catch (error) {
1360
1252
  const detail = error instanceof Error ? error.message : 'Local context storage is unavailable';
@@ -1882,7 +1774,7 @@ You can also use natural language commands to control Claude Code CLI.`,
1882
1774
  async startNextQueuedCommand(threadId) {
1883
1775
  if (this.settingsAdmission.isBlocked(threadId))
1884
1776
  return;
1885
- if (this.scheduleContextFenced(threadId) || this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
1777
+ if (this.threadPool.isThreadBusy(threadId) || this.pausedQueues.has(threadId) || this.abortOperations.has(threadId))
1886
1778
  return;
1887
1779
  const queue = this.threadQueues.get(threadId);
1888
1780
  const command = queue?.shift();
@@ -3508,26 +3400,30 @@ You can also use natural language commands to control Claude Code CLI.`,
3508
3400
  })).digest('hex');
3509
3401
  return path_1.default.join(directory, 'schedules', namespace);
3510
3402
  }
3511
- /** Fence the updater before connection/version callbacks can race catalog recovery. */
3403
+ /** Fence the updater before connection/version callbacks can race catalog loading. */
3512
3404
  async prepareScheduleStartup() {
3405
+ this.threadPool.setScheduleCatalog?.(() => {
3406
+ const directory = this.scheduleDirectory();
3407
+ return directory ? path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE) : undefined;
3408
+ });
3513
3409
  const directory = this.scheduleDirectory();
3514
3410
  if (!directory)
3515
3411
  return;
3516
- this.scheduleRecoveryPending = true;
3412
+ this.scheduleCatalogPending = true;
3517
3413
  try {
3518
3414
  await fs_1.default.promises.lstat(path_1.default.join(directory, ScheduleService_1.SCHEDULE_CATALOG_FILE));
3519
3415
  }
3520
3416
  catch (error) {
3521
3417
  if (['ENOENT', 'ENOTDIR'].includes(error.code ?? '')) {
3522
- this.scheduleRecoveryPending = false;
3418
+ this.scheduleCatalogPending = false;
3523
3419
  return;
3524
3420
  }
3525
3421
  throw error;
3526
3422
  }
3527
3423
  }
3528
- /** Binding recovery waits for transport readiness and never creates an absent catalog. */
3529
- async recoverSchedules() {
3530
- if (this.isDestroyed || !this.scheduleResultsSupported)
3424
+ /** Catalog loading waits for transport readiness and never creates an absent catalog. */
3425
+ async loadScheduleCatalog() {
3426
+ if (this.isDestroyed)
3531
3427
  return;
3532
3428
  if (!this.scheduleInitialization) {
3533
3429
  const directory = this.scheduleDirectory();
@@ -3544,26 +3440,15 @@ You can also use natural language commands to control Claude Code CLI.`,
3544
3440
  }
3545
3441
  // A disconnect or shutdown can happen while storage is being checked. Never
3546
3442
  // create a late service/subscription after shutdown has collected its work.
3547
- if (this.isDestroyed || !this.scheduleResultsSupported)
3548
- return;
3549
- if (this.automaticUpdateFailed && this.automaticUpdateScheduleThreads.size) {
3550
- // Reconnect can retry durable delivery, but must not restart model-mediated
3551
- // reconciliation after a failed update merely to reopen unrelated chat.
3552
- await this.schedules?.retryDeliveries();
3443
+ if (this.isDestroyed)
3553
3444
  return;
3554
- }
3555
- this.scheduleRecoveryPending = true;
3445
+ this.scheduleCatalogPending = true;
3556
3446
  const service = await this.initializeSchedules();
3557
- if (!this.isDestroyed && this.scheduleResultsSupported) {
3558
- if (this.automaticUpdateFailed && this.automaticUpdateScheduleThreads.size) {
3559
- await service.retryDeliveries();
3560
- this.scheduleRecoveryPending = false;
3561
- return;
3562
- }
3563
- await service.recover();
3447
+ // Catalog safety is local and independent of Router delivery capabilities.
3448
+ // Keep a failed initialization fenced; an unreadable catalog is not absence.
3449
+ this.scheduleCatalogPending = false;
3450
+ if (!this.isDestroyed && this.scheduleResultsSupported)
3564
3451
  await service.retryDeliveries();
3565
- this.scheduleRecoveryPending = false;
3566
- }
3567
3452
  }
3568
3453
  initializeSchedules() {
3569
3454
  if (this.scheduleInitialization)
@@ -3578,67 +3463,10 @@ You can also use natural language commands to control Claude Code CLI.`,
3578
3463
  directory,
3579
3464
  isNativeMutationPending: owner => this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingScheduleMutation?.() ?? false,
3580
3465
  withPurgeVerification: (record, context, accept) => (0, SchedulePurgeVerification_1.verifySchedulePurge)(record, this.schedulePurgeHosts.get(record.threadId), context.isCurrent, accept),
3581
- acquireRecovery: record => {
3582
- if (this.scheduleRecoveryThreads.has(record.threadId))
3583
- throw new Error('Recovery thread admission unavailable.');
3584
- this.scheduleRecoveryThreads.add(record.threadId);
3585
- return () => { this.scheduleRecoveryThreads.delete(record.threadId); };
3586
- },
3587
- canRecover: record => {
3588
- try {
3589
- if (this.isDestroyed || this.automaticUpdateInProgress && !this.automaticUpdateRecovering || !this.scheduleResultsSupported || !this.wsClient.isConnected()
3590
- || this.scheduleGeneration(record.threadId) !== record.generation
3591
- || this.threadPool.getBackendKey(record.threadId) !== record.backend)
3592
- return false;
3593
- const thread = this.threadManager.getThread(record.threadId);
3594
- const configuration = this.executorConfiguration();
3595
- if (record.execution?.command !== configuration[record.backend]?.command)
3596
- return false;
3597
- const cwd = this.directoryGuard.resolveWorkingDirectory(thread.workingDirectory);
3598
- (0, WorkingDirectory_1.assertWorkingDirectoryExists)(cwd);
3599
- if (cwd !== record.cwd || this.threadPool.isThreadBusy(record.threadId) && !this.scheduleRecoveryThreads.has(record.threadId)
3600
- || this.activeThreadOperations.has(record.threadId) || this.scheduleManagement.has(record.threadId)
3601
- || this.abortOperations.has(record.threadId) || this.coordinatorPreparations.has(record.threadId)
3602
- || this.settingsAdmission.isBlocked(record.threadId) || this.settingsAdmission.hasCommand(record.threadId)
3603
- || this.hasThreadQueueState(record.threadId) || this.delegation.hasActiveTasks(record.threadId))
3604
- return false;
3605
- this.scheduleOwners.set(record.threadId, { threadId: record.threadId, openId: record.openId, generation: record.generation });
3606
- return true;
3607
- }
3608
- catch {
3609
- return false;
3610
- }
3611
- },
3612
- provider: { recoveryFor: input => {
3466
+ provider: { cleanupFor: input => {
3613
3467
  if (!input.threadId || this.threadPool.getBackendKey(input.threadId) !== input.backend)
3614
3468
  return undefined;
3615
- // Capability lookup never starts native work. Native adapters opt in only
3616
- // when they implement inventory reconciliation and original-session ownership.
3617
- const executor = this.threadPool.getExecutor(input.threadId);
3618
- const capability = executor.nativeScheduleRecovery;
3619
- if (!capability)
3620
- return undefined;
3621
- return { ...capability, reconcile: async (record, context, emit) => {
3622
- if (!context.isCurrent())
3623
- throw new Error('Schedule recovery context changed.');
3624
- if (executor.configureManagedTools) {
3625
- const bridge = this.delegationBridges.get(record.threadId) ?? new DelegationBridge_1.DelegationBridge();
3626
- this.delegationBridges.set(record.threadId, bridge);
3627
- const thread = this.threadManager.getThread(record.threadId);
3628
- const connection = await bridge.start((0, DelegationSettings_1.isDelegationEnabled)(thread) ? ['delegation', 'scheduling'] : ['scheduling']);
3629
- if (!context.isCurrent())
3630
- throw new Error('Schedule recovery context changed.');
3631
- await executor.configureManagedTools(connection);
3632
- }
3633
- if (!context.isCurrent())
3634
- throw new Error('Schedule recovery context changed.');
3635
- return capability.reconcile(record, context, event => {
3636
- const settled = emit(event);
3637
- if (event.type === 'completed')
3638
- queueMicrotask(() => { void this.startNextQueuedCommand(record.threadId); });
3639
- return settled;
3640
- });
3641
- } };
3469
+ return this.threadPool.getExecutor(input.threadId).nativeScheduleCleanup;
3642
3470
  }, create: (input, onEvent, canAdmitOccurrence) => {
3643
3471
  const backend = input.backend === undefined ? 'claude' : input.backend;
3644
3472
  let executor;
@@ -3733,8 +3561,6 @@ You can also use natural language commands to control Claude Code CLI.`,
3733
3561
  }
3734
3562
  }
3735
3563
  async assertSchedulesIdle(threadId, preserveCleanupContext = true) {
3736
- if (this.scheduleContextFenced(threadId))
3737
- throw new Error('Native schedule ownership remains unresolved for this thread.');
3738
3564
  if (preserveCleanupContext)
3739
3565
  await this.assertScheduleCleanupContext(threadId);
3740
3566
  if (this.scheduleManagement.has(threadId) || this.schedules?.hasActiveSchedules(threadId)) {
@@ -3777,8 +3603,8 @@ You can also use natural language commands to control Claude Code CLI.`,
3777
3603
  return false;
3778
3604
  }
3779
3605
  };
3780
- const check = () => { if (!current() || this.automaticUpdateInProgress || this.scheduleContextFenced(owner.threadId))
3781
- throw new Error('Scheduling context changed or client is shutting down/updating/recovering.'); };
3606
+ const check = () => { if (!current() || this.automaticUpdateInProgress)
3607
+ throw new Error('Scheduling context changed or client is shutting down/updating.'); };
3782
3608
  check();
3783
3609
  if (command.kind === 'list' && this.threadPool.getExistingExecutor(owner.threadId)?.hasPendingCancellation?.()) {
3784
3610
  const service = await this.initializeSchedules();
@@ -3907,8 +3733,7 @@ You can also use natural language commands to control Claude Code CLI.`,
3907
3733
  const current = () => {
3908
3734
  try {
3909
3735
  return !this.isDestroyed && !this.automaticUpdateInProgress && this.wsClient.isConnected()
3910
- && epoch === this.imageConnectionEpoch && this.scheduleGeneration(owner.threadId) === owner.generation
3911
- && !this.scheduleContextFenced(owner.threadId) && !this.abortOperations.has(owner.threadId)
3736
+ && epoch === this.imageConnectionEpoch && this.scheduleGeneration(owner.threadId) === owner.generation && !this.abortOperations.has(owner.threadId)
3912
3737
  && this.threadPool.getBackendKey(owner.threadId) === backend
3913
3738
  && this.threadPool.getExistingExecutor(owner.threadId) === executor
3914
3739
  && capturedSettings === settings() && (!inTurnCurrent || inTurnCurrent());
@@ -3944,8 +3769,9 @@ You can also use natural language commands to control Claude Code CLI.`,
3944
3769
  const records = await service.list(owner);
3945
3770
  const needsVerification = backend === 'claude' && !!executor.withReviewedNativeCleanup && (cleanup.some(item => ids.includes(item.id) && item.backend === 'claude' && !!item.attribution && !!item.nativeId) || records.some(record => ids.includes(record.id)
3946
3771
  && record.backend === 'claude' && !!record.recovery && !!record.nativeId && !record.cleanupConfirmed && !record.creationRefused && !['active', 'running', 'creating'].includes(record.state)));
3947
- const needsNative = needsVerification || backend === 'claude' && records.some(record => ids.includes(record.id)
3948
- && record.backend === 'claude' && service.canCancel(owner, record.id));
3772
+ const needsNative = needsVerification || ['claude', 'agy'].includes(backend) && records.some(record => ids.includes(record.id)
3773
+ && record.backend === backend && (service.canCancel(owner, record.id)
3774
+ || backend === 'agy' && service.needsNativePurge(owner, record.id)));
3949
3775
  if (!needsNative)
3950
3776
  return await run();
3951
3777
  if (!executor.withNativeScheduleOperation)
@@ -3992,7 +3818,7 @@ You can also use natural language commands to control Claude Code CLI.`,
3992
3818
  const config = settings();
3993
3819
  const current = () => {
3994
3820
  try {
3995
- return !this.isDestroyed && !this.automaticUpdateInProgress && !this.scheduleContextFenced(threadId)
3821
+ return !this.isDestroyed && !this.automaticUpdateInProgress
3996
3822
  && !this.abortOperations.has(threadId) && this.wsClient.isConnected() && epoch === this.imageConnectionEpoch
3997
3823
  && this.scheduleGeneration(threadId) === owner.generation && this.threadPool.getExistingExecutor(threadId) === executor
3998
3824
  && this.threadPool.getBackendKey(threadId) === 'claude' && config === settings() && (!inTurnCurrent || inTurnCurrent());
@@ -4118,7 +3944,7 @@ You can also use natural language commands to control Claude Code CLI.`,
4118
3944
  return;
4119
3945
  }
4120
3946
  const storedOnly = command.kind === 'list' && this.threadPool.getExistingExecutor(threadId)?.hasPendingCancellation?.();
4121
- const updateSnapshot = (this.automaticUpdateInProgress || this.automaticUpdateScheduleThreads.has(threadId)) && command.kind === 'list';
3947
+ const updateSnapshot = (this.automaticUpdateInProgress) && command.kind === 'list';
4122
3948
  const records = updateSnapshot ? await this.schedules?.list(owner) ?? []
4123
3949
  : await this.runScheduleOperation(owner, command.kind === 'list' ? { kind: 'list' } : command);
4124
3950
  const record = records[0];
@@ -4128,12 +3954,7 @@ You can also use natural language commands to control Claude Code CLI.`,
4128
3954
  else if (command.kind === 'cancel')
4129
3955
  output = `Schedule ${record.id}: ${record.state}.`;
4130
3956
  else {
4131
- const lifecycle = record.recovery
4132
- ? record.backend === 'agy' ? 'AGY recovery requires exact host retirement before every possible first wake and no unknown queued work. Eligible future definitions recover in the original conversation; due work and dirty shutdowns remain blocked.'
4133
- : `Managed jobs recover automatically after a confirmed orderly restart. Dirty shutdowns remain blocked. ${record.recovery.handoffPolicy === 'skip-unadmitted'
4134
- ? 'Fired occurrences not yet admitted to execution may be skipped without replay; admitted work must finish.'
4135
- : 'Queued and executing occurrences must finish before handoff.'}`
4136
- : 'This host does not support automatic schedule recovery after process exit.';
3957
+ const lifecycle = 'Schedules run only while their native host remains live. After host loss they are interrupted and never automatically restored. Native history and exact cleanup obligations are retained.';
4137
3958
  output = `Schedule ${record.id}: ${record.state}.\n${record.rule.kind === 'once' ? record.rule.at : `${record.rule.expression} (${record.rule.timezone})`}\n\nRuns in this thread's foreground ${ScheduleCapabilities_1.NATIVE_SCHEDULE_CAPABILITIES[record.backend].label} conversation and returns results here. Keep the CLI running; native timing is approximate. ${lifecycle}\nUse /schedule list or /schedule cancel ${record.id}.`;
4138
3959
  }
4139
3960
  if (command.kind === 'list') {
@@ -4146,7 +3967,7 @@ You can also use natural language commands to control Claude Code CLI.`,
4146
3967
  if (storedOnly)
4147
3968
  output = `Native cancellation cleanup is pending. This is the stored catalog, not a fresh native inventory. Retry /abort; /clear stops the host and loses session-only schedules.\n\n${output}`;
4148
3969
  if (updateSnapshot)
4149
- output = `Automatic update handoff: stored catalog only, not fresh native inventory. Unconfirmed work remains fenced; inspect the CLI diagnostic before an explicit service stop/restart.\n\n${output}`;
3970
+ output = `Automatic update: stored catalog only, not fresh native inventory. Unconfirmed work remains fenced; inspect the CLI diagnostic before an explicit service stop/restart.\n\n${output}`;
4150
3971
  respond({ success: true, scheduleMenu: updateSnapshot ? undefined : menuFor(owner, records), output });
4151
3972
  }
4152
3973
  catch (error) {
@@ -4185,7 +4006,7 @@ You can also use natural language commands to control Claude Code CLI.`,
4185
4006
  revision: (0, crypto_1.createHash)('sha256').update(JSON.stringify({ thread: projection(thread), all, config: this.executorConfiguration() })).digest('hex') };
4186
4007
  }
4187
4008
  settingsBusy(threadId, exceptRequest, includeQueue = true, setting) {
4188
- return this.isDestroyed || this.automaticUpdateInProgress || this.scheduleContextFenced(threadId) || (setting === 'model' ? this.threadPool.isThreadBusy(threadId, 'model') : this.threadPool.isThreadBusy(threadId))
4009
+ return this.isDestroyed || this.automaticUpdateInProgress || (setting === 'model' ? this.threadPool.isThreadBusy(threadId, 'model') : this.threadPool.isThreadBusy(threadId))
4189
4010
  || this.delegation.hasActiveTasks(threadId) || this.abortOperations.has(threadId)
4190
4011
  || this.coordinatorPreparations.has(threadId) || this.settingsAdmission.hasCommand(threadId, exceptRequest) || (includeQueue && this.hasThreadQueueState(threadId));
4191
4012
  }
@@ -4310,8 +4131,6 @@ You can also use natural language commands to control Claude Code CLI.`,
4310
4131
  async applyBackendSetting(threadId, backend, scope, followGlobal = false) {
4311
4132
  try {
4312
4133
  for (const thread of scope === 'all' ? this.threadManager.listThreads() : [{ id: threadId }]) {
4313
- if (this.scheduleContextFenced(thread.id))
4314
- throw new Error('Native schedule ownership remains unresolved for an affected thread.');
4315
4134
  this.threadManager.contextResets.assertReady(thread.id);
4316
4135
  }
4317
4136
  if (followGlobal) {
@@ -4470,12 +4289,7 @@ You can also use natural language commands to control Claude Code CLI.`,
4470
4289
  * Destroy handler and all executors
4471
4290
  */
4472
4291
  async destroy() {
4473
- // Fence new commands first, but keep result acknowledgements alive while a
4474
- // waiting schedule races the orderly drain. No foreground work is killed here.
4475
- if (!this.isDestroyed && this.schedules?.hasActiveSchedules() && this.schedules.canSuspendForRestart()) {
4476
- this.automaticUpdateInProgress = true;
4477
- await this.schedules.suspendForRestart();
4478
- }
4292
+ this.isDestroyed = true;
4479
4293
  this.directoryBrowser.destroy();
4480
4294
  this.settingsService.destroy();
4481
4295
  this.scheduleCards.destroy();
@@ -4494,19 +4308,6 @@ You can also use natural language commands to control Claude Code CLI.`,
4494
4308
  await this.outputFiles?.destroy();
4495
4309
  this.notificationAdapter.unregister();
4496
4310
  try {
4497
- // Native recovery handoff must finish before executor destruction can stop
4498
- // its original host. An uncertain handoff keeps that host owned for retry.
4499
- await this.scheduleInitialization?.then(service => service.requiresShutdownHandoff() ? service.destroy() : undefined, () => undefined);
4500
- // Uncheckpointed AGY work has no queue-drain contract. Retire its exact owned
4501
- // group before the catalog asks a handle to stop; never race a management
4502
- // prompt against host teardown or mistake definition deletion for retirement.
4503
- // Teardown uses stored backend summaries, not execution admission. A
4504
- // corrupt reset generation must still block execution, but not host exit.
4505
- for (const thread of this.threadPool.getSummaries()) {
4506
- if (thread.backend === 'agy') {
4507
- await this.threadPool.getExistingExecutor(thread.id)?.destroy();
4508
- }
4509
- }
4510
4311
  const results = await Promise.allSettled([
4511
4312
  this.scheduleInitialization?.then(service => service.destroy(), () => undefined),
4512
4313
  this.delegation.destroy(),