Skip to content

feat(dgw,agent,jetsocat): route JMUX channels through agents - #1974

Open
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 5 commits into
masterfrom
feat/jmux-agent-routing
Open

feat(dgw,agent,jetsocat): route JMUX channels through agents#1974
irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 5 commits into
masterfrom
feat/jmux-agent-routing

Conversation

@irvingoujAtDevolution

@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Route each JMUX channel through an Agent Tunnel when its destination matches an advertised route. Use direct TCP only when no Agent route matches.

Report the target address selected by the Agent so routed hostname traffic remains auditable. A matched Agent failure fails only that channel and never bypasses the Agent route with a direct connection.

Select an advertised agent for each JMUX channel by destination.
Fall back to direct TCP only when no agent route matches.

Keep channel failures isolated with bounded client errors and emit
ConnectFailure audit events when the target IP is known.
Copilot AI balanced review requested due to automatic review settings September 7, 2026 20:11
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Let maintainers know that an action is required on their side

  • Add the label release-required Please cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module) when you request a maintainer to cut a new release (Devolutions Gateway, Devolutions Agent, Jetsocat, PowerShell module)

  • Add the label release-blocker Follow-up is required before cutting a new release if a follow-up is required before cutting a new release

  • Add the label publish-required Please publish libraries (`Devolutions.Gateway.Utils`, OpenAPI clients, etc) when you request a maintainer to publish libraries (Devolutions.Gateway.Utils, OpenAPI clients, etc.)

  • Add the label publish-blocker Follow-up is required before publishing libraries if a follow-up is required before publishing libraries

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.

🟡 Changes recommended

Agent-routed hostname traffic can evade auditing, failure semantics conflict with the documented contract, and the new connector paths lack tests.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Routes JMUX channels through matching agents while retaining direct TCP fallback.

Changes:

  • Adds a pluggable JMUX target connector.
  • Integrates destination-based agent routing.
  • Adds bounded failures and audit events.

prose-verifier was skipped because prose changes are limited to brief Rustdoc.

File summaries
File Description
devolutions-gateway/src/jmux.rs Connects matching JMUX destinations through agents.
devolutions-gateway/src/api/jmux.rs Passes the agent tunnel handle into JMUX handling.
crates/jmux-proxy/src/lib.rs Adds custom target streams, fallback, and failure handling.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/jmux-proxy/src/lib.rs Outdated
Comment thread devolutions-gateway/src/jmux.rs Outdated
Comment thread crates/jmux-proxy/src/lib.rs
Return the Agent-selected socket address so JMUX can audit hostname targets accurately.

Keep opaque connector failures out of target-failure audit events and cover connector success, fallback, failure, and channel isolation.

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.

🟡 Changes recommended

Routed failures omit required audit events and leak allocated JMUX channel IDs.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread crates/jmux-proxy/src/lib.rs Outdated
Comment thread crates/jmux-proxy/src/lib.rs Outdated
@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) changed the title feat(dgw): route JMUX channels through agents feat(dgw,agent): route JMUX channels through agents Sep 7, 2026

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.

🟡 Changes recommended

Failed custom connections leak allocated JMUX channel IDs instead of returning them to the allocator.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

crates/jmux-proxy/src/lib.rs:1249

  • A connector error sends OPEN FAILURE and then drops channel, but its local_id was already allocated before the resolver was spawned. Because only JmuxCtx::unregister returns IDs to the allocator and this channel was never registered, each failed Agent route permanently consumes an ID and grows the allocator bitmap. Route resolution failures back through the scheduler so it can release the pending ID; the regression test should also verify that the next channel reuses it.
                        Err(error) => {
                            msg_to_send_tx
                                .send(Message::open_failure(
                                    channel.distant_id,
                                    ReasonCode::GENERAL_FAILURE,
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread crates/agent-tunnel/src/routing.rs
@irvingoujAtDevolution irvingouj@Devolutions (irvingoujAtDevolution) changed the title feat(dgw,agent): route JMUX channels through agents feat(dgw,agent,jetsocat): route JMUX channels through agents Sep 7, 2026

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.

🔵 Needs a closer look

The cross-cutting JMUX scheduler, routing, and tunnel protocol changes warrant final human validation.

Review details

Suppressed comments (1)

crates/agent-tunnel/src/routing.rs:98

  • The try_route return documentation is now stale: Ok(Some(...)) carries the stream, selected agent, and an optional Agent-reported target address, not just a stream. Documenting the third element is important because None is the supported legacy-response case that callers must preserve.
) -> Result<Option<(TunnelStream, Arc<AgentPeer>, Option<SocketAddr>)>> {
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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.

🟢 Approval recommended

The routing, failure isolation, auditing, and backward-compatible protocol behavior are coherently implemented and covered by focused tests.

Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants