@adhdev/daemon-core 0.9.82-rc.392 → 0.9.82-rc.393

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-core",
3
- "version": "0.9.82-rc.392",
3
+ "version": "0.9.82-rc.393",
4
4
  "description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -46,7 +46,7 @@
46
46
  "author": "vilmire",
47
47
  "license": "AGPL-3.0-or-later",
48
48
  "dependencies": {
49
- "@adhdev/mesh-shared": "0.9.82-rc.392",
49
+ "@adhdev/mesh-shared": "0.9.82-rc.393",
50
50
  "@adhdev/session-host-core": "*",
51
51
  "@agentclientprotocol/sdk": "^0.16.1",
52
52
  "ajv": "^8.20.0",
@@ -1036,6 +1036,28 @@ function injectMeshSystemMessage(components: DaemonComponents, args: {
1036
1036
  || resolveActiveDirectDispatchTaskId(args.meshId, sessionId);
1037
1037
  completedTaskForLedger = markSessionTerminal(sessionId, 'failed');
1038
1038
  }
1039
+ } else if (args.event === 'worktree_bootstrap_complete' || args.event === 'worktree_bootstrap_failed') {
1040
+ // WORKTREE-BOOTSTRAP-REFIRE: the agent:ready branch above DEFERS the queue claim while
1041
+ // worktreeBootstrap.status === 'running' — a freshly cloned worktree emits agent:ready at
1042
+ // its idle prompt BEFORE bootstrap finishes, and dispatching then produces a half-built
1043
+ // session. The defer registers the idle session (setRemoteIdleSession) but schedules NO
1044
+ // retry; it relies on "the next agent:ready / reconcile drain tick" to re-fire. But
1045
+ // agent:ready is a one-shot (emitAgentReadyOnce, guarded by agentReadyEmitted) and the
1046
+ // session stays idle→idle after bootstrap, so no new agent:ready edge ever fires → the
1047
+ // deferred claim is stranded → the worker session boots empty (totalMessages=0) and the
1048
+ // coordinator relaunch/stop-loops. Re-fire the queue drain on the terminal bootstrap
1049
+ // transition: the idle session registered at defer time is now claimable (tryAssignQueueTask
1050
+ // has no bootstrap gate of its own). This runs on whichever daemon processes the event —
1051
+ // the local worker (when it co-hosts the coordinator) at emit time, or the remote
1052
+ // coordinator after it pulls the queued event — so the registered local/remote idle session
1053
+ // is drained in every topology. 'failed' is re-fired too so a deferred-then-failed bootstrap
1054
+ // dispatches and fails loudly/visibly rather than stranding silently. Falls through to the
1055
+ // coordinator broadcast below — the bootstrap event is still delivered to the coordinator.
1056
+ setImmediate(() => {
1057
+ triggerMeshQueue(components, args.meshId).catch((e: any) => {
1058
+ LOG.warn('MeshQueue', `Queue re-fire after ${args.event} failed (mesh ${args.meshId}): ${e?.message || e}`);
1059
+ });
1060
+ });
1039
1061
  }
1040
1062
 
1041
1063
  const ledgerKind = EVENT_TO_LEDGER_KIND[args.event];