Skip to content

[rush-daemon][WS2.7][6/9] Forward interactive I/O - #5969

Merged
Mo Jazayeri (mojaza) merged 4 commits into
mainfrom
mojazayeri-microsoft-rushd-ws2-interactive-io-upstream-86a
Aug 27, 2026
Merged

[rush-daemon][WS2.7][6/9] Forward interactive I/O#5969
Mo Jazayeri (mojaza) merged 4 commits into
mainfrom
mojazayeri-microsoft-rushd-ws2-interactive-io-upstream-86a

Conversation

@mojaza

Copy link
Copy Markdown
Contributor

Summary

Adds request-scoped interactive input forwarding for daemon-routed phased and global commands while preserving isolation from daemon process stdio.

Depends on #5966. This stack follows merged #5949 and continues the work tracked in #5897 (reference only; does not close it).

Work item: https://onedrive.visualstudio.com/EFun/_workitems/edit/3216023

Details

  • Frames stdin losslessly as Uint8Array payloads and preserves ordered delivery under backpressure without cross-request leakage.
  • Gives the client ownership of raw-mode transitions and requires acknowledged restoration before request completion.
  • Integrates interactive session lifecycle with both phased and global command routing, including cancellation, failures, cleanup, and terminal-policy results.
  • Returns requiresInProcess when the requested terminal capability cannot be safely provided by the daemon.

Limitations

  • The daemon never mutates its own stdio, allocates a PTY, or forwards SIGWINCH.
  • Terminal dimensions are immutable start-of-request metadata.
  • Commands outside this contract continue through the WS4 in-process fallback.

How it was tested

  • node common/scripts/install-run-rush.js test --only @rushstack/rush-daemon-protocol --only @rushstack/rush-daemon-transport --only @rushstack/rush-daemon
  • node common/scripts/install-run-rush.js change --verify
  • git diff --check
  • git range-diff --no-color 5fde27f24f3bb6dc5725448072e83ee09805c8fb..7cfc9f0b7b198a15195e0d7677c00e970955d453 353a0dc65a973e39cc6ecf24e61ec3decdd7924f..HEAD

@mojaza
Mo Jazayeri (mojaza) requested a balanced review from Copilot August 27, 2026 00:10
Base automatically changed from mojazayeri-microsoft-rushd-ws2-exit-semantics-upstream to main August 27, 2026 00:11
mojazayeri and others added 2 commits August 26, 2026 17:11
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mojaza
Mo Jazayeri (mojaza) force-pushed the mojazayeri-microsoft-rushd-ws2-interactive-io-upstream-86a branch from 6e7b8f4 to 3eadbbb Compare August 27, 2026 00:11

Copilot AI 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.

Pull request overview

Adds request-scoped interactive I/O for daemon-routed commands, including stdin framing, raw-mode coordination, terminal fallback policy, and asynchronous transport backpressure.

Changes:

  • Adds protocol contracts for stdin, raw mode, and terminal policy.
  • Integrates interactive sessions with phased/global routing.
  • Serializes asynchronous inbound frame handling and adds tests.

Reviewed changes

Copilot reviewed 44 out of 44 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
libraries/rush-daemon/src/test/RushDaemonHost.test.ts Tests host-level stdin routing and failure isolation.
libraries/rush-daemon/src/test/PhasedRequestRouterTestUtilities.ts Extends phased test clients for interactive sessions.
libraries/rush-daemon/src/test/PhasedRequestInteractive.test.ts Tests phased raw-mode lifecycle and fallback.
libraries/rush-daemon/src/test/InteractiveRequestInputRouter.test.ts Tests input routing, ordering, cleanup, and failures.
libraries/rush-daemon/src/test/GlobalCommandRequestRouter.test.ts Tests global stdin forwarding and terminal policy.
libraries/rush-daemon/src/test/DaemonInteractiveConnection.test.ts Tests negotiation and raw-mode ownership.
libraries/rush-daemon/src/RushDaemonHost.ts Exposes each connection’s interactive broker.
libraries/rush-daemon/src/PhasedRequestRouter.ts Adds interactive cleanup and terminal policy handling.
libraries/rush-daemon/src/PhasedRequestClient.ts Extends phased client capabilities.
libraries/rush-daemon/src/InteractiveRequestInputRouter.ts Implements request-scoped stdin routing.
libraries/rush-daemon/src/index.ts Exports interactive APIs.
libraries/rush-daemon/src/GlobalCommandRequestRouter.ts Integrates global-command interactive lifecycle.
libraries/rush-daemon/src/GlobalCommandRequestClient.ts Extends global client capabilities.
libraries/rush-daemon/src/GlobalCommandRequest.ts Adds terminal requirements and stdin metadata.
libraries/rush-daemon/src/GlobalCommandExecutionContext.ts Forwards input to child processes.
libraries/rush-daemon/src/DaemonTerminalPolicy.ts Evaluates daemon terminal compatibility.
libraries/rush-daemon/src/DaemonInteractiveConnection.ts Coordinates connection-level interactive behavior.
libraries/rush-daemon/src/DaemonControlSession.ts Routes stdin and interactive control frames.
libraries/rush-daemon/README.md Documents interactive behavior and limitations.
libraries/rush-daemon-transport/src/test/AsyncFrameHandler.test.ts Tests serialized asynchronous frame handlers.
libraries/rush-daemon-transport/src/DaemonFrameConnection.ts Adds inbound asynchronous backpressure.
libraries/rush-daemon-transport/README.md Documents inbound flow control.
libraries/rush-daemon-protocol/src/test/StdinFrameCodec.test.ts Tests stdin framing and byte preservation.
libraries/rush-daemon-protocol/src/test/InteractiveControl.test.ts Tests interactive control messages.
libraries/rush-daemon-protocol/src/test/ControlFrame.test.ts Updates subscription codec coverage.
libraries/rush-daemon-protocol/src/StdinFrameCodec.ts Implements request-tagged stdin encoding.
libraries/rush-daemon-protocol/src/InteractiveControlValidation.ts Validates interactive controls.
libraries/rush-daemon-protocol/src/index.ts Exports new protocol contracts.
libraries/rush-daemon-protocol/src/FrameConstants.ts Defines stdin request-ID framing constants.
libraries/rush-daemon-protocol/src/DaemonTerminalPolicy.ts Defines terminal policy types.
libraries/rush-daemon-protocol/src/DaemonProtocolVersion.ts Advances the protocol minor version.
libraries/rush-daemon-protocol/src/DaemonPhasedRequest.ts Adds phased terminal/input metadata.
libraries/rush-daemon-protocol/src/DaemonInteractiveControl.ts Defines raw-mode and policy messages.
libraries/rush-daemon-protocol/src/DaemonControlMessage.ts Includes interactive control variants.
libraries/rush-daemon-protocol/src/DaemonControlKinds.ts Centralizes control-message kinds.
libraries/rush-daemon-protocol/src/DaemonClientCaps.ts Adds interactive capability negotiation.
libraries/rush-daemon-protocol/src/ControlMessageValidation.ts Validates new control-message kinds.
libraries/rush-daemon-protocol/README.md Documents interactive protocol contracts.
common/reviews/api/rush-daemon.api.md Updates daemon API report.
common/reviews/api/rush-daemon-transport.api.md Updates transport API report.
common/reviews/api/rush-daemon-protocol.api.md Updates protocol API report.
common/changes/@rushstack/rush-daemon/mojazayeri-interactive-io_2026-08-21-21-00.json Records daemon package change.
common/changes/@rushstack/rush-daemon-transport/mojazayeri-interactive-io_2026-08-21-21-00.json Records transport package change.
common/changes/@rushstack/rush-daemon-protocol/mojazayeri-interactive-io_2026-08-21-21-00.json Records protocol package change.
Suppressed comments (1)

libraries/rush-daemon/src/DaemonControlSession.ts:94

  • A subsequent valid subscribe that omits the optional capability (for example, to update verbosity) disables interactive I/O. If a request currently owns raw mode, its mandatory cooked-mode restoration then fails at #assertEnabled() and no setRawMode(false) is sent. Treat negotiated interactive support as immutable/monotonic for the connection, or reject capability changes while requests are active.
    } else if (message.kind === 'subscribe') {
      this._interactiveConnection.setEnabled(
        this._peerSupportsInteractiveProtocol && message.payload.supportsInteractiveIO === true
      );

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

Comment thread libraries/rush-daemon/src/DaemonTerminalPolicy.ts
Comment thread libraries/rush-daemon/src/DaemonControlSession.ts Outdated
Comment thread libraries/rush-daemon/src/PhasedRequestRouter.ts
Comment thread libraries/rush-daemon-protocol/src/StdinFrameCodec.ts
mojazayeri and others added 2 commits August 26, 2026 17:51
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@mojaza
Mo Jazayeri (mojaza) merged commit 73293fd into main Aug 27, 2026
10 checks passed
@mojaza
Mo Jazayeri (mojaza) deleted the mojazayeri-microsoft-rushd-ws2-interactive-io-upstream-86a branch August 27, 2026 02:05
@github-project-automation github-project-automation Bot moved this from Needs triage to Closed in Bug Triage Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Closed

Development

Successfully merging this pull request may close these issues.

4 participants