Skip to content

Reap orphaned Azure provisioning tunnels - #432

Merged
mkultraWasHere merged 4 commits into
mainfrom
codex/reap-orphaned-bastion-tunnels
Aug 13, 2026
Merged

Reap orphaned Azure provisioning tunnels#432
mkultraWasHere merged 4 commits into
mainfrom
codex/reap-orphaned-bastion-tunnels

Conversation

@mkultraWasHere

Copy link
Copy Markdown
Contributor

Azure provisioning tunnels now clean up even when the DreadGOAD CLI is hard-killed by the console.

Added

  • A hidden parent-lifetime watchdog supervises the Azure provisioning tunnel process group.

Fixed

  • az network bastion tunnel processes no longer survive abrupt CLI termination.
  • Tunnel descendants are reaped even when the original process-group leader has already exited.

Notes

  • The user-invoked dreadgoad bastion tunnel command remains on its existing interactive lifecycle path.

Provisioning tunnels run outside the CLI process group so the console can hard-kill DreadGOAD without reaching them. Supervise the Azure CLI process group from a pipe-backed watchdog that survives long enough to clean up after abrupt parent exit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens Azure provisioning tunnels by introducing a dedicated watchdog subprocess that can terminate and reap the entire az network bastion tunnel process group even if the main DreadGOAD CLI process is abruptly killed, preventing orphaned tunnel processes from persisting.

Changes:

  • Adds a hidden __bastion-watchdog Cobra command that supervises a child command until a parent-lifetime FD closes.
  • Refactors provisioning tunnel startup/teardown to launch and coordinate with the watchdog via a pipe-based liveness signal.
  • Expands regression tests to cover parent-death cleanup and “leader exited but descendant still alive” process-group tracking.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
cli/internal/azure/provision_tunnel.go Introduces watchdog-backed bastion tunnel lifecycle management and process-group reaping logic.
cli/internal/azure/provision_tunnel_test.go Adds/updates tests validating watchdog cleanup behavior and process-group termination semantics.
cli/cmd/bastion_watchdog.go Adds the hidden __bastion-watchdog CLI entry point used by provisioning tunnels.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cli/cmd/bastion_watchdog.go Outdated
Comment thread cli/internal/azure/provision_tunnel.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@mkultraWasHere
mkultraWasHere added this pull request to the merge queue Aug 13, 2026
Merged via the queue into main with commit 92485d8 Aug 13, 2026
10 checks passed
@mkultraWasHere
mkultraWasHere deleted the codex/reap-orphaned-bastion-tunnels branch August 13, 2026 20:45
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.

2 participants