Skip to content

fix(proxies): stop the tunnel before the earner, so a stop that fails halfway is not undone - #15

Closed
geiresx wants to merge 1 commit into
mainfrom
fix/proxied-stop-tunnel-first
Closed

geiresx wants to merge 1 commit into
mainfrom
fix/proxied-stop-tunnel-first

Conversation

@geiresx

@geiresx geiresx commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Review mirror of GeiserX#262 (CodeRabbit is rate-limited there). Findings are fixed on the real PR; this one is closed after.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where stopping a proxied copy could leave its tunnel running if the tunnel failed to stop, while the earner had already stopped. The tunnel now stops first, and a failure prevents the earner from being stopped. This also prevents a later status check from unexpectedly restarting the earner after a failed stop.

…p is not undone

stopProxied stopped the earner first. When the tunnel stop then failed, the
next status read found a ready tunnel beside a stopped earner and started the
earner again, losing the owner's stop. Stopping the tunnel first means a stop
that fails halfway leaves either both running (and says so) or the earner in
a namespace with no way out, which the status read leaves alone.
@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

stopProxied now stops the tunnel before the earner. It returns immediately if stopping the tunnel fails. Tests cover failures stopping either container and check that a later status read does not restart the earner.

Changes: Proxied Shutdown

Layer / File(s) Summary
Tunnel-first shutdown
internal/runtime/proxied.go, internal/runtime/proxied_test.go, CHANGELOG.md
stopProxied stops the tunnel first and returns on a tunnel-stop error. Tests cover failures stopping the tunnel or earner and verify the subsequent status read does not start or restart the earner. The changelog records the change.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Merge Risk: Minimal · up to aa42d

The shutdown-order change has no identified merge-blocking issue. Merge after normal checks.

Security architecture risk: Low · up to aa42d

The new ordering addresses shutdown being undone by a later status read without changing container ownership or network privileges. Remaining uncertainty concerns real Docker partial failures and overlapping lifecycle operations; no introduced security bypass was established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed shutdown operation remains scoped to the selected service/proxy container pair on the configured Docker daemon. It adds no container-selection authority or new production entrypoint.

Trust Boundaries and Controls

  • inferred — An earner left running after tunnel shutdown remains configured inside the sidecar namespace without independent networking or firewall-changing authority. This is counterevidence to a newly introduced direct-egress path, but the exact live post-stop behavior was not independently demonstrated.

Resilience and Maintainability Implications

  • observed — Status recovery still issues start or restart operations from separately collected container state. That structure predates this PR, and the Docker adapter does not itself serialize lifecycle calls. The sequential regression test therefore does not establish correctness for overlapping status and shutdown operations; no PR-introduced worsening of this concurrency limitation was established.

Hardening Proposals

  • proposed — Extend transition assurance with controlled overlapping status/shutdown scenarios and daemon failures that occur after state mutation, checking both final owner-requested state and continued proxy isolation. This is an assurance proposal, not a demonstrated security bypass.
Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the stop-order change and its purpose.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 3
  • Waived: $0.75 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 67ddd59 and aa42d1e.

Files selected for processing: 3

  • CHANGELOG.md
  • internal/runtime/proxied.go
  • internal/runtime/proxied_test.go

Limit details: You’ve used all 10 included reviews currently available.

@geiresx

geiresx commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Review done; findings carried to GeiserX#262.

@geiresx geiresx closed this Nov 7, 2026
@geiresx
geiresx deleted the fix/proxied-stop-tunnel-first branch November 7, 2026 15:27
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