fix(tailscale): retry status json after serve startup#91553
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 13, 2026, 2:57 AM ET / 06:57 UTC. Summary PR surface: Source +52, Tests +51. Total +103 across 3 files. Reproducibility: yes. for the failure mechanism: the real harness deterministically causes the first production status probe to time out and shows that a second probe succeeds; current main's single-attempt path has no recovery step. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Merge the final head after exact-head maintainer review, retaining the bounded transient-only retry and allowing the linked issue to close when the fix lands. Do we have a high-confidence way to reproduce the issue? Yes for the failure mechanism: the real harness deterministically causes the first production status probe to time out and shows that a second probe succeeds; current main's single-attempt path has no recovery step. Is this the best way to solve the issue? Yes. Retrying the exact status read only for recognized daemon-readiness failures is narrower and more maintainable than adding an unconditional sleep, a new binary-path setting, or broad retries for permanent failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1076c23d46b. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +52, Tests +51. Total +103 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
Review history (4 earlier review cycles)
|
b516c83 to
ed5a0fe
Compare
|
Resolved the branch-history conflict by rebuilding this PR from current Current head: Verification on the refreshed content:
The old simulated repro script was intentionally dropped; the PR body now records the exact refreshed-head live proof and its limitations. |
ed5a0fe to
5a6e0cb
Compare
|
Addressed the ClawSweeper P2 and CI LOC guard on final head
The PR body has the refreshed six-field proof. GitHub reports |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: TUARAN <[email protected]>
Co-authored-by: TUARAN <[email protected]>
f58e681 to
97ee068
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(tailscale): retry status json after serve startup This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Merged via squash.
|
* fix(tailscale): restrict status retries * test(tailscale): cover retry eligibility * refactor(tailscale): add status retry helper * refactor(tailscale): split status retry helper * fix(tailscale): scope status retry to serve startup Co-authored-by: TUARAN <[email protected]> * fix(tailscale): recognize app service startup errors Co-authored-by: TUARAN <[email protected]> --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Gateway startup can configure Tailscale Serve successfully and then immediately lose the published hostname because the first
tailscale status --jsonprobe hits a transient daemon or macOS service startup race. The Gateway remains running, but it can omit the derived Serve URL/origin and previously emitted a scary command-failure log.Closes #42798.
Why This Change Was Made
getTailnetHostnamecallers, including the latency-boundedopenclaw statusscan, remain single-attempt.retryAsynchelper for three total attempts with a fixed 500 ms delay.timedOut) and Tailscale's documented/observed local daemon or macOS service readiness failures. Missing binaries, permission errors, malformed JSON, and unrelated failures still stop immediately.The maintainer rewrite also removes the one-use retry module from the contributor version and keeps the policy in the owning Tailscale integration module.
User Impact
Tailscale Serve startup now tolerates a brief local daemon/network-extension readiness race and can recover the published hostname and MCP app origin without adding retry latency to status/configuration callers. Persistent transient failures can add at most two 500 ms delays plus the existing per-attempt command timeout.
Contributor: @TUARAN. The rebased commits and maintainer fix commits retain
Co-authored-by: TUARAN <[email protected]>credit.Evidence
Exact head:
97ee0685811caaa0b00035d3b789b53c8188542cOPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree mise exec [email protected] -- node scripts/run-vitest.mjs src/infra/tailscale.test.ts src/gateway/server-tailscale.test.ts— 45 tests passed across 2 shards.CI=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false mise exec [email protected] -- node scripts/check-changed.mjs -- src/gateway/server-tailscale.test.ts src/gateway/server-tailscale.ts src/infra/tailscale-status.ts src/infra/tailscale.test.ts src/infra/tailscale.ts— passed full selected core/core-test typecheck, complete core lint, formatting, import-cycle, dependency, boundary, and repository guards. This was the documented trusted-source local fallback after Blacksmith Testbox warmup timed out..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output— clean; no accepted/actionable findings.Failed to connect to local Tailscale daemon; the installed Homebrew Tailscale 1.98.9 binary also contains the supported macOS messagefailed to connect to local Tailscale service; is Tailscale running?. Execa 9.6.1 reports command timeouts withtimedOut: true.Not tested on the rewritten head: a fresh root-launchd or isolated userspace Tailscale daemon cycle. Hosted exact-head CI remains required before merge.