Skip to content

fix(runtime-host): pause WorkHub result polling during handoff - #5733

Merged
Astro-Han merged 1 commit into
apache:mainfrom
hbw00111:fix/issue-5698-handoff-residencies
Sep 27, 2026
Merged

Astro-Han merged 1 commit into
apache:mainfrom
hbw00111:fix/issue-5698-handoff-residencies

Conversation

@hbw00111

Copy link
Copy Markdown
Contributor

Summary

WorkHub result polling could acquire a hosted-execution drain residency while Runtime Host handoff was preparing its proof, causing an otherwise idle handoff to be rejected. Pause that scheduler alongside Goals, scheduled tasks, and Daily Review, and wait for any admitted poll to finish before freezing Root executions. Cancellation resumes polling; a detached predecessor keeps it paused.

Timer identity checks also reject callbacks queued before a hold. The exact residency proof and Root handoff behavior remain unchanged.

Fixes #5698

Verification

A deterministic production composition regression fails on the original code and passes with the fix. Coordinator tests cover pending and stale callbacks, cancellation, shutdown, and in-flight delivery without duplicate results.

  • Runtime Host build (including TypeScript checking) passed.
  • Coordinator tests: 15 passed; focused composition tests: 6 passed.
  • Full Runtime Host suite: 2139 tests, 2127 passed, 12 skipped, 0 failed.
  • Changed-file Biome lint/format and git diff --check passed.

Validated on macOS with Node 24.20.0. The original Linux CPU-contention environment was not rerun; deterministic timers cover the missing scheduler-pause boundary.

AI use

Select exactly one:

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

Tool(s) and scope: OpenAI Codex investigated the race, implemented the fix and regression tests, ran local validation, and prepared this submission on behalf of hbw00111. Human maintainer review is still required.

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/M Under 500 readable lines label Sep 26, 2026

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

I reviewed PR #5733 at the current head 7dfa1759a4f2d58b318f5d0f26ed434badb74121. I found no substantiated P0–P3 issue in the inspected handoff/result-polling paths.

The new WorkHub result hold stops pending polls and prevents a stale timer callback from crossing the hold (packages/runtime-host/src/server/workhub-result-coordinator.ts:123-181); it waits for an already-admitted reconciliation and its residency to settle before root handoff (packages/runtime-host/src/server/execution-composition.ts:3145-3177). Cancellation releases the hold and schedules a fresh poll, while detach leaves the predecessor held until drain. The added coordinator and production-composition tests exercise pending and in-flight polls, cancellation, residency settlement, and detach. I also checked result delivery/close paths and found no schema or migration changes.

The current-head test and label checks passed. The diff check and synthetic merge onto freshly fetched main are clean. GitHub reports the PR as OPEN and mergeable, but its mergeable state is blocked; this comment is not a merge approval. I did not run local tests (Node 18/no installed dependencies) or a multi-process production handoff.

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

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

Approved at @Astro-Han's explicit request: a small, focused fix with no blocking findings in the automated review of this head and green CI.

@Astro-Han
Astro-Han merged commit bfb315a into apache:main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/M Under 500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flaky(runtime-host): handoff proof misses a drain residency when the runner is under CPU contention

3 participants