Skip to content

fix(worker): deliver completed results to the coordinator once - #69

Merged
mingtaojin merged 3 commits into
mainfrom
fix/worker-completion-notification
Nov 20, 2026
Merged

mingtaojin merged 3 commits into
mainfrom
fix/worker-completion-notification

Conversation

@mingtaojin

@mingtaojin mingtaojin commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Why

A Worker must deliver its completed work to its coordinator even without a task group or an owner report request. A turn final alone does not establish completion, so Workers now declare the deliverable before Runtime publishes it after that turn succeeds.

What changed

  • Add deliver_result with a stable result identity and trusted Thread and Turn binding.
  • Save declarations and receipts atomically. Publish one durable coordinator inbox event after success, and invalidate stale declarations after steering, requests, pause, interruption or failure.
  • Preserve ordinary finals and the explicit report owner gate. A successful final result report for the same turn and input version suppresses the automatic copy.

Scope

  • Cover new deliverable declarations through native tools and retained Thread capability clients.
  • Preserve task records, native requests and coordinator task closeout. No historical Worker recovery, deployment, restart or live configuration changes.
  • Await coordinator-assigned independent verification before merge.

Tradeoffs

Workers must declare completed work explicitly. Forwarding every final would misclassify ordinary discussion; immediate publication could report completion before a later interruption.

Blast Radius

The new path reuses coordinator inbox delivery and uncertain-response reconciliation. Existing report and ordinary output tests remain in place, and a stable result ID prevents repeat publication across turns and restarts.

Verification

  • TypeScript check and build pass. Runtime behavior suite passes 115/115, including 27 new cases for routing, identity, restart, transaction rollback, steering, native requests and capability ingress.
  • Fresh author-side runtime acceptance passes 21/21 through an independent AgentLoop fixture and actual capability client. Coordinator-assigned PR verification remains pending.
  • Final full suite passes 747/749. Exact base passes 721/722 with the same one-second daemon fixture timeout. Final head also hit one Node socket EINVAL in a CLI startup test; final head and base each pass the 16/16 CLI suite. An earlier cleanup failure passed both 48/48 focused suites and the prior full candidate rerun. All failure logs are retained.

Rebase verification

Rebased onto main after PR #67. Base is 07e61da195583c1ab47b3b885c90e39570b42bad; head is 2d35963c76053efaf25551d10b6e09fd092eae9d. The three author commits and prior verification notes above are retained.

Resolved one import conflict in src/project-runtime.ts and two lifecycle conflicts in src/loop.ts. Both fixed Worker execution selection and pending-delivery invalidation remain. Invalidation precedes execution-identity early returns. The two test commits have identical patches after rebase. No feature scope changed.

Fresh TypeScript check, build and full suite pass, 765/765 tests. The first test launch hit the macOS Unix socket path limit before running tests; the successful run uses a shorter Runtime-owned temporary directory. Final-head independent verification remains required before merge.

@mingtaojin
mingtaojin force-pushed the fix/worker-completion-notification branch from 4150452 to 2d35963 Compare November 20, 2026 11:47
@mingtaojin
mingtaojin merged commit b053f4d into main Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant