Skip to content

[rush] Add per-iteration IPCOperationRunner persistence policy#5888

Open
bmiddha wants to merge 3 commits into
mainfrom
bmiddha/ws0-t4-persist-policy-hook
Open

[rush] Add per-iteration IPCOperationRunner persistence policy#5888
bmiddha wants to merge 3 commits into
mainfrom
bmiddha/ws0-t4-persist-policy-hook

Conversation

@bmiddha

@bmiddha bmiddha commented Jul 20, 2026

Copy link
Copy Markdown
Member

Summary

Adds an opt-in, per-iteration runner persistence policy to the alpha operation graph API. Hosts can keep selected IPC runners warm between iterations and tear down cold runners, while the default behavior remains unchanged when no policy is supplied.

Details

IOperationGraphIterationOptions now accepts getRunnerPersistence?: (operation: Operation) => boolean. The operation graph preserves this callback with the scheduled iteration and, after execution hooks and telemetry, closes runners for operations that return false through the existing selective closeRunnersAsync() path.

This moves persistence ownership out of IPCOperationRunnerPlugin and removes constructor-time persistence state from IPCOperationRunner. IPC runners remain resident by default, so existing watch behavior is unchanged. The new policy has no production caller yet and is available for a future daemon warm-selection policy.

An iteration option was chosen instead of a dedicated hook or runner-local dynamic callback because the host already supplies iteration state and the graph already owns runner teardown. The public change is additive and @alpha; unsupported deep-import callers of the internal IPC runner options must remove the old persist argument. When no callback is supplied, the graph performs no policy scan or teardown.

How it was tested

  • node common/scripts/install-run-rush.js test --to @microsoft/rush-lib
  • cd libraries/rush-lib && node_modules/.bin/heft test --test-path-pattern OperationGraph — 39/39 tests passed
  • cd libraries/rush-lib && node_modules/.bin/heft test --clean — 715/715 tests passed across 75 suites
  • node common/scripts/install-run-rush.js change --verify

The new tests exercise two successive iterations and verify the no-policy default, always-persistent, always-one-shot, and changing per-iteration policies.

Move IPC runner teardown into the operation graph's per-iteration options while preserving resident runners when no policy is supplied. Cover persistent, one-shot, changing, and default policies across successive iterations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8f21c8c8-452a-4922-aca3-fb40b007f948
@github-project-automation github-project-automation Bot moved this to Needs triage in Bug Triage Jul 20, 2026
@bmiddha bmiddha changed the title [rush] Add per-iteration runner persistence policy [rush] Add per-iteration IPCOperationRunner persistence policy Jul 20, 2026
Comment thread common/changes/@microsoft/rush/bmiddha-runner-persist-policy.json Outdated
Comment thread libraries/rush-lib/src/logic/operations/IPCOperationRunner.ts

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

LGTM!

Comment thread libraries/rush-lib/src/logic/operations/IOperationGraph.ts Outdated
Comment thread libraries/rush-lib/src/logic/operations/IPCOperationRunner.ts
Close nonpersistent IPC runners before downstream execution, retain fallback cleanup for bypassed active runners, and rename the policy to shouldRunnerPersist.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8f21c8c8-452a-4922-aca3-fb40b007f948
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.

3 participants