Repository navigation
fix(macos): prevent stale remote tunnel recreation - #116172
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 29, 2026, 10:25 PM ET / July 30, 2026, 02:25 UTC. ClawSweeper reviewWhat this changesThe PR adds lifecycle-generation ownership to macOS remote Gateway tunnel creation so cancelled, superseded, and concurrent reconnect work cannot resurrect or duplicate SSH tunnels. Merge readinessKeep this member-authored, maintainer-labelled macOS availability fix open for explicit maintainer review. The supplied patch and focused Swift coverage target the reported stale-work race, but the timing-sensitive SSH process behavior and exact-head macOS checks remain the material merge checks. Priority: P2 Review scores
Verification
How this fits togetherThe macOS client uses a remote SSH tunnel to reach a selected Gateway. Endpoint changes, reconnects, health checks, and shutdowns feed the tunnel manager, which must either retain one current tunnel or deliberately retire stale work before the app routes traffic to the Gateway. flowchart LR
A[Gateway endpoint state] --> B[Remote tunnel manager]
C[Reconnect or health check] --> B
D[Shutdown or endpoint change] --> B
B --> E[Lifecycle generation check]
E --> F[Create or join current SSH tunnel]
E --> G[Cancel stale tunnel work]
F --> H[Remote Gateway route]
Before merge
Agent review detailsSecurityNone. PR surfaceDocs +1, Other +268. Total +269 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain a single generation-owned tunnel lifecycle: current reconnect work may join or replace the canonical create, while endpoint changes and shutdown permanently retire stale work before it can install or restart an SSH process. Do we have a high-confidence way to reproduce the issue? No high-confidence live reproduction is included: the supplied evidence is focused Swift coverage of cancellation and configuration ownership, while the reported failure is a timing-dependent macOS SSH lifecycle race. The source-level path is sufficiently concrete to classify as source reproducible. Is this the best way to solve the issue? Unclear. Carrying an explicit lifecycle generation through restart, create, install, and retirement is a coherent way to establish one owner for stale asynchronous work, but maintainers should confirm the complete current actor path and final macOS checks before treating it as the best fix. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model internal, reasoning high; reviewed against 3672ab6fa15f. LabelsLabel 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 (1 earlier review cycle)
|
de8364a to
105fecb
Compare
|
Rank-up move follow-up:
Provenance: the restart-backoff tunnel path dates to |
|
Final exact-head proof for
The optional live reconnect/stop trace remains intentionally skipped for the operator-safety reason documented above. |
* origin/main: fix(macos): stop canceled voice wake timers (openclaw#116189) fix(macos): coalesce location permission requests (openclaw#116183) fix(macos): guard remote tunnel restart ownership (openclaw#116172) fix(agents): throw CompactionError when summarization fails (openclaw#115500) fix(test): isolate ACP startup output stream (openclaw#116076) fix(agents): deny all tools when scheduled authority names a removed account (openclaw#115932) fix(test): stop collecting Vydra test helpers (openclaw#116139) fix(discord): preserve webhook deadline errors (openclaw#116155) fix(test): isolate Google embedding batch timeout (openclaw#116161) fix(cron): stop replaying old schedule slots after a cron job is edited (openclaw#115779) fix(plugins): report request timeouts for stalled response bodies (openclaw#116166)
What Problem This Solves
Fixes an issue where macOS users switching or stopping a remote Gateway connection could have delayed tunnel work recreate an SSH process after the connection lifecycle had already moved on. Concurrent reconnects could also launch duplicate tunnel creation work after restart backoff.
Why This Change Was Made
The remote tunnel actor now carries an explicit lifecycle generation across restart backoff, in-flight creation, and tunnel installation. Stale or cancelled work terminates without installing or recursively recreating a tunnel, while a current caller can safely retire an older create and join the canonical replacement.
User Impact
Remote Gateway reconnects and shutdowns no longer leave behind resurrected or duplicate SSH tunnel processes. Current reconnect work continues normally when another caller already owns the same tunnel creation.
Evidence
swift test --package-path apps/macos --build-path apps/macos/.build-local --filter GatewayEndpointStoreTests: 57 passedswiftlint lint --strict --config config/swiftlint.yml apps/macos/Sources/OpenClaw/RemoteTunnelManager.swift apps/macos/Tests/OpenClawIPCTests/GatewayEndpointStoreTests.swift: 0 violations105fecb1e75: focused Swift suite passed 57 tests; configured SwiftLint reported 0 violations;git diff --checkpassed