feat(broker): stream live output and status from remote agent operations - #5254
Conversation
Implementation notesEvent-channel consumption (
Fallback matrix — streaming problems never fail the operation:
Cancel while streaming: the cancel request path from #5253 is reused ( Output-based veredicts restored: Tests (
Validation: full |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds support for consuming the broker’s per-operation event channel to stream live stdout/stderr and status hints during brokered operations, with robust fallback to status polling.
Changes:
- Implement event-channel streaming in brokered operations (stdout/stderr + status hints), with fallback to polling on failure.
- Refactor broker cancel flow to separate “request cancel” vs “confirm terminal status”, and drain the event stream during cancellation when possible.
- Add end-to-end tests using a named-pipe event-channel server and scripted broker transport.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/UniGetUI.PackageEngine.Operations/PackageOperations.cs | Adds event-channel streaming, streaming output buffering, and updated cancel/status logic. |
| src/UniGetUI.PackageEngine.Tests/PackageOperationsTests.cs | Adds tests + test pipe server to validate streaming, fallback, and cancellation behaviors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
55a5f54 to
421df5f
Compare
The base branch was changed.
…hannel When the broker advertises a per-operation event channel (LocalPipe) in the execution response, consume it for live output: stdout/stderr frames are emitted line-by-line into the operation log (mirroring the local process reader, including CR progress lines), STATUS_UPDATED triggers a status query, overflow frames log a skipped-bytes warning, and FINISH ends streaming with a final status query. Accumulated output is fed back to the manager's result parser, restoring output-based veredicts for brokered operations. If the channel is absent, fails to open, or breaks mid-stream (fatal decode error / transport failure), the operation falls back to the existing HTTP status polling without failing. Cancellation during streaming requests a broker-side cancel, drains the channel (bounded) so the output tail and Finish frame are honored, then confirms the terminal status; the poll-based cancel flow is kept for the non-streaming path. Tests cover streamed output reaching both the operation log and the result parser (including partial-line reassembly across frames), STATUS_UPDATED and FINISH handling, fallback on missing channel and on decode errors, and cancellation during streaming, using a real named-pipe frame server. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…, span scanning - Result parsers now receive only raw process output streamed over the event channel (tracked in a dedicated list) instead of scraping the operation log, keeping internal informational lines out of the parser input. - StreamedOutputLineBuffer clears the pending CR progress line whenever a regular line is emitted, so superseded progress text (foo\rbar\n) is no longer promoted by a later bare LF. - Append() now scans with IndexOfAny over spans instead of per-character iteration. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…cution Brokered operations previously requested Standard elevation unless the user explicitly checked 'Run as administrator': WinGet's auto-detection of elevation-requiring installers (ElevationRequired/ElevatesSelf metadata, System-scope installs) only ran inside _getOperationParameters, which the broker path never calls. As a result, packages like FreeCAD ran non-elevated through the agent and the installer raised its own UAC prompt. - Add IPackageOperationHelper.ApplyElevationRequirements with a no-op default in BasePkgOperationHelper, so any manager can opt into elevation detection. - WinGet overrides it with the existing detection logic, factored out of _getOperationParameters (which still invokes it at the same point, keeping local-path behavior identical, including the ElevationProhibited checks). - PerformBrokerOperation now calls the hook before CreateBrokerClient, so OverridenOptions.RunAsAdministrator feeds RequiresAdminRights() the same way as the local path; Settings.K.ProhibitElevation still wins. - Log the requested elevation (Elevated/Standard) in the operation output for diagnosability, next to the effective user. - Tests: capture the /v1/package-operations/execute wire body in the scripted transport and assert Client.RequestedElevation; cover helper-forced Elevated, default Standard, and ProhibitElevation override. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
13821e7 to
2dcca68
Compare
9b1d7d0
into
main
Brokered (remote agent) package operations now show live process output while they run. When an operation is routed through the Devolutions Agent broker, UniGetUI opens the broker's new per-operation event channel and streams the remote process's stdout/stderr straight into the operation output pane, line by line, exactly like a locally executed operation — including progress lines.
What this changes for users:
Stacked on #5253 (Devolutions.Now.Policy 2026.8.5 bump + remote cancellation); only the last commit belongs to this PR.
Issue: DGW-438