Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds Dev Tunnels–based remote connectivity for debugger (DAP) jobs by extending the job message contract with tunnel details and updating the worker-side debugger startup to bind to the tunnel-provided port and start a tunnel relay.
Changes:
- Extend
AgentJobRequestMessagewithDebuggerTunnelpayload deserialization (tunnel ID/cluster/token/port) and add theDebuggerTunnelInfocontract type. - Replace
GlobalContext.EnableDebuggerwith a consolidatedDebuggerConfig(enabled + tunnel info) and update debugger enablement checks accordingly. - Update
DapDebuggerto require a valid tunnel config, bind to the tunnel port, and start/stop a Dev Tunnel relay; adjust L0 tests to use the new config model.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Test/L0/Worker/DapDebuggerL0.cs | Updates L0 tests to use tunnel-based debugger config and skips relay during unit tests. |
| src/Test/L0/Sdk/RSWebApi/AgentJobRequestMessageL0.cs | Adds deserialization tests for the new DebuggerTunnel payload. |
| src/Sdk/DTPipelines/Pipelines/DebuggerTunnelInfo.cs | Introduces the tunnel info DataContract used in job messages. |
| src/Sdk/DTPipelines/Pipelines/AgentJobRequestMessage.cs | Adds DebuggerTunnel DataMember to the job request message. |
| src/Runner.Worker/Runner.Worker.csproj | Adds Microsoft.DevTunnels.Connections dependency for relay hosting. |
| src/Runner.Worker/JobRunner.cs | Switches debugger enablement check to Global.Debugger?.Enabled. |
| src/Runner.Worker/GlobalContext.cs | Replaces EnableDebugger with DebuggerConfig Debugger. |
| src/Runner.Worker/ExecutionContext.cs | Populates Global.Debugger from EnableDebugger + DebuggerTunnel in the acquire response. |
| src/Runner.Worker/Dap/DebuggerConfig.cs | Adds consolidated debugger configuration and tunnel validity check. |
| src/Runner.Worker/Dap/DapDebugger.cs | Requires valid tunnel config, binds to tunnel port, and starts/stops Dev Tunnel relay. |
src/Runner.Worker/Dap/DapDebugger.cs
Outdated
| }; | ||
|
|
||
| _tunnelRelayHost = new TunnelRelayTunnelHost(managementClient, new TraceSource("DevTunnelRelay")); | ||
| await _tunnelRelayHost.StartAsync(tunnel, CancellationToken.None); |
There was a problem hiding this comment.
is CancellationToken.None expeceted?
There was a problem hiding this comment.
Yeah, we want DAP server to handle cancellation and only destroy the tunnel in the finally at the end of job execution, otherwise they'll race and we risk not wrapping up the session with the client gracefully.
There was a problem hiding this comment.
will ConnectAsync() hang forever so we stuck in StartAsync?
There was a problem hiding this comment.
I was under the assumption that cancellation token was used throughout the lifetime of the connection but looks like it's not the case with the new version and it's only used for the initial handshake, adding a timeout now.
This PR adds remote debugger connectivity to the runner via Dev Tunnels. The runner now deserializes the DebuggerTunnel payload (tunnel ID, cluster, host token, port) from the job message, binds the DAP server to the tunnel-provided port, and starts a Dev Tunnel relay so remote DAP clients can connect. The DAP port is now mandated by the backend for two reasons:
Since we're adding more debugger configuration this also changes the previous
EnableDebuggerbool in context with an object carrying that configuration.https://github.com/github/c2c-actions/issues/9831