Skip to content

fix(scheduler): keep polling behind stuck fires without releasing ownership - #2277

Merged
JAORMX merged 7 commits into
mainfrom
fix/2273-scheduler-liveness
Oct 13, 2026
Merged

JAORMX merged 7 commits into
mainfrom
fix/2273-scheduler-liveness

Conversation

@JAORMX

@JAORMX JAORMX commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Status

Rebased onto merged prerequisite #2281 (36b6ca993). The engine dependency now points to that merged revision, and the unchanged publication check passes. All repaired store tests use RunClaimAndRetryConformance.

Ready for review. CI is green on rebased head 7583d5b1e, including the full Test (race) check and the production execution profile. The ready-for-review CI run passed after one SDK-only retry for a prematurely closed transport stream: CI results.

Summary

Fixes #2273.

  • Keep polling for due schedules while a fire is stuck, with one bounded capacity limit for automatic/manual fires and recovery work.
  • Retain the slot, same-schedule exclusion, session lease, and execution ownership until both the running work and cancellation worker exit. Report overdue work as degraded rather than falsely completed.
  • Reject overlapping schedule claims atomically in memory, JSONL, and Redis. Settle skipped occurrences so they do not permanently block later work.
  • Prevent old results from clearing newer claims. Check retry eligibility and budget atomically, including replica turnover and unreadable or conflicting result history.
  • Save terminal results despite caller cancellation or notification failure; release resources only after the run has ended.

Tests

The scheduler tests deliberately block work or cancellation, then verify unrelated admission, capacity limits, ownership retention, eventual cleanup, and notification recovery.

The shared store tests check records and atomic claim/retry operations across memory, JSONL, Redis, and gRPC. They do not launch or stop an executor. Standalone gRPC tests exercise the actual wire path against the repaired, test-owned JSONL backend, rather than the published engine's older memory-store implementation.

Passed locally after rebasing:

  • Full lint, non-race tests, build, documentation checks, and offline demo
  • Engine, JSONL, Redis, and gRPC race tests in UTC and Europe/Helsinki, including standalone GOWORK=off consumers
  • Focused scheduler and scheduled-fire lifecycle race tests
  • Dependency publication check and repeated module-tidy freshness checks

The complete local race task did not finish within its time budget; it is not counted as passed. Review confirmed that the rebase preserved the runtime fixes and safety assertions.

Compatibility and limits

  • Uncooperative work retains capacity and ownership until it exits; replacement executions are not spawned merely because cancellation was requested.
  • Pending claims with uncertain ownership remain quarantined. Completion notices wait for actual termination.
  • Claim/rearm signatures and wire fields are unchanged, but external stores must implement the stronger behavior. Mixing old and new unconditional writers is unsafe.
  • Older Redis records without verified outcome metadata do not automatically rearm; the conservative upgrade behavior is documented.
  • Storage backends whose root Due/List calls ignore cancellation can still block polling.

JAORMX and others added 7 commits October 13, 2026 13:39
Decouple polling from lifetime-bounded fire admission, retain execution ownership through uncooperative cancellation, and expose overdue or uncertain work without declaring it complete.

Fixes #2273

Co-authored-by: Mecatl <[email protected]>
Settle deliberate misfire skips, reject unresolved predecessors inside schedule stores, preserve successor state on late settlement, and bound rearm work. Cover takeover races, shutdown quarantine and durable delivery failure.

Co-authored-by: Mecatl <[email protected]>
Use the published engine commit containing the atomic predecessor fence and matching conformance so standalone and workspace gates verify the same contract.

Co-authored-by: Mecatl <[email protected]>
Reject stale or concurrent rearm decisions against successful, live, enabled or exhausted successors. Preserve the public signature while checking current eligibility under store locks or Redis CAS and strengthen takeover/conformance regressions.

Co-authored-by: Mecatl <[email protected]>
Validate Redis's current outcome directly and use strict JSONL retry-history reads. Repin standalone engine consumers to the published atomic rearm contract.

Co-authored-by: Mecatl <[email protected]>
Keep later conflicting error records in history without authorizing retries after success. Document conservative Redis upgrade behavior and verify reverse outcome ordering.

Co-authored-by: Mecatl <[email protected]>
Pin the main-ancestral engine test helper from #2281 and switch all repaired store callers to RunClaimAndRetryConformance. Exercise standalone gRPC conformance through the repaired JSONL backend instead of the published legacy memory store.

Co-authored-by: Mecatl <[email protected]>
@JAORMX
JAORMX force-pushed the fix/2273-scheduler-liveness branch from ccaa508 to 7583d5b Compare October 13, 2026 12:25
@JAORMX
JAORMX marked this pull request as ready for review October 13, 2026 13:04
@JAORMX
JAORMX merged commit 8e3bea4 into main Oct 13, 2026
95 of 96 checks passed
@JAORMX
JAORMX deleted the fix/2273-scheduler-liveness branch October 13, 2026 13:43
@toolhive-release-app toolhive-release-app Bot mentioned this pull request Oct 13, 2026
2 tasks
@peppescg peppescg mentioned this pull request Oct 14, 2026
10 of 14 tasks
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.

Scheduler can stop polling behind a stuck fire despite its deadline and healthy leadership

1 participant