Skip to content

fix(gateway): preserve managed Tailscale ingress compatibility - #126519

Merged
joshavant merged 4 commits into
mainfrom
fix/tailscale-funnel-tailnet-ingress
Aug 20, 2026
Merged

joshavant merged 4 commits into
mainfrom
fix/tailscale-funnel-tailnet-ingress

Conversation

@joshavant

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes two upgrade-sensitive managed Tailscale regressions found during cross-platform release testing:

  • Tailnet peers opening a managed Funnel URL were rejected even with the configured Gateway password.
  • Interrupting an interactive managed Serve/Funnel Gateway could leave the foreground Tailscale route claimed.

Why This Change Was Made

Tailscale distinguishes public Funnel ingress from tailnet access to the same Funnel hostname: public requests carry Tailscale-Funnel-Request: ?1, while authenticated tailnet requests use the Serve identity-header path without that marker. Managed Funnel now accepts both of those upstream-defined forms while continuing to require password authentication for both. Missing-marker acceptance remains scoped to the dedicated managed Funnel listener; malformed markers and unattributable ordinary-listener proxy traffic still fail closed.

The route-owner worker now drains its detached Tailscale child when the worker itself receives a terminal signal. This preserves the existing single route owner and cleanup flow instead of adding a parallel recovery path.

Upstream contract checked directly: Tailscale Serve/Funnel request handling and tailnet identity-header coverage.

Production LOC: +6/-1 (net +5) | Tests: +98/-17 | Docs/changelog: +8/-1

The five added production lines are the terminal-signal handoff at the route-lifecycle owner. The Funnel attribution repair is net neutral.

User Impact

Operators can use the same managed Funnel URL from both the public internet and their tailnet after upgrading, with the configured password required in both cases. Interactive Gateway shutdown no longer leaves the managed Tailscale port claimed.

Evidence

Frozen base: 6eb9344e7df680e668152c39054bab450437107d
Exact tested head: e8d12aa0a2a4bbcac795dcbbeb0cf722ca571c96

  • Regression captured before editing: the candidate build returned 403 proxy_attribution_required to an authenticated tailnet peer on a managed Funnel hostname; the latest stable comparison accepted the same flow.
  • Focused tests: 122 Gateway attribution/auth tests and 4 route-owner worker tests pass.
  • The process-level SIGINT regression test fails on the pre-fix worker with { code: null, signal: "SIGINT" }, then passes on this head and verifies that the child PID is gone.
  • Full build, package creation, tarball integrity, and installed-package import graph pass. Tested tarball SHA-256: 82b6a99d60a23733a8da58e86b637659d67b6cc7f7b8fdab9c775c2f5ee3700f.
  • Cross-platform installed-package campaign:
    • macOS 26.6.2 arm64, Node 24.19.0, Tailscale 1.102.2
    • Ubuntu 26.04 x64, Node 24.15.0, Tailscale 1.102.3
    • Windows Server 2022 x64, Node 24.15.0, Tailscale 1.102.3
  • Managed Funnel, tailnet path: no auth 401; password-authenticated canonical HTTP route reached (404 for a deliberately nonexistent profile); password-authenticated WebSocket health returned ok: true.
  • Managed Funnel, public path: no auth 401; password-authenticated canonical HTTP route reached (404); password-authenticated WebSocket health returned ok: true. macOS and Windows-backed Funnel nodes were both exercised.
  • IPv4 and IPv6 tailnet requests passed on macOS-backed Funnel.
  • Ordinary-listener and same-host forged Tailscale headers remain rejected; the dedicated managed listener still requires the password even when gateway.auth.allowTailscale=true.
  • Native/external Serve remained compatible on Linux with explicit trusted-proxy configuration; removing that trust kept external/forged Tailscale headers rejected.
  • Exact-head macOS Ctrl-C removed the managed route and route-owner/claim processes within two seconds. Windows hard-disconnect cleanup also left {} route state and no route-owner/Funnel process.
  • Existing-route upgrade behavior remained non-destructive: a conflicting stable-managed route made the candidate exit without replacing or mutating that route.

The Windows public DNS record had not propagated during the proof window, so public-edge requests were pinned to both active Funnel edge IPs inside the disposable Linux test guest. TLS, HTTP authentication, routing, and WebSocket health all succeeded; the temporary guest-only host mapping was restored immediately afterward.

@joshavant
joshavant requested a review from a team as a code owner August 20, 2026 02:45
@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Aug 20, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 10:33 AM ET / 14:33 UTC.

ClawSweeper review

What this changes

The PR accepts authenticated tailnet traffic through a managed Tailscale Funnel listener and stops the foreground Tailscale route child when its owner worker receives a terminal signal.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 4 items remain

Keep open for explicit Gateway-owner review. The branch repairs behavior that current main still rejects, preserves password authentication, and includes substantial real-environment evidence; its protected maintainer label and security-sensitive upstream attribution contract require human acceptance before merge.

Priority: P1
Reviewed head: b990f79255b885479c14dcb9ab39f4a5fa507252
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong runtime evidence and focused boundary tests support a clean repair, pending the Gateway owner's upstream-contract decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides detailed after-fix installed-package and cross-platform runtime results for both Funnel paths and route cleanup, with an exact runtime-proof head and a later docs/test-only commit.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides detailed after-fix installed-package and cross-platform runtime results for both Funnel paths and route cleanup, with an exact runtime-proof head and a later docs/test-only commit.
Evidence reviewed 10 items Current-main regression: Current main requires the Funnel marker, so an unmarked tailnet request on the managed Funnel listener is classified as unattributable.
Dedicated listener repair: The branch accepts only an absent marker or the canonical ?1 marker after listener-owned managed-Tailscale provenance and forwarded-client validation.
Authentication boundary: Tailscale header authentication remains restricted to tailscale-serve attribution; Funnel traffic therefore continues through configured shared-secret authentication.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/infra/tailscale-route-owner.worker.test.ts

Result: FAIL (partial) — step 2 expect_output terminates the claim before exiting on an interactive interrupt: expected terminal output was not visible within 30 seconds: "terminates the claim before exiting on an interactive interrupt"

runner@runnervm76f27:/tmp/clawsweeper-live-proof-126519-SMVatX/target$ node scripts/run-vitest.mjs src/infra/tailscale-route-owner.worker.test.ts
[test] starting test/vitest/vitest.infra.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126519-SMVatX/target

node scripts/run-vitest.mjs src/infra/tailscale-route-owner.worker.test.ts
 ✓  infra  src/infra/tailscale-route-owner.worker.test.ts (4 tests) 502ms

 Test Files  1 passed (1)
      Tests  4 passed (4)
   Start at  14:34:35
   Duration  1.80s (transform 1.05s, setup 1.16s, import 27ms, tests 502ms, environment 0ms)

[test] passed 1 Vitest shard in 6.91s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126519-SMVatX/target$ node scripts/run-vitest.mjs src/infra/tailscale-route-owner.worker.test.ts
[test] starting test/vitest/vitest.infra.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-126519-SMVatX/target

 ✓  infra  src/infra/tailscale-route-owner.worker.test.ts (4 tests) 432ms

 Test Files  1 passed (1)
      Tests  4 passed (4)
   Start at  14:34:42
   Duration  1.06s (transform 329ms, setup 504ms, import 12ms, tests 432ms, environment 0ms)

[test] passed 1 Vitest shard in 6.03s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126519-SMVatX/target$























Assertions:

  • FAIL expect_output: terminates the claim before exiting on an interactive interrupt

How this fits together

Managed Tailscale Serve/Funnel forwards traffic into a dedicated loopback Gateway listener, where ingress attribution determines authentication behavior. A route-owner worker keeps the foreground Tailscale route alive and must release it when Gateway exits.

flowchart LR
A[Tailnet or public request] --> B[Dedicated managed Funnel listener]
B --> C[Ingress attribution]
C --> D[Gateway password authentication]
D --> E[Gateway HTTP and WebSocket routes]
F[Gateway terminal signal] --> G[Route owner worker]
G --> H[Foreground Tailscale route stopped]
Loading

Decision needed

Question Recommendation
Does the Gateway owner accept Tailscale's documented distinction that a managed Funnel tailnet request may omit the Funnel marker while public Funnel requests carry ?1? Accept the documented Tailscale contract: Confirm the linked upstream revision and retain this narrowly scoped managed-listener acceptance plus mandatory password authentication.

Why: That upstream transport distinction expands accepted input on a public-facing listener, although the code retains the dedicated-listener boundary and password gate.

Before merge

  • Resolve merge risk (P1) - Managed Funnel now treats an absent marker as valid only because the dedicated loopback listener is Tailscale-controlled; Gateway ownership should confirm the cited upstream missing-marker contract before merge. Direct upstream retrieval was blocked by DNS in this review environment.
  • Resolve merge risk (P1) - The bug fix adds five net production lines for terminal-signal cleanup; the focused child-process regression test supports the added lifecycle behavior, but it remains an availability-sensitive path.
  • Complete next step (P2) - A protected maintainer item needs the Gateway owner's explicit acceptance of the upstream ingress contract; no mechanical repair is indicated.
Agent review details

Security

None.

PR surface

Source +5, Tests +88, Docs +6. Total +99 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 6 1 +5
Tests 4 107 19 +88
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 120 21 +99

Review metrics

Metric Value Why it matters
Production versus test delta production +5/-1; tests +107/-19; docs +7/-1 The production growth is confined to terminal-signal lifecycle ownership, while the added tests cover ingress attribution, password gating, and child cleanup.

Stored data model

Persistent data-model change detected: serialized state: src/infra/tailscale-route-owner.worker.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Confirm upstream ingress semantics (recommended)
    A Gateway owner should verify the exact cited Tailscale behavior before accepting unmarked traffic on the dedicated managed Funnel listener.
  2. Decline missing-marker acceptance
    Keep the existing marker-only policy if supported Tailscale versions do not guarantee the proposed tailnet request shape.

Technical review

Best possible solution:

Land the dedicated-listener attribution repair only after a Gateway owner confirms the cited Tailscale public-versus-tailnet request contract and keeps password authentication mandatory for both paths.

Do we have a high-confidence way to reproduce the issue?

Yes—current main's managed-Funnel branch rejects an absent marker at src/gateway/ingress-attribution.ts:165, and the PR supplies focused pre/post and cross-platform runtime evidence; local execution was not performed in the read-only checkout.

Is this the best way to solve the issue?

Yes, subject to Gateway-owner confirmation of the cited Tailscale contract: the patch changes attribution at the dedicated listener owner and leaves password authentication outside the Serve-only header-auth bypass.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 267ffc4754a0.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides detailed after-fix installed-package and cross-platform runtime results for both Funnel paths and route cleanup, with an exact runtime-proof head and a later docs/test-only commit.

Label justifications:

  • P1: The PR repairs managed Funnel access and shutdown behavior that can break an operator's running Gateway workflow.
  • merge-risk: 🚨 compatibility: Existing managed Funnel deployments change from marker-only acceptance to accepting the documented tailnet request shape.
  • merge-risk: 🚨 security-boundary: The patch changes which forwarded requests are attributed as managed Funnel traffic, so listener provenance and password enforcement are merge-critical.
  • merge-risk: 🚨 availability: The route-owner signal path controls whether a foreground Tailscale route remains claimed after Gateway termination.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides detailed after-fix installed-package and cross-platform runtime results for both Funnel paths and route cleanup, with an exact runtime-proof head and a later docs/test-only commit.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides detailed after-fix installed-package and cross-platform runtime results for both Funnel paths and route cleanup, with an exact runtime-proof head and a later docs/test-only commit.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame and history place the original strict managed-Funnel attribution and route-owner worker implementation in this commit. (role: current implementation introducer; confidence: medium; commits: 1d2986b06fbe; files: src/gateway/ingress-attribution.ts, src/infra/tailscale-route-owner.worker.ts, src/infra/tailscale.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Have a Gateway owner confirm the cited Tailscale missing-marker contract before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-20T02:54:17.370Z sha fb44b07 :: needs maintainer review before merge. :: none

@joshavant

Copy link
Copy Markdown
Collaborator Author

ClawSweeper follow-up for the reviewed head fb44b074a1a46f1ec111f9c9ea7fde73d1bbb216:

  • No actionable findings were reported.
  • The optional rank-up move to rebase onto current main is intentionally skipped. This campaign is frozen on base 6eb9344e7df680e668152c39054bab450437107d so the cross-platform evidence and exact-head package validation remain attributable to one candidate rather than chasing a moving target.
  • Focused exact-head Gateway/route-owner tests pass. Exact-head Package Acceptance is still running and will be linked when it settles.

The dedicated managed-listener boundary and mandatory password authentication remain unchanged.

@joshavant

Copy link
Copy Markdown
Collaborator Author

Exact-head validation update for fb44b074a1a46f1ec111f9c9ea7fde73d1bbb216:

  • Package Acceptance run 32326000727: PASS — package resolution/integrity, npm 12 install, and all selected Docker install, upgrade, doctor, plugin, recovery, and survivor lanes passed (20 successful jobs; no failures).
  • PR CI run 32325988998: PASS on retry without a code change. The initial red was a 400.9 MB plugin-list startup sample against a 400 MB limit; the unchanged retry passed, confirming unrelated measurement noise.
  • ClawSweeper reviewed this exact head and reported no actionable findings.

The live cross-platform runtime proof used e8d12aa0a2a4bbcac795dcbbeb0cf722ca571c96; the only subsequent commit updates the managed-Funnel integration expectation and does not change product/runtime code.

The candidate remains intentionally anchored to base 6eb9344e7df680e668152c39054bab450437107d.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 20, 2026
@joshavant
joshavant merged commit a4901b6 into main Aug 20, 2026
227 checks passed
@joshavant
joshavant deleted the fix/tailscale-funnel-tailnet-ingress branch August 20, 2026 20:04
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 21, 2026
…law#126519)

* fix(gateway): accept tailnet peers on managed Funnel

* fix(gateway): release Tailscale claim on interrupt

* test(gateway): cover Funnel tailnet ingress

* docs: remove Tailscale changelog entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant