Skip to content

[rush-daemon] Add request scheduler foundation - #5921

Open
Mo Jazayeri (mojaza) wants to merge 3 commits into
microsoft:mainfrom
mojaza:mojazayeri-microsoft-fix-issue-5897
Open

[rush-daemon] Add request scheduler foundation#5921
Mo Jazayeri (mojaza) wants to merge 3 commits into
microsoft:mainfrom
mojaza:mojazayeri-microsoft-fix-issue-5897

Conversation

@mojaza

Copy link
Copy Markdown
Contributor

Summary

Issue #5897 requires daemon requests to queue instead of failing when another Rush command is active. This PR introduces the initial @rushstack/rush-daemon package and its request admission scheduler as an independently reviewable foundation for that workstream.

Details

The scheduler defines SHARED-BUILD, SHARED-READ, and EXCLUSIVE compatibility classes. Requests in the same shared class can run concurrently, incompatible classes serialize, and a queued exclusive request gates later admissions to preserve FIFO fairness.

Admission supports queue position notifications, clean cancellation through AbortSignal, bounded waits, and fail-fast --no-wait semantics. Leases are idempotently released so a completed request cannot corrupt scheduler state.

This is intentionally a partial implementation of #5897: transport, workspace session routing, command classification, graph integration, and shared-build selection merging depend on the WS0/WS1 prerequisites and are not included here. The package is registered but not connected to the Rush CLI, so existing behavior is unchanged.

How it was tested

  • Built @rushstack/rush-daemon with Rush/Heft, including TypeScript, ESLint, and API Extractor.
  • Ran 7 scheduler unit tests covering shared concurrency, incompatible serialization, exclusive FIFO gating, fail-fast admission, timeout, cancellation, and queue position updates.

Impacted documentation

N/A. The package is not yet exposed through the Rush CLI.

Introduce the rush-daemon package with fair shared and exclusive request admission, cancellation, timeouts, and queue position reporting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@TheLarkInn Sean Larkin (TheLarkInn) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢 🚢

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces the publishable @rushstack/rush-daemon package and foundational request admission scheduler.

Changes:

  • Adds scheduler compatibility classes, FIFO admission, cancellation, timeouts, and queue notifications.
  • Adds scheduler unit tests and public API exports.
  • Registers and configures the package within the Rush monorepo.
Show a summary per file
File Description
rush.json Registers the daemon project.
README.md Lists the new package.
libraries/rush-daemon/tsconfig.json Configures TypeScript.
libraries/rush-daemon/src/test/RequestScheduler.test.ts Tests scheduler behavior.
libraries/rush-daemon/src/RequestScheduler.ts Implements request scheduling.
libraries/rush-daemon/src/index.ts Exports the public API.
libraries/rush-daemon/README.md Describes package status.
libraries/rush-daemon/package.json Defines package metadata and builds.
libraries/rush-daemon/LICENSE Adds MIT licensing.
libraries/rush-daemon/eslint.config.js Configures linting.
libraries/rush-daemon/config/rig.json Selects the shared rig.
libraries/rush-daemon/config/jest.config.json Configures Jest.
libraries/rush-daemon/config/api-extractor.json Configures API Extractor.
libraries/rush-daemon/CHANGELOG.md Initializes the changelog.
libraries/rush-daemon/CHANGELOG.json Initializes changelog metadata.
libraries/rush-daemon/.npmignore Defines published files.
common/reviews/api/rush-daemon.api.md Records the public API surface.
common/config/subspaces/default/pnpm-lock.yaml Adds the package importer.
common/changes/@rushstack/rush-daemon/mojazayeri-rush-daemon-scheduler_2026-08-13-22-30.json Records the minor change.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Files not reviewed (1)
  • common/config/subspaces/default/pnpm-lock.yaml: Generated file
  • Files reviewed: 18/19 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread libraries/rush-daemon/src/RequestScheduler.ts Outdated
Comment thread libraries/rush-daemon/src/RequestScheduler.ts Outdated
Comment thread libraries/rush-daemon/src/RequestScheduler.ts
Comment thread libraries/rush-daemon/src/RequestScheduler.ts Outdated
Comment thread libraries/rush-daemon/src/RequestScheduler.ts Outdated
Keep queue position callback failures from corrupting scheduler state, reject unsupported timer delays, and cover asynchronous validation and idempotent release.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

5 participants