Skip to content

fix(scheduled): avoid serial waits for task startup - #824

Merged
vastsa merged 2 commits into
vastsa:mainfrom
hui455:fix/scheduled-dispatch-review
Sep 21, 2026
Merged

vastsa merged 2 commits into
vastsa:mainfrom
hui455:fix/scheduled-dispatch-review

Conversation

@hui455

@hui455 hui455 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

One due task waiting for prompt setup holds up the remaining tasks in the polling loop. Another task can miss its execution window even though it was already due when the poll started.

Start independent due tasks without waiting for another task's setup. Keep each task's in-flight ownership tied to its Host instance so repeated polls and late completion from a replaced Host cannot duplicate startup. The Host continues to enforce enabled, due and overlap checks.

Before and after — actual Windows desktop run history (1200 × 800). A real Host test holds the production runner's first prompt setup. The desktop is reopened to inspect its saved ledger: one admitted run before, two after. Both captures show Interrupted because the test deliberately stops the Host before reopening it.

Before:

Before

After:

After

The regression fails with the serial runner and passes with independent dispatch. Tests also cover Host replacement, shutdown and observable startup failures.

Validation details
  • Runner tests: 9 passed. Real Host dispatch E2E passed. Desktop build, typecheck and lint passed on the refreshed base.
  • The complete desktop scheduled-task flow passed with the baseline Host and updated Electron build. An earlier combined run timed out opening a result conversation; a rerun of the same executable passed.
  • Earlier full desktop suite: 2446 passed, 45 failed, 7 skipped. Failures outside the scheduled runner include platform-dependent scripts, packaging and plugin tests.
  • Windows, Node 24.2, Rust debug build. Native macOS/Linux runs were not performed. Screenshots use main 0111e306c and the corresponding fix; focused checks were rerun after refreshing the candidates to 46d4ee4ee.

hui455 and others added 2 commits September 22, 2026 01:04
Keep one slow prompt setup from consuming another due task's admission
window. Track in-flight ownership per task and host without moving
authoritative scheduling or overlap checks out of the Host.
# Conflicts:
#	docs/spec/03-runtime/06-host-rpc-protocol.md
#	docs/spec/06-delivery/04-e2e-test-plan.md
#	docs/zh-CN/spec/03-runtime/06-host-rpc-protocol.md
#	docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@vastsa
vastsa merged commit 206085c into vastsa:main Sep 21, 2026
4 checks passed
@vastsa

vastsa commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Landing note: this branch conflicted with the sibling scheduled-task PRs (#820-#824) that landed just before it. I merged the updated main into this branch and resolved the conflicts (docs sections unioned; for #822 the new tests in scheduled_tools.rs were combined with #820's). No functional change was made to your commits.

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.

2 participants