feat(workhub): project delegated execution status - #4115
Conversation
EnglishReviewed at exact head Blocking concern: the projection follows the admission Turn, not the delegated MessageThe durable assignment records However, the existing Message authority explicitly allows an unconsumed steering Message to be folded into the follow-up queue when its original Turn ends, then executed by a fresh successor Turn. This is already covered by the existing “lone folded steering entry” regression test. A supported path is therefore:
The displayed lifecycle would describe the admission Turn, not the execution of the delegated work. The same mismatch would make future linked correction or Stop ownership target the wrong Turn. The recovery change exposes the same underlying issue for concurrent pending admissions: if multiple pending steering admissions carry different preassigned identities, Suggested directionThe stable identity of a delegation should be the target Message, not its initial Turn.
In that model:
Alternatively, if the product contract requires one immutable target Turn, admission must guarantee that the delegated Message can never migrate to a successor. Preserving selected root identities only during one recovery path is not sufficient. The hybrid acknowledgement, rebuildable projection, generation fence, and UI navigation all look reasonable, but I think this identity boundary needs to be corrected before the execution-status contract is reliable. 简体中文审查的精确 head 为 阻塞问题:投影跟随的是 admission Turn,而不是被委托的 Message持久 assignment 会记录 admission 时目标 root state 中的 但现有 Message authority 明确允许尚未被消费的 steering Message 在原 Turn 结束时折叠到 follow-up queue,并由新的 successor Turn 执行。仓库现有的 “lone folded steering entry” 回归测试也确认了这是正式支持的行为。 因此存在以下受支持路径:
此时界面展示的是 admission Turn 的生命周期,而不是被委托工作的实际执行状态。未来实现 linked correction 或 Stop ownership 时,同样可能控制错误的 Turn。 并发 pending admission 的恢复也暴露了相同根因:当多个 pending steering admission 携带不同的预分配 identity 时, 建议方向delegation 的稳定身份应该是目标 Message,而不是它最初进入的 Turn。
在这个模型中:
另一种选择是:如果产品契约要求目标 Turn 永远不可变,那么 admission 必须保证 delegated Message 永远不会迁移到 successor。只在某一条 recovery 路径中保留预选 root identity,并不足以建立这个保证。 Hybrid acknowledgement、可重建 projection、generation fence 和 UI navigation 本身都比较合理,但在 execution-status contract 可靠之前,我认为需要先修正这个 identity 边界。 |
c988829 to
bf55aab
Compare
bf55aab to
1cfa4d6
Compare
EnglishRe-reviewed at exact head The previous blocking issue is resolved: the delegated Message is now the stable identity, and the Message authority resolves its actual owning Turn across steering rollover and recovery aggregation. Blocking: a cancelled delegation remains
|
1cfa4d6 to
4343a96
Compare
Astro-Han
left a comment
There was a problem hiding this comment.
Thanks for working through the Message-ownership and cancellation cases. The resulting authority direction now looks right: the delegated Message is the stable identity, Runtime resolves its actual owning Turn, and WorkHub rebuilds a read-only projection from target-owned facts.
My remaining concern is the shape of the PR as a whole. The raw diff size is not itself the problem, but the current change adds 1,164 lines while removing 33, and several mechanisms introduced under the earlier immutable-targetTurnId premise remain after the later correction replaced that premise with Message-based ownership.
For this slice, I think we should converge on one authority and remove what the new design makes redundant:
targetMessageIdshould be the sole stable delegation identity. Recovery can choose the actual successor Turn normally, and the Runtime Message authority can resolve that ownership.- recorded terminal facts should own
completed/failed/aborted, while exact live membership should ownrunning/waiting_for_user. - production and controller tests should exercise one Action Gate execution authority. The useful R2.4 routing and correction specifications can remain, but they should live at a pure policy seam or in the gated harness rather than preserving a parallel direct
create/submit/stopexecutor. - fields and recovery branches that became unconsumed after the ownership correction should disappear from the final diff.
The feature can still require meaningful new code. The concern is that the replacement currently coexists with concepts and paths it superseded, so the slice has not yet reduced the codebase's authority or maintenance entropy. Since the PR already needs a rebase, could we use that pass to re-derive the minimum coherent design and remove those leftovers here rather than deferring the cleanup?
AI-assisted review disclosure: Codex performed a read-only review of the exact-head diff and traced the ownership, recovery, liveness, and controller-composition paths. Astro-Han reviewed and approved this text before posting. No product tests were run as part of this review.
a1e0d76 to
3c9b4dc
Compare
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
Generated-by: Codex
3c9b4dc to
3a1208e
Compare
|
Post-merge review of source head The PR merged while this review was in progress. I found three high-priority correctness issues and one refresh-amplification issue that remain in current [P1] Render the durable delegation row during the same visit
In a targeted test, a local successful submission plus its durable assignment with Please replace or merge the local placeholder as soon as the matching durable assignment arrives, and add a surface regression that observes a terminal feedback update without remounting WorkHub. [P1] Do not strand an idle assignment behind a competing root TurnThe Action Gate atomically stores an idle assignment with preselected There is no terminal-settlement retry for this admission: the only production calls are the immediate fire-and-forget attempt and Host-start recovery. The assignment can therefore remain durably The later #3923 change adds durable proof for legacy Root source Messages, but it does not add the missing retry. Re-running the competing-root test on current Please make normal root settlement consume still-pending canonical admissions, or otherwise schedule a durable retry after this race, and cover the exact assignment-commit -> competing-root -> terminal interleaving. [P1] Fence
|
Summary
Deliver Slice 5-B execution feedback on top of the durable delegation linkage from #3935:
delegation_assignedrecord immediately as acceptedThe target ordinary Session remains the only execution authority. This PR does not add
replace, Stop ownership, supersession, or destructive correction.Refs #3492
Proposal: #3286
Design choice: hybrid first response
The durable assignment is the immediate acknowledgement; WorkHub does not wait for target completion before confirming acceptance. It then joins the immutable delegation link to the exact target Turn and Session live state. Terminal Turn facts win, exact live membership projects running/waiting, unreadable authority projects recovering, and a not-yet-observed Turn remains accepted.
Execution status stays a rebuildable read model. Session change notifications invalidate it, opening WorkHub reconstructs it, and a generation fence drops stale asynchronous reads. No mutable coordination-status record or second recovery state machine is introduced.
Runtime recovery preserves a preassigned future root identity only for current-Turn steering admissions. Ordinary next-Turn follow-ups carry their predecessor identity, so they continue to receive a fresh successor rather than becoming self-referential.
Verification
npm run lint— PASSnpm run format:check— PASSnpm run build— PASSnpm run typecheck— PASSnpx knip --workspace apps/desktop— PASSnpx knip --workspace packages/ui— PASSnpm --workspace @maka/runtime-host test— PASS (1357 tests; 1348 passed, 9 skipped, 0 failed)npm --workspace @maka/desktop test— PASS (1644/1644)WorkHub rebuilds delegated execution feedback after navigating away and backWorkHub defers destructive correction until linked delegation existsgit diff --check upstream/main..HEAD— PASSThe WorkHub Electron E2E output is the user-visible behavior evidence for this change. It exercises delegation feedback reconstruction after leaving and reopening WorkHub.
Exact verified head:
179ba06afbf05d0648c400f7bd17a12cbc031af3.AI use
Select exactly one:
Tool(s) and scope: Codex implemented the production and test changes, updated the ADR, investigated identity recovery behavior, and ran the listed verification. The commit includes the required
Generated-by: Codextrailer.Checklist
Does this PR entail a change in behavior?