adding PSU agent functionality (POC)#1840
Conversation
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
Pull request overview
Adds a POC “PSU gRPC agent” capability to Devolutions Agent: the agent can connect to a PSU gRPC endpoint, register itself/capabilities, and execute PSU-requested work by spawning child processes and streaming stdin/stdout over the gRPC stream.
Changes:
- Introduces a new
psu_grpc_agenttask that maintains a gRPC connection to PSU with reconnect/backoff and handles server commands. - Implements child-process spawning plus stream multiplexing to forward stdin → process and stdout/stderr → PSU.
- Adds configuration schema + build-time proto generation + container helpers (Dockerfile/entrypoint + run script).
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| devolutions-agent/src/service.rs | Registers the new PSU gRPC agent task when enabled in config. |
| devolutions-agent/src/psu_grpc_agent/mod.rs | Implements the gRPC agent task, registration message, connection loop, and message handling. |
| devolutions-agent/src/psu_grpc_agent/process.rs | Adds process spawning and stream pumping logic between PSU and child processes. |
| devolutions-agent/src/main.rs | Marks new proto/gRPC-related crates as used in the binary crate. |
| devolutions-agent/src/lib.rs | Exposes the new psu_grpc_agent module from the agent library. |
| devolutions-agent/src/config.rs | Adds PsuGrpcAgent configuration DTO + default + deserialization test. |
| devolutions-agent/proto/psu_agent.proto | Defines the POC gRPC protocol (AgentControl bidi stream + messages). |
| devolutions-agent/Cargo.toml | Adds tonic/prost dependencies and build-deps for proto compilation. |
| devolutions-agent/build.rs | Generates Rust code from the PSU agent proto using tonic-build and vendored protoc. |
| devolutions-agent/Dockerfile.psu-grpc-poc | Adds a POC image to build/run the agent alongside PowerShell. |
| devolutions-agent/docker/psu-grpc-entrypoint.sh | Writes a minimal agent config from env vars and starts the agent in the container. |
| devolutions-agent/Run-PsuGrpcAgentContainer.ps1 | Convenience script to build/run the POC container with env configuration. |
| Cargo.lock | Pulls in new dependency graph for tonic/prost/tooling. |
| .dockerignore | Ignores node_modules and .vs in Docker build context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let server_url = conf | ||
| .server_url | ||
| .as_ref() | ||
| .context("PsuGrpcAgent is enabled but ServerUrl is not configured")? | ||
| .to_string(); |
| if let Some(sender) = sender { | ||
| let end_of_stream = stream_data.end_of_stream; | ||
| let stream_id = stream_data.stream_id.clone(); | ||
| if sender.send(stream_data).await.is_ok() && end_of_stream { | ||
| self.close_stream(&stream_id).await; | ||
| } | ||
| } |
| let _ = outgoing_tx | ||
| .send(agent_message( | ||
| &agent_id, | ||
| &connection_id, | ||
| AgentPayload::StreamClosed(stream_closed( | ||
| request.stream_id.clone(), | ||
| "child process completed".to_owned(), | ||
| false, | ||
| )), | ||
| )) | ||
| .await; |
| ENV CARGO_NET_GIT_FETCH_WITH_CLI=true \ | ||
| GIT_SSL_NO_VERIFY=true |
| if selector.eq_ignore_ascii_case("pwsh") | ||
| || selector.eq_ignore_ascii_case("pwsh-preview") | ||
| || selector.eq_ignore_ascii_case("pwsh-lts") | ||
| || selector.starts_with("pwsh-") | ||
| { | ||
| return selector.into(); | ||
| } |
POC: Adding ability to Devolutions Agent to connect to PSU over GRPC and start child processes to run PSRP requests from PSU.