You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "hqhq1025 (via GitHub)" <gi...@apache.org> on 2026/09/09 02:02:02 UTC

Re: [PR] fix(runtime-host): distinguish idle retention from active background work [maka]

hqhq1025 commented on code in PR #5060:
URL: https://github.com/apache/maka/pull/5060#discussion_r3963964980


##########
packages/runtime/src/goal-continuation.ts:
##########
@@ -598,12 +600,16 @@ export class GoalContinuationCoordinator {
   private scheduleDrain(lane: SessionLane): void {
     if (!this.isCurrent(lane) || lane.draining) return;
     if (this.handoffHeld && lane.queue.length === 0) return;
+    const activity = this.deps.acquireActivity?.();
     const task = this.drainLane(lane).catch((error) => {
       if (!this.isCurrent(lane)) return;
       this.pauseCurrentGoal(lane, `Goal continuation coordinator failed: ${errorMessage(error)}`);
     });
     this.activeDrains.add(task);
-    void task.finally(() => this.activeDrains.delete(task));
+    void task.finally(() => {
+      this.activeDrains.delete(task);
+      activity?.release();

Review Comment:
   ### [P2] Keep the Goal activity lease until hosted admission owns one
   
   This releases the new drain residency when `drainLane()` returns, but `tryAdmitIntent()` only calls `admission.start()` and does not await that promise. In production, `HostGoalExecutionCoordinator.start()` is still awaiting `prepared.admit()` at that point, and `RootTurnCoordinator` does not acquire the hosted-execution residency until after its asynchronous admission gates (`root-turn-coordinator.ts:2511`). A controlled probe using these production classes held `prepared.admit()` pending and observed `activeCount=1` but `drainCount=0`: only the durable Goal idle lease remained. Consequently `host.diagnostics.query` and `host.upgrade.prepare` can classify this in-progress admission as idle and retire the Host without interruption consent. Please retain or transfer a drain lease until hosted admission has acquired its own residency, and add a regression that blocks `prepared.admit()` while asserting the drain count stays nonzero.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org