Skip to content

feat(workhub): add linked delegation correction - #4242

Open
ARE404 wants to merge 4 commits into
apache:mainfrom
ARE404:feat/workhub-linked-correction
Open

feat(workhub): add linked delegation correction#4242
ARE404 wants to merge 4 commits into
apache:mainfrom
ARE404:feat/workhub-linked-correction

Conversation

@ARE404

@ARE404 ARE404 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Persist bounded WorkHub coordination-to-execution linkage through the existing Session, Turn, Message, and event authorities instead of introducing a second lifecycle or transcript store.
  • Rebuild active delegation linkage across Runtime Host restart and project target acceptance, running, waiting, completion, failure, abort, and recovery back into WorkHub.
  • Support explicit natural-language correction as a linked replacement while preserving transcript order, cancelling the exact pending Message or stopping only the exact WorkHub-owned Turn.
  • Keep routing advisory: the Runtime Host independently validates correction intent, source delegation ownership, target state, and the Action Gate before any destructive effect.

Refs #3492

Verification

  • npm --workspace @maka/desktop run build:workspace-deps
  • npm --workspace @maka/desktop run typecheck
  • npm --workspace @maka/desktop run build:main
  • Affected WorkHub Desktop, core, storage, and Runtime Host suites: 124 passed, 0 failed
  • npm run check:asf-headers
  • git diff --check upstream/main...HEAD

Review focus

  • The first durable replacement intent wins in coordination transcript order.
  • Active linkage is rebuilt from the complete durable transcript independently of the bounded visible timeline.
  • A correction cannot stop arbitrary work: it must name an active source delegation and the Runtime Host stops only that delegation's expected Turn.
  • The Stop-to-submit recovery seam remains replay-safe and fail-closed.

AI use

Select exactly one:

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: OpenAI Codex implemented the change, tests, documentation, and adversarial review under human direction. The commit includes the required Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/XL Over 1000 readable lines label Aug 30, 2026
@ARE404
ARE404 force-pushed the feat/workhub-linked-correction branch 3 times, most recently from 75d1c5e to 44d5a26 Compare August 30, 2026 06:09
@ARE404
ARE404 marked this pull request as ready for review August 30, 2026 08:48
@ARE404
ARE404 requested review from Astro-Han and M4n5ter August 30, 2026 08:48
@ARE404
ARE404 force-pushed the feat/workhub-linked-correction branch from 5ccc341 to e8905df Compare August 30, 2026 11:00

@Astro-Han Astro-Han left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for carrying Slice 5 through the existing Session, Turn, Message, and Coordination authorities. I reviewed exact head e8905df81f83dacc983f398649ba31f032bbc6df. The overall ownership direction is sound, but the destructive replacement and recovery boundaries are not safe yet.

I found two P1 issues and two P2 issues inline:

  • correcting a steered delegation can stop a pre-existing user-owned Turn and retract unrelated queued Messages;
  • an explicitly negated creation phrase is still committed as a new Session;
  • the durable replacement intent can become unrecoverably pinned to volatile candidate state after retirement;
  • a transcript reset after recovery drops active linkage that was outside the resident window.

Please fix these paths and add production-composition coverage for an active manual Turn plus WorkHub steering, crash/retry with candidate or target lifecycle changes, and subscription reset after full-history reconstruction. The exact-head test check is currently failing and the PR is conflicting; those are next-step gates rather than additional review findings.

Because this is a new product behavior, human UI/UX acceptance is still required before approval.

Review analysis was assisted by Codex and independent @reviewer agents. Astro-Han verified the exact-head diff, production paths, reachability, and severity before publication and owns this review.

中文对照

谢谢你把 Slice 5 放在现有 Session、Turn、Message 和 Coordination authority 上推进。当前 ownership 方向是正确的,但 destructive replacement 与恢复边界还不安全。

我在行内标出了两个 P1 和两个 P2:纠正 steered delegation 会误停原有 Turn 并撤销无关排队消息;明确否定“创建新会话”的文本仍会创建 Session;持久 replacement intent 会被易变 candidate 状态锁死;恢复后的 transcript reset 会丢失 resident window 之外的 active linkage。

请修复这些路径,并补真实 production-composition 覆盖。当前 exact-head test 失败且 PR 冲突,这些是后续门槛,不是额外代码 finding。作为新的产品行为,在 Approve 前仍需要人工 UI/UX 验收。

本次审查分析由 Codex 和独立的 @reviewer 子代理协助;Astro-Han 核验了精确 head、生产路径、可达性和问题分级,并对本次 Review 负责。

Comment thread packages/runtime-host/src/server/execution-composition.ts Outdated
Comment thread apps/desktop/src/renderer/workhub-route-policy.ts
Comment thread packages/runtime-host/src/server/workhub-coordination-action-gate.ts Outdated
Comment thread apps/desktop/src/renderer/workhub-coordination-port.ts Outdated
ARE404 added 4 commits August 31, 2026 02:17
Bind durable delegation replay to the selected candidate and refresh a prepared replacement target display identity before retiring the source delegation.

Generated-by: Codex
Revalidate replacement targets after source retirement and canonicalize their current display identity at the SQLite assignment boundary without weakening fresh-delegation checks.

Generated-by: Codex
@ARE404
ARE404 force-pushed the feat/workhub-linked-correction branch from e8905df to 192f34c Compare August 30, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XL Over 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants