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

[PR] fix(runtime-host): include daily review in safe host handoff [maka]

M4n5ter opened a new pull request, #5060:
URL: https://github.com/apache/maka/pull/5060

   <details open>
   <summary>English</summary>
   
   ## Summary
   
   Enabling scheduled Daily Review kept an otherwise idle Host from completing a cooperative handoff: its scheduler retained a background-work lease that the handoff did not account for. Startup could therefore show zero operations while still requiring “Stop and continue.”
   
   Pause scheduled triggers during handoff, let admitted review generation finish, and include the idle scheduler's lease in the handoff proof. Cancellation resumes scheduling; the successor restores the persisted configuration. Track active generation separately so its completion changes the activity snapshot and allows another automatic attempt after a timeout.
   
   ## Verification
   
   - 53 tests passed across `daily-review-coordinator`, `execution-composition`, `host-handoff`, and `host-retirement`; 8 selected Host kernel handoff/residency tests also passed.
   - The new production-composition regression fails at the remaining-residency assertion when run with the pre-fix composition, and passes with this change.
   - `npm run lint`, `npm run format:check`, `npm run build`, and `npm run typecheck` passed.
   - `npx knip --workspace apps/desktop`, `npx knip --workspace packages/ui`, ASF header checks, the protocol epoch guard, and `git diff --check` passed.
   - The full repository test suite and a manual Desktop startup test were not run.
   
   Behavior evidence from the test output:
   
   ```text
   ✔ Daily Review handoff fences an admitted timer tick and cancellation resumes a due review
   ✔ Daily Review handoff waits for an active analysis to publish without interrupting it
   ✔ an idle enabled Daily Review scheduler participates in production handoff and recovers in the successor
   ```
   
   ## AI use
   
   - [ ] No generative tool made a substantive contribution
   - [x] Generative tooling made a substantive contribution
   
   Tool(s) and scope: OpenAI Codex investigated the lifecycle, implemented the fix and regression tests, ran verification, and prepared this PR. The commit includes `Generated-by: OpenAI Codex`; retain it in the final squash commit.
   
   ## Checklist
   
   - [x] Tests cover the change and fail without it
   - [x] Lint, format, typecheck and the affected suites pass locally
   
   Does this PR entail a change in behavior?
   
   - [x] Yes — described under Summary above
   - [ ] No
   
   </details>
   
   <details>
   <summary>简体中文</summary>
   
   ## Summary
   
   启用每日回顾的定时分析后,即使 Host 没有正在执行的操作,调度器仍持有后台工作占用,而协作交接没有处理这份占用。因此启动时可能显示操作数为 0,却仍要求“停止并继续”。
   
   交接期间暂停定时触发,等待已开始的回顾生成完成,并把空闲调度器的占用纳入交接证明。取消交接后恢复调度,后继服务按持久化配置恢复。实际生成过程单独记录占用,使其完成后活动快照发生变化,允许超时后的自动交接再次尝试。
   
   ## Verification
   
   - `daily-review-coordinator`、`execution-composition`、`host-handoff`、`host-retirement` 共 53 项测试通过;另有 8 项 Host 内核交接及后台占用相关测试通过。
   - 将生产组合替换为修复前实现时,新增回归用例在“仍有未处理占用”的断言处失败;应用修复后通过。
   - `npm run lint`、`npm run format:check`、`npm run build`、`npm run typecheck` 均通过。
   - `npx knip --workspace apps/desktop`、`npx knip --workspace packages/ui`、ASF 文件头检查、协议 epoch 检查及 `git diff --check` 均通过。
   - 未运行全仓库测试,也未进行桌面端手动启动验证。
   
   测试输出中的行为证据:
   
   ```text
   ✔ Daily Review handoff fences an admitted timer tick and cancellation resumes a due review
   ✔ Daily Review handoff waits for an active analysis to publish without interrupting it
   ✔ an idle enabled Daily Review scheduler participates in production handoff and recovers in the successor
   ```
   
   ## AI use
   
   - [ ] 生成式工具没有作出实质贡献
   - [x] 生成式工具作出了实质贡献
   
   工具及范围:OpenAI Codex 排查生命周期逻辑、实现修复与回归测试、执行验证并准备本 PR。提交包含 `Generated-by: OpenAI Codex`,请在最终 squash 提交中保留。
   
   ## Checklist
   
   - [x] 测试覆盖本次变更,且没有修复时会失败
   - [x] Lint、格式、类型检查及受影响的测试套件在本地通过
   
   本 PR 是否改变行为?
   
   - [x] 是,已在上方 Summary 中说明
   - [ ] 否
   
   </details>
   


-- 
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


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

Posted by "hqhq1025 (via GitHub)" <gi...@apache.org>.
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


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

Posted by "M4n5ter (via GitHub)" <gi...@apache.org>.
M4n5ter merged PR #5060:
URL: https://github.com/apache/maka/pull/5060


-- 
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