Skip to content

refactor(tasks): route acp through executor#57478

Merged
vincentkoc merged 4 commits into
mainfrom
pr3/acp-executor
Mar 30, 2026
Merged

refactor(tasks): route acp through executor#57478
vincentkoc merged 4 commits into
mainfrom
pr3/acp-executor

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

Summary

  • route ACP background task lifecycle writes through the new task executor facade
  • switch ACP spawn task creation to executor helpers instead of registry writes
  • keep the change scoped to ACP producers on top of the executor and delivery-policy slices

Testing

  • pnpm test -- src/acp/control-plane/manager.test.ts src/agents/acp-spawn.test.ts src/tasks/task-executor.test.ts src/tasks/task-registry.test.ts
  • pnpm build

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS maintainer Maintainer-authored PR labels Mar 30, 2026
@vincentkoc vincentkoc self-assigned this Mar 30, 2026
Base automatically changed from pr2/task-delivery-policy to main March 30, 2026 04:45
@vincentkoc
vincentkoc marked this pull request as ready for review March 30, 2026 04:58
@vincentkoc
vincentkoc merged commit 126f773 into main Mar 30, 2026
9 checks passed
@vincentkoc
vincentkoc deleted the pr3/acp-executor branch March 30, 2026 04:58
@greptile-apps

greptile-apps Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a task-executor facade layer that routes ACP task lifecycle writes (create, start, progress, complete, fail) through intent-named helpers instead of calling task-registry directly. A companion task-executor-policy module extracts the policy predicates and message-formatting functions that were inlined in task-registry.ts, cleanly separating concerns without introducing circular dependencies (the policy module only imports from task-registry.types.ts).

Key points:

  • Behavioral equivalence for all registry interactions is preserved. The isTerminalTaskStatus / shouldAutoDeliverTaskStateChange / shouldAutoDeliverTaskTerminalUpdate rewrites are logically identical to their inlined predecessors.
  • failTaskRunByRunId intentionally omits terminalOutcome, enforcing the domain constraint that a "blocked" outcome is only meaningful for succeeded tasks.
  • The shouldSuppressDuplicateTerminalDelivery extraction correctly moves the pickPreferredRunIdTask lookup to the call site in task-registry.ts, keeping the policy function pure and testable.
  • New test files cover both the executor flow (queued→running→succeeded and running→failed) and the policy logic (formatting, delivery predicates, suppression logic).
  • markTaskRunLostById and cancelDetachedTaskRunById are added as forward-looking executor exports but are not yet wired to production callers — minor surface area addition consistent with the refactor scope.

Confidence Score: 5/5

Safe to merge — clean refactor with verified behavioral equivalence, no circular dependencies, and comprehensive new test coverage.

All findings are P2 or lower. The logic refactoring is behaviorally equivalent, the intentional semantic constraints (dropping terminalOutcome from the failure path) are clearly designed, and the new executor/policy split is well-structured. No runtime regressions identified.

No files require special attention.

Important Files Changed

Filename Overview
src/tasks/task-executor.ts New facade layer over task-registry; correctly delegates to registry internals and enforces semantic constraints (e.g. failTaskRunByRunId deliberately excludes terminalOutcome to bind the 'blocked' outcome to succeeded tasks only).
src/tasks/task-executor-policy.ts Extracted policy and formatting functions from task-registry; verified behaviorally equivalent to inlined versions. Imports only from task-registry.types.ts so no circular dependency is introduced.
src/tasks/task-registry.ts Removed inlined policy/formatting helpers and replaced with imports from task-executor-policy. shouldSuppressDuplicateTerminalDelivery call site correctly pre-resolves the preferred task before calling the extracted function. Behavioral equivalence verified.
src/acp/control-plane/manager.core.ts Routes ACP task lifecycle writes through the executor facade. The markBackgroundTaskTerminal split into completeTaskRunByRunId / failTaskRunByRunId correctly drops terminalOutcome from the failure branch — intentional semantic constraint.
src/agents/acp-spawn.ts Replaced createTaskRecord (with explicit status: 'running') with createRunningTaskRun; status field removed from call sites since the executor wrapper now enforces it. Functionally equivalent.
src/agents/acp-spawn-parent-stream.ts Three recordTaskProgressByRunId call sites mechanically renamed to recordTaskRunProgressByRunId from the executor facade. No behavioral change.

Reviews (1): Last reviewed commit: "Merge branch 'main' into pr3/acp-executo..." | Re-trigger Greptile

Alix-007 pushed a commit to Alix-007/openclaw that referenced this pull request Mar 30, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
alexjiang1 pushed a commit to alexjiang1/openclaw that referenced this pull request Mar 31, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
pgondhi987 pushed a commit to pgondhi987/openclaw that referenced this pull request Mar 31, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
pgondhi987 pushed a commit to pgondhi987/openclaw that referenced this pull request Mar 31, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
Tardisyuan pushed a commit to Tardisyuan/openclaw that referenced this pull request Apr 30, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
Nachx639 pushed a commit to Nachx639/clawdbot that referenced this pull request Jun 17, 2026
* refactor(tasks): add executor facade

* refactor(tasks): extract delivery policy

* refactor(tasks): route acp through executor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant