fix(agent): gate PSU Event Hub import and make it non-fatal#1817
Merged
Conversation
The PowerShell Universal Event Hub compatibility import ran on every agent startup. It could enable an experimental feature solely from the presence of a third-party PSU config file or `PSU_` environment variable, and could abort startup entirely if such a file or variable was malformed. The import is now gated at the call site behind both the `enable_unstable` debug flag and an already-enabled PsuEventHub configuration. It never enables the feature on its own: a stray PSU config or `PSU_` variable can no longer bring the feature into existence. When the feature is explicitly enabled but defines no connections of its own, the legacy PSU configuration is used to fill them in; any explicit configuration always wins. The import is also best-effort: any failure is logged and ignored instead of blocking startup. The foreign-format PSU parsing is additionally moved out of the agent config module into a dedicated `psu_event_hub::compat` module to keep legacy migration code separate from the native agent configuration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Devolutions Agent’s PowerShell Universal (PSU) Event Hub compatibility import so it cannot implicitly enable the feature and cannot block agent startup when legacy PSU artifacts are malformed. It also moves PSU foreign-format parsing out of the main config module into a dedicated compatibility module.
Changes:
- Gate PSU compat import behind both
debug.enable_unstableand an already-enabledPsuEventHubconfig; treat import failures as non-fatal (log and continue). - Extract PSU legacy parsing/merge logic into
psu_event_hub::compat, with dedicated tests. - Rename the PSU PowerShell worker config field from
power_shelltopowershell(while keeping JSON compatibility viarename = "PowerShell").
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
devolutions-agent/src/config.rs |
Gates compat import at startup and makes it best-effort; updates DTO field naming/serde attributes. |
devolutions-agent/src/psu_event_hub/mod.rs |
Adjusts runtime usage to the renamed powershell field. |
devolutions-agent/src/psu_event_hub/compat.rs |
New module implementing PSU legacy config import + env overrides + tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Richard Markiewicz (thenextman)
approved these changes
Jun 5, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PowerShell Universal Event Hub compatibility import ran on every agent startup. It could enable an experimental feature solely from the presence of a third-party PSU config file or
PSU_environment variable, and could abort startup entirely if such a file or variable was malformed.The import is now gated at the call site behind both the
enable_unstabledebug flag and an already-enabled PsuEventHub configuration. It never enables the feature on its own: a stray PSU config orPSU_variable can no longer bring the feature into existence. When the feature is explicitly enabled but defines no connections of its own, the legacy PSU configuration is used to fill them in; any explicit configuration always wins. The import is also best-effort: any failure is logged and ignored instead of blocking startup.The foreign-format PSU parsing is additionally moved out of the agent config module into a dedicated
psu_event_hub::compatmodule to keep legacy migration code separate from the native agent configuration.