Skip to content

feat(workhub): simplify coordination and unify remote task workflows - #6051

Merged
ARE404 merged 26 commits into
apache:mainfrom
ARE404:feat/workhub-coordinating-agent
Oct 10, 2026
Merged

ARE404 merged 26 commits into
apache:mainfrom
ARE404:feat/workhub-coordinating-agent

Conversation

@ARE404

@ARE404 ARE404 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Refs #5745

  • Refactor WorkHub as a coordination Agent: use WorkHub's configuration for delegated execution, preserve target Session ownership, and propagate temporary execution policy through child/Graph work and recovery.
  • Add a remote-chat destination setting that routes chats to the single WorkHub Session, including compact numeric/letter question answers and simplified channel labels.
  • Add wn to show progress and next-step suggestions for the three most recent works, then place the selected prompt draft in the desktop composer without executing it.
  • Preserve user intent in handoffs and simplify task identity rails, result-update spacing, and answered-question disclosures. Clicking an option now advances or submits the question; keyboard selection remains available.
  • Fix frozen-store proxy access when applying delegated execution policy.

Verification

  • Runtime Host, UI, and desktop renderer/main TypeScript checks passed during implementation.
  • Re-ran 67 focused tests for execution authority, action gating, remote routing/choices, task identity, draft extraction, and option-click submission: 67 passed, 0 failed.
  • Shared disclosure/answer identity regression run: 44 passed, 0 failed.
  • Native Electron: exercised wn discovery, selection, and draft insertion using SQL/CS336 tasks; verified that drafting started no target Session invocation. Checked answered-choice expansion and result identity rails in the app.
  • git diff --check passed. Merge check against current upstream main reports no conflicts.
  • Full cross-platform packaging and end-to-end remote-provider delivery were not rerun. Generated summaries and faithful handoffs remain model-driven; prompt instructions are not a hard enforcement boundary.

AI use

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

Tool(s) and scope: OpenAI Codex implemented the refactor, remote routing, and UI changes; added tests; and performed native validation. Retain the Generated-by trailer in the squash commit.

Checklist

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

Focused typechecks/tests and whitespace validation passed; the full repository lint/format gate was not rerun for this PR.

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

Generated-by: Codex

@github-actions github-actions Bot added the effort/XXL Over 2500 readable lines label Oct 10, 2026

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

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

I found one P2 issue at bf0c3d9aa2a5058ab5460465ddc38b77494913b4.

  • P2 — preserve steering's question policy through a physical successor (packages/runtime-host/src/server/root-turn-coordinator.ts:3269). WorkHub steering changes an already-running ordinary task to return missing information. This continuation loop instead reuses the policy captured before that steering. In the existing physical-handoff integration fixture, the running generation has questions: 'return', but its successor receives no question policy. The logical Turn completes normally; the missing policy means subsequent AskUserQuestion calls can suspend the worker again, with no WorkHub question relay. Refresh the effective execution policy before resuming the same logical Turn. An ordinary later user Turn should still restore ordinary behavior.
  • P3 — reconcile protocol epoch numbering before integration (packages/runtime-host/src/protocol/index.ts:107). This PR declares epoch 213 for new coordination/configuration semantics, while the currently open #5394 (2fc0e4c2) and #5969 (c19d60ec) also declare 213 for different changes. Their numbers should not silently identify interchangeable protocol contracts.

The configuration and routing changes otherwise follow the maintainer decisions in #5745: the coordinator chooses operations directly, new tasks inherit its model, reused tasks keep their model, and scoped WorkHub permissions do not overwrite saved target permissions. Remote shared-context routing is explicitly opt-in; question-answer routing checks the original chat and sender. I did not find another P0–P2 issue in these paths.

Validation: seven relevant packages built; Desktop's four typechecks passed; 750 of 751 selected Node tests passed. The remaining ordinary Bash test returned Command sandbox is required but unavailable on platform linux on this machine, so it is not evidence of a WorkHub regression. All 38 focused Chromium Storybook render/play/accessibility scenarios passed. The additional handoff-policy probe failed on this head and passed when the continuation received the updated live policy; that diagnostic mutation was removed. No live remote-provider or native Electron/platform certification is claimed.

The head remained unchanged at the final check. CI run 38045922816 was still running; I am not treating it as green. The P2 should be fixed before merging, and this feature/refactor still requires a human merge decision.

active.continuation = plan.continuation;
});
stream = this.manager.resumeSafeBoundaryContinuation(active.continuation!, {
executionPolicy,

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.

[P2] Refresh the effective question policy before the physical successor

executionPolicy was captured when this logical Turn started. If WorkHub later steers an ordinary running task, returnExecutionQuestions updates its live policy to questions: 'return', but this loop still passes the old undefined policy. RuntimeKernel consequently creates a successor without the missing-information return policy, and AskUserQuestion can suspend it again after WorkHub's relay was removed. I exercised the production physical-handoff fixture: the live policy was return before sealing, the Turn completed, and the successor context had no question policy. Supplying the updated policy made that same probe pass. Resolve the latest effective policy for the same execution lineage before resuming; do not confuse this physical successor with an ordinary later user Turn.

// Increment when the same protocol version no longer guarantees safe Client-Host
// interoperability. Mismatches are rejected before domain commands are admitted.
export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 212 as const;
export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 213 as const;

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.

[P3] Reconcile this epoch with the other open protocol changes

The current open heads of #5394 (2fc0e4c2) and #5969 (c19d60ec) also declare epoch 213, for different contracts. This PR changes WorkHub coordination/configuration semantics. Coordinate a distinct final epoch at integration so incompatible clients and Hosts do not share the same handshake value.

ARE404 added 25 commits October 10, 2026 19:28
Use the coordinating agent directly, persist WorkHub model settings, scope delegated permissions to executions, and separate steering from stop and delegation. Preserve historical recovery records and return worker missing information through ordinary follow-up messages.

Generated-by: Codex
…ions

Preserve delegated permissions across child and graph execution lineage, restore scoped policy from durable Host facts, and update question handling when steering an existing backend.

Generated-by: Codex
Use an independent proxy facade so bound methods and permission read overrides do not violate invariants on frozen Host stores. Exercise the production frozen facade shape in the scoped-policy regression test.

Generated-by: Codex
Add remote message handling settings, durable source-aware replies, and compact interaction choice answers.

Generated-by: Codex
Result notification turns had no links unless they delegated again. Derive their Host-scoped task identity from the durable result origin so rails and filters also cover tool-free result summaries.

Generated-by: Codex
Check WorkHub rails against bubble bounds after the shorter-rail design. Give localized usage timestamps 8px more room so Linux font metrics fit without weakening the overflow assertion.

Generated-by: Codex
Resolve the latest durable policy for each physical continuation, including steered ordinary admissions with no sourceMessages. Add production composition coverage proving successor inheritance and restoration on a later user Turn. Use compatibility epoch 214 to distinguish this contract from the open epoch-213 changes.

Generated-by: Codex
Provide the shared WorkHub enablement context to the new dock backdrop fixture and refresh the merged UI inventory totals.

Generated-by: Codex

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

Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.

At 8b15c0a9d51af8a34c5155941180d203e3d98181, the previously reported P2 handoff-policy failure is fixed. Each physical successor now resolves the latest durable policy, including WorkHub steering of an ordinary Turn without source messages. The production composition test observes ordinary → return → ordinary across the initial run, its steered successor, and a later user Turn. Reverting only the two policy changes reproduced the missing successor policy; restoring them passed the complete relevant suite.

[P3] Epoch 214 is already used by #5548 (packages/runtime-host/src/protocol/index.ts:107). Moving from 213 avoids #5394/#5969 but creates a different collision: #5548 at dc7a4fdd4b89b4845349b5543c56c2eb81a9b042 also uses 214 for an unrelated contract. Across 188 open PR heads checked, 215 is currently unused. Coordinate allocation and recheck before merging; the two distinct contracts should not advertise interchangeable compatibility.

The rebase preserves the earlier changes; the added Desktop fixture uses the shared WorkHub enablement context and the generated surface inventory totals agree. No additional P0–P2 issue was found in this increment.

Validation: 393 of 394 selected Node tests passed (245/246 Host, 148/148 Desktop/UI); the sole failure is the same ordinary Bash test returning Command sandbox is required but unavailable on platform linux on this machine. All 38 focused Chromium scenarios passed. Seven dependency projects, Desktop main and all four Desktop typechecks passed. No live remote-provider, native Electron or cross-platform certification is claimed.

This exact head's CI test succeeded in run 38048782832. GitHub reports MERGEABLE/BLOCKED; automatic merging with main bacb1caed is textually clean. This comment is not a human merge decision.

// Increment when the same protocol version no longer guarantees safe Client-Host
// interoperability. Mismatches are rejected before domain commands are admitted.
export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 212 as const;
export const RUNTIME_HOST_COMPATIBILITY_EPOCH = 214 as const;

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.

[P3] Allocate a distinct compatibility epoch before integration

Epoch 214 now conflicts with open #5548 at dc7a4fd, which declares 214 for a different wire contract. The move fixes the previous epoch-213 collision but not unique allocation. Main is currently 212 and 215 is currently unused across 188 open heads checked. Coordinate the number and recheck immediately before merging.

Epoch 214 is also declared by open PR apache#5548. Verified all 188 current open PR heads: apache#5394 and apache#5969 use 213, apache#5548 and this PR use 214, and 215 is unused. Move WorkHub to 215; allocation must be rechecked at integration because the base-only CI guard cannot reserve numbers across open branches.

Generated-by: Codex
@ARE404
ARE404 merged commit 685d3ab into apache:main Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XXL Over 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants