Repository navigation
fix(gateway): avoid Tailscale crash loops after upgrades - #126069
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 8:04 PM ET / August 19, 2026, 00:04 UTC. ClawSweeper reviewWhat this changesThe PR turns a persistent Tailscale HTTPS port-443 collision into an actionable configuration exit while leaving the existing route untouched. Regression provenancePossible regression — probable (reproduction; reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open for explicit maintainer approval: the repair safely preserves ambiguous routes and stops the managed systemd retry loop, but it deliberately changes upgrade recovery policy and the PR is protected with Priority: P1 Review scores
Verification
How this fits togetherGateway startup asks the local Tailscale CLI to hold a foreground Serve or Funnel route for an isolated Gateway listener. A persistent route can reject that claim; this change carries that failure to the supervised Gateway process and operator recovery guidance. flowchart LR
A[Gateway startup] --> B[Foreground Tailscale claim]
B --> C{Port 443 available?}
C -->|yes| D[Managed route active]
C -->|persistent route conflict| E[Ownership conflict]
E --> F[Configuration exit 78]
F --> G[Systemd stops restart loop]
E --> H[Operator reviews route]
Decision needed
Why: Automatically removing the matching route would take ownership of configuration that current documentation says may be externally managed. Before merge
Agent review detailsSecurityNone. PR surfaceSource +34, Tests +122, Docs +1. Total +157 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Approve the non-mutating ownership boundary, document targeted operator recovery, and merge only after exact-head checks verify the refreshed branch. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: the fixture models the persistent listener collision and proves current main lacks the exit-78 translation; the contributor also supplied a redacted off-host run. A direct local execution was not possible in this read-only environment. Is this the best way to solve the issue? Yes, subject to maintainer approval of the upgrade policy. Automatically removing a shape match would violate the documented external-route ownership boundary, while the proposed error preserves state and gives a targeted recovery path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 10610d9f639e. 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
History |
|
Retained, redacted external-contract evidence from the disposable off-host run described in the PR body follows. Hostnames, tailnet identifiers, foreground session IDs, and the private managed-backend port are removed. The Funnel run had the same legacy "AllowFunnel": { "<redacted-host>.ts.net:443": true }Its first patched startup logged The non-mutation case used a root proxy target of The upstream contract was also checked directly at tag All Tailscale state in this proof existed only on disposable remote nodes. Those routes and nodes were cleared/logged out and all four remote leases were released. The development host's Tailscale configuration was never read or changed. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Revision note for the off-host evidence above: the automatic route-removal behavior and success logs belong to superseded HEAD |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…6069) * fix(gateway): migrate legacy Tailscale routes on upgrade * fix(gateway): preserve unattributable Tailscale routes
Closes #125390
What Problem This Solves
Fixes an issue where users upgrading an existing managed Tailscale Serve or Funnel deployment could enter a gateway restart loop when a persistent HTTPS route already owned port 443.
Why This Change Was Made
Gateway startup now treats Tailscale's port-443 listener collision as an ownership conflict and exits with configuration status 78. OpenClaw does not parse the existing route shape to infer ownership and never removes it automatically: a legacy OpenClaw route and an operator-managed route can be identical.
The startup error tells operators to inspect the route and either remove the confirmed legacy root handler explicitly or keep the external route and disable managed Tailscale ingress. This preserves lifecycle-owned managed routes without taking ownership of unrelated Tailscale configuration.
User Impact
Upgrades with a stale persistent route stop once with an actionable migration message instead of entering a systemd restart loop. Operator-managed routes remain untouched, including a persistent root route whose shape exactly matches an older OpenClaw route.
Evidence
listener already exists for port 443error.node scripts/check-changed.mjspnpm buildpnpm check:docsProduction delta is +35 lines: a typed ownership-conflict error, collision translation at the Tailscale claim boundary, and supervised exit-status mapping. Test/support delta is +122 lines; docs delta is +1 line.