Browse Source

fix(session.idle): wake orchestrator via promptAsync when job reconciled from idle

When a background child session goes idle and its job is reconciled on
the board, the orchestrator had no way to know — it sat idle until the
next user input. Now the session.idle handler calls promptAsync on the
parent orchestrator session with a nudge, so it immediately sees the
updated Background Job Board and reconciles the result.
Michael Henke 3 weeks ago
parent
commit
67ff952ac6
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/hooks/task-session-manager/index.ts

+ 11 - 0
src/hooks/task-session-manager/index.ts

@@ -1129,6 +1129,17 @@ export function createTaskSessionManagerHook(
             taskContextTracker.contextFilesForPrompt(sessionId),
           );
           taskContextTracker.prune(backgroundJobBoard);
+          // Wake the orchestrator so it sees the updated board immediately.
+          if (job.parentSessionID && sessionSdk?.promptAsync) {
+            sessionSdk.promptAsync({
+              path: { id: job.parentSessionID },
+              body: {
+                parts: [createInternalAgentTextPart(
+                  'A background job completed. Check the Background Job Board and reconcile the results.',
+                )],
+              },
+            }).catch(() => {});
+          }
         }
         return;
       }