Repository navigation
fix(connection): recover saved SSH tunnels after disconnect - #1070
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:53 PM ET / 21:53 UTC. ClawSweeper reviewWhat this changesThe PR routes failed saved-gateway SSH tunnels through the connection manager, adds lifecycle-aware restart handling and bounded retries, and adds connection and tray tests. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep this member-authored PR open for maintainer review. Current main has the reported ownership mismatch, and the branch follows the documented direction by moving registry-backed SSH tunnel recovery through the connection manager; no discrete correctness defect was found in the reviewed patch. Priority: P2 Review scores
Verification
How this fits togetherThe tray stores remote gateway records, optionally with SSH port-forward configuration. The connection manager starts that tunnel, connects operator and node clients through it, and publishes connection state to the tray UI. flowchart LR
A[Saved gateway record] --> B[SSH tunnel service]
B --> C[Gateway connection manager]
C --> D[Operator and node clients]
B --> E[Unexpected tunnel exit]
E --> F[Recovery ownership check]
F --> C
C --> G[Tray connection status]
Decision needed
Why: The patch aligns with the documented tunnel ownership boundary but changes availability behavior for existing remote gateway setups, which requires maintainer confirmation rather than automated closure or merge. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt manager-owned recovery for registry-backed tunnels, preserve paired device identity through reconnect, and retain generation guards plus bounded retries so stale exits cannot revive replaced connections. Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main restarts only through global SSH settings after an exit, while a registry-backed active gateway owns its tunnel through the connection manager; this read-only Linux review could not execute the native Windows path. Is this the best way to solve the issue? Yes, subject to the maintainer ownership decision. The branch removes the legacy settings-versus-registry mismatch rather than introducing a parallel client-recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9acafa606a4d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
4a1e456 to
0fa8a2e
Compare
|
ClawSweeper follow-up:
This classifies the initial result as a transient WSL setup/loopback failure, not a regression in the SSH tunnel lifecycle patch. The requested rank-up move is complete, so I am marking the PR ready for maintainer review. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 7b9bc681-ce19-4a8b-b06c-94efb63a5f9f
What Problem This Solves
Fixes an issue where users connecting the Windows tray to a remote Gateway through a saved SSH tunnel would stay disconnected after the tunnel process exited. The tray scheduled a restart, but the recovery path checked obsolete global SSH settings instead of the active saved gateway.
Why This Change Was Made
Recovery now goes through the owner of the failed tunnel:
GatewayConnectionManagerowns registry-backed tunnels and may reconnect the gateway clients.Tunnel exits carry the exact configuration, owner, and lifecycle generation that failed, so delayed callbacks cannot reconnect a different gateway or clear a replacement process. Automatic recovery uses bounded 3, 10, and 30 second retries, stops after three failures in five minutes, and re-arms after successful automatic or manual recovery.
User Impact
Remote Gateway connections configured in the gateway registry recover automatically when their SSH forward drops and becomes available again. Existing device and node pairing remain valid; users do not need to pair again. Repeated failures stop with an honest failed state instead of causing an unlimited reconnect loop.
Evidence
device.info.device.info.tunnel.restart_scheduledand retried through the active gateway record.Connected, retained the same paired node identity, reported zero pending approvals, and passed local MCP plus gateway-mediateddevice.infoagain.Change Type
Scope
winnodeValidation
Current head:
21fd3491a70ca5e865e607d08533c361a8f5ab63.\build.ps1dotnet test .\tests\OpenClaw.Shared.Tests\OpenClaw.Shared.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Tray.Tests\OpenClaw.Tray.Tests.csproj --no-restoredotnet test .\tests\OpenClaw.Connection.Tests\OpenClaw.Connection.Tests.csproj --no-restoregit diff --checkReal Behavior Proof
0fa8a2e6winnode --list-toolswinnode --command device.info --params "{}"nodes invoke --command device.infotunnel.restart_scheduledtoConnectedpaired: true,connected: true, andapprovalState: approveddevice.info: successdevice.info: successSecurity Impact
Yes, explain the risk and mitigation: N/ACompatibility and Migration
Review Conversations