Skip to content

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

Draft
ARE404 wants to merge 7 commits into
apache:mainfrom
ARE404:feat/workhub-linked-correction
Draft

feat(workhub): add linked delegation correction#4242
ARE404 wants to merge 7 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 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 and stopping only the exact WorkHub-owned Turn.
  • Surface durable link state (active, superseded, or aborted) and explicitly announce when WorkHub creates new work.
  • Treat advisory requests such as “explain/show me how to diagnose …, then fix it” as ambiguous: persist a clarification and require a fresh direct instruction before any write. Renderer routing remains advisory, and the Runtime Host independently rejects ambiguous write proposals.

Refs #3492

Verification

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm run build
  • npm run check:renderer-architecture
  • npx knip --workspace apps/desktop
  • npx knip --workspace packages/ui
  • Affected WorkHub Desktop, Core, Storage, and Runtime Host suites: 254 passed, 0 failed
  • Independent Standards and Spec review on exact head 777ab0c77bd397b372137c4ab65716f941bc9813: PASS / PASS
  • git diff --check upstream/main...HEAD

Review focus

  • Ambiguous advisory language cannot bypass clarification through an explicit target, exact Session name, recent focus, core-entity routing, replay, or a strategy-provided proposal.
  • 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, conflict resolution, and adversarial review under human direction. Claude Opus provided a bounded read-only design consultation; Codex independently implemented and verified the result. Every affected commit includes the required Generated-by: Codex trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck, build, architecture checks, Knip, 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 Outdated
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
ARE404 force-pushed the feat/workhub-linked-correction branch from e8905df to 192f34c Compare August 30, 2026 18:24

@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 the comprehensive correction and recovery follow-up. I rechecked exact head 192f34c: root-owned versus shared Turns, negated creation clauses, stable replacement identity, durable abort/recovery, and transcript-reset history reconstruction are all closed, with exact-head checks green. One non-blocking functional suggestion remains: please surface the assignment link state (active, superseded, or aborted) in the WorkHub UI so a corrected or aborted delegation does not continue to look running or merely accepted. This feels like functional feedback rather than visual polish. Please push back if another existing surface already owns that state. This was an AI-assisted review using Codex; I independently verified the production and recovery paths and own this approval.

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
Keep executable WorkHub requests as implicit new-work creation while validating creation intent in Core and the Runtime action gate. Surface durable created-new feedback and linked replacement state in the UI, preserve connection metadata atomically, and cover cancellation and correction races.

Generated-by: Codex
@ARE404
ARE404 force-pushed the feat/workhub-linked-correction branch from 192f34c to 777ab0c Compare August 31, 2026 16:25
@ARE404
ARE404 marked this pull request as draft August 31, 2026 16:27
@ARE404
ARE404 requested a review from Astro-Han August 31, 2026 16:27
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