feat(dgw,agent,jetsocat): route JMUX channels through agents - #1974
feat(dgw,agent,jetsocat): route JMUX channels through agents#1974irvingouj@Devolutions (irvingoujAtDevolution) wants to merge 5 commits into
Conversation
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.
Let maintainers know that an action is required on their side
|
There was a problem hiding this comment.
🟡 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.
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.
There was a problem hiding this comment.
🟡 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
There was a problem hiding this comment.
🟡 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 itslocal_idwas already allocated before the resolver was spawned. Because onlyJmuxCtx::unregisterreturns 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
There was a problem hiding this comment.
🔵 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_routereturn 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 becauseNoneis 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
There was a problem hiding this comment.
🟢 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
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.