Skip to content

Report an infrastructure failure when the debugger Dev Tunnel fails - #4610

Merged
rentziass merged 5 commits into
mainfrom
rentziass-debugger-tunnel-infra-failure
Aug 6, 2026
Merged

rentziass merged 5 commits into
mainfrom
rentziass-debugger-tunnel-infra-failure

Conversation

@rentziass

@rentziass rentziass commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Reports a runner infrastructure failure when a debugger job's Dev Tunnel connection cannot be established, or drops mid-job. Previously both cases surfaced as a plain step error (or, for a mid-job drop, were invisible entirely — the job would sit on a DAP pause until the job timeout).

Infrastructure failure category: debugger_tunnel_failure (Constants.Runner.InfrastructureFailureCategories.DebuggerTunnelFailure). The matching case in run-service is being added separately.

Behaviour:

  • Tunnel relay fails to connect (including the 30s connect timeout) — wrapped in a new DebuggerTunnelException and reported via InfrastructureError from "Set up job".
  • Tunnel disconnects mid-job — sets the infra failure category, fails the job, and releases the DAP wait so the job doesn't hang. Disconnects we initiate during StopAsync teardown are ignored via an explicit shutdown flag, and transient reconnect transitions are not treated as failures.
  • A debugger client never attaching within the timeout is deliberately NOT an infrastructure failure. That is a user-side outcome, not broken infrastructure, and keeps its existing plain context.Error(...) behaviour. There is a regression test for this.

github/actions-runtime#5587

A debugger job silently degraded when its Dev Tunnel relay broke. A failed
relay connect was reported as a plain job error, and a relay that dropped
after connecting was invisible entirely — the job just hung on a DAP pause
until the job timeout, because the debug client could no longer resume it.

Both now report the `debugger_tunnel_failure` infrastructure category so the
service can attribute the failure to infrastructure rather than the user:

- StartTunnelRelayAsync wraps connect failures (including the 30s connect
  timeout) in DebuggerTunnelException, which JobExtension catches and turns
  into an InfrastructureError on "Set up job".
- DapDebugger subscribes to the relay's ConnectionStatusChanged and, on a
  settled Disconnected that we didn't cause, sets the category, fails the
  job, and releases any pending DAP pause so it stops waiting.

A client-connect timeout is deliberately left as a plain error — the tunnel
was healthy, the user simply never attached.

Co-authored-by: Copilot App <[email protected]>

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.

Pull request overview

Adds explicit runner infrastructure failure reporting for Dev Tunnel relay failures in debugger (DAP) jobs, ensuring tunnel connect failures and unexpected mid-job disconnects are surfaced and don’t leave jobs hanging until timeout.

Changes:

  • Introduces DebuggerTunnelException and reports tunnel-connect failures as InfrastructureError with category debugger_tunnel_failure.
  • Adds Dev Tunnel connection status monitoring to fail the job and release DAP waits on unexpected disconnects.
  • Adds L0 tests covering tunnel failure vs. client-attach timeout behavior and disconnect handling.
Show a summary per file
File Description
src/Test/L0/Worker/JobExtensionL0.cs Adds L0 coverage for infra-failure reporting on tunnel connect failure vs. user attach timeout.
src/Test/L0/Worker/DapDebuggerL0.cs Adds L0 coverage for unexpected tunnel disconnect behaviors (fail once, ignore teardown, release waits).
src/Runner.Worker/JobExtension.cs Treats DebuggerTunnelException as infrastructure failure (vs. generic debugger errors).
src/Runner.Worker/Dap/DebuggerTunnelException.cs Adds a dedicated exception type to distinguish tunnel failures from attach timeouts.
src/Runner.Worker/Dap/DapDebugger.cs Wraps tunnel connect errors, subscribes to tunnel status changes, and fails job on unexpected disconnects.
src/Runner.Common/Constants.cs Adds infrastructure failure category constant debugger_tunnel_failure.

Review details

  • Files reviewed: 6/6 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/Runner.Worker/Dap/DapDebugger.cs Resolved
Comment thread src/Runner.Worker/Dap/DapDebugger.cs Resolved
rentziass and others added 2 commits August 6, 2026 11:09
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 57a800c5-eb52-4866-9bba-a3f5c0faf3d8
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 57a800c5-eb52-4866-9bba-a3f5c0faf3d8

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.

Review details

Suppressed comments (1)

src/Runner.Worker/JobExtension.cs:678

  • This catch reports an infrastructure failure via context.InfrastructureError(...), but it then rethrows and will be caught again by the outer catch (Exception ex) in InitializeJob, which calls context.Error(ex) and records a second (non-infrastructure) error issue with the same message. That makes the tunnel failure show up as both an infrastructure issue and a regular step error.

Consider adding an outer catch (DebuggerTunnelException) (before the general catch) that sets context.Result and rethrows without calling context.Error(...), or have the general catch skip context.Error(ex) when ex is a DebuggerTunnelException that has already been reported as infrastructure.

                            context.InfrastructureError(
                                ex.Message,
                                category: Constants.Runner.InfrastructureFailureCategories.DebuggerTunnelFailure);
                            throw;
                        }
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/Runner.Worker/Dap/DapDebugger.cs Resolved
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 57a800c5-eb52-4866-9bba-a3f5c0faf3d8
@rentziass
rentziass marked this pull request as ready for review August 6, 2026 10:04
@rentziass
rentziass requested a review from a team as a code owner August 6, 2026 10:04
@rentziass
rentziass enabled auto-merge (squash) August 6, 2026 12:02
@rentziass
rentziass merged commit 2009b20 into main Aug 6, 2026
12 checks passed
@rentziass
rentziass deleted the rentziass-debugger-tunnel-infra-failure branch August 6, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants