Skip to content

fix: honor the gateway probe overall timeout - #127197

Merged
steipete merged 3 commits into
mainfrom
codex/fix-gateway-probe-overall-timeout
Oct 21, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/fix-gateway-probe-overall-timeout

Conversation

@steipete

@steipete steipete commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #127166

What Problem This Solves

Fixes gateway probe --timeout exceeding its advertised overall budget when discovery is slow or finds many Gateways.

User Impact

Known local and explicit Gateways are checked while discovery runs. Discovery, SSH configuration and tunnel setup, connections, and read checks share one deadline, and unfinished checks report a timeout. Existing options and standalone discovery behavior are preserved; no migration is needed. Connection and process cleanup can briefly extend elapsed command time.

Why This Change Was Made

On the integrated main base (431f80cf7ac4), src/commands/gateway-status.ts:135 resolves SSH configuration before cancellation exists, :232 waits for discovery before probing known targets, and :308 gives probes a fresh budget. src/infra/bonjour-discovery.ts:264 also restarts the timeout for each DNS-SD resolution.

The command owns one monotonic deadline and cancellation signal. Its existing discovery, SSH, and probe owners consume the remaining budget. Direct checks on the tunnel's preferred loopback port finish before the tunnel can bind it, preserving credential routing. Main's consolidation in 32e8d817f7d1 is retained: SSH resolution and auto-discovery remain in the command, and the deleted gateway-status/discovery.ts is not restored. No additional timeout manager, fallback, or public option is introduced.

Against the integrated main base: production +229/-153 (net +76), tests +136/-6 (net +130), documentation +5/-0. The added production code supports concurrent checks and cancellation through the existing owners.

Evidence

Three regressions fail against main's production code and pass with the fix: DNS-SD resolves a third beacon after the deadline; known healthy targets remain unprobed during slow discovery; and the SSH tunnel starts before same-port direct checks finish. The tunnel regression uses controlled promises.

All 42 tests pass across gateway-status.test.ts, bonjour-discovery.test.ts, and ssh-config.test.ts via the repository runner with one worker. The full focused wrapper took 67.53 seconds, including compiler preparation (infra shard 46.84 seconds; command shard 8.23 seconds). Scoped type-aware lint, formatting, and diff checks pass. Independent Codex review reports scoped-clean with no actionable P0-P2 findings.

No live network or SSH endpoint was used, per this repair lane's focused-proof scope. Owner-level regressions exercise deadline and ordering behavior; exact-head PR CI supplies broad validation. Exact-head CI run 39639655335 passed on 3d84106ff8d9f5909fb573dfa8295a8583ca46ac: 33 jobs passed, with no failing or pending jobs; the repository watcher returned GREEN. Runner queueing caused most of the delay; no CI rerun or follow-up fix was needed. Superseded review-orchestration checks remain visible in GitHub's aggregate rollup and are excluded by the repository watcher.

ClawSweeper re-review was requested once on this head and observed through the 25-minute window. Its automatic attempts did not publish a current-head review; run 39644119762 subsequently reported that no publishable artifact was produced. The visible review still covers the previous head. This is a review-infrastructure gap, not a claim of a clean current-head ClawSweeper review; the independent review above is complete.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 13:17
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 21, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels Aug 21, 2026
@clawsweeper

clawsweeper Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares one deadline across Gateway discovery, SSH setup, and probes while checking known targets concurrently.

Example: On macOS, run openclaw gateway probe --timeout 1000 with 100 advertised Gateways.

  • Before: Browse and sequential DNS-SD resolutions can consume about 101 seconds before subsequent probes.
  • After: Discovery and probes share the 1000 ms budget, with unfinished checks canceled and cleanup allowed to finish.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair is coherent and exact-head CI passed, but behavioral evidence stops at mocked boundaries.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the external-contributor proof gate; its stated validation scope supplies owner-level regressions and exact-head CI, with no live DNS-SD or SSH claim.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Gateway diagnostics can run for minutes despite a requested one-second overall check budget.
Reason: The existing CLI contract and canonical report establish the defect, and the maintainer-authored direction preserves existing configuration and standalone discovery behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a source-verifiable timeout defect still present on main, and the current diff resolves the three previous findings without a discrete introduced bug.

Priority: P2
Reviewed head: bf49483ac6270c0eb2c40cc8a5a10797aa480d64

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied regressions mock process and transport boundaries; no shipped CLI run demonstrates DNS-SD exhaustion or SSH cancellation.
Agent review details

How this fits together

The Gateway probe CLI combines configured and explicit endpoints, Bonjour discovery, credential resolution, optional SSH forwarding, and read-only Gateway probes into diagnostic text or JSON.

flowchart TD
  A[Gateway probe CLI] --> B[Shared deadline and cancellation]
  B --> C[Known target probes]
  B --> D[Bonjour discovery]
  B --> E[SSH setup and tunnel probe]
  D --> E
  C --> F[Diagnostic results]
  E --> F
Loading

Technical review

Best possible solution:

Keep the command as the deadline owner and use existing cancellation and cleanup contracts throughout discovery, SSH setup, and probing.

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

Current-main source establishes the sequential DNS-SD timeout multiplier and fresh later probe budgets; this read-only review ran no reproduction.

Is this the best way to solve the issue?

The patch uses the existing command, discovery, process, tunnel, and probe owners, preserves standalone discovery semantics, and introduces no unnecessary manager or parallel implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0f9411abebbd.

Provenance checked

  • Gateway probe orchestration keeps the original intent (c2df24c: The owner consolidation in refactor: fold single-consumer capability operations into owners #177839 removed private forwarding modules while preserving budgets, cancellation, and cleanup.)
  • Darwin discovery timeouts keeps the original intent (266643b: Local and wide-area discovery use bounded subprocess commands; standalone discovery retains its documented per-command timeout when no aggregate deadline is supplied.)
  • SSH configuration resolution keeps the original intent (db02a96: Bounded commands use the canonical process wrapper; this PR forwards cancellation without changing trusted-client selection or explicit SSH-port precedence.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 266643b adds src/infra/bonjour-discovery.ts:104 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 266643bb9484; files: src/infra/bonjour-discovery.ts)
  • xingzhou: Raw commit bc72b70 adds src/infra/ssh-config.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: bc72b709c94e; files: src/infra/ssh-config.ts)

PR surface

Source +75, Tests +96, Docs +5. Total +176 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 210 135 +75
Tests 2 102 6 +96
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 317 141 +176

Review metrics

Metric Value Why it matters
Production versus tests Production +210/-135; tests +102/-6 Production growth supports concurrent known-target checks and cancellation through existing owners; the two added regressions cover distinct deadline and scheduling failures.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #127166
Summary: This PR is the implementation candidate for the reported overall timeout multiplier.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The fix bounds diagnostic delays on crowded macOS networks; no emergency runtime outage or blocked first useful run is established.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • For stronger confidence, add redacted CLI output showing a healthy known target survives slow discovery and unfinished network or SSH work stops at the shared deadline.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (8 earlier review cycles)
  • reviewed 2026-08-21T13:23:56.259Z sha 09e88f7 :: needs changes before merge. :: [P2] Propagate the absolute deadline to lower timeout owners
  • reviewed 2026-08-21T13:54:12.901Z sha 09e88f7 :: found issues before merge. :: [P2] Propagate the deadline to lower timeout owners
  • reviewed 2026-08-22T15:49:45.296Z sha 09e88f7 :: needs changes before merge. :: [P2] Enforce the deadline in lower timeout owners
  • reviewed 2026-08-22T16:32:01.572Z sha 09e88f7 :: needs changes before merge. :: [P2] Enforce the deadline in lower timeout owners
  • reviewed August 27, 2026, 7:59 AM ET / 11:59 UTC sha unknown :: needs changes before merge. :: [P2] Enforce the deadline in lower timeout owners
  • reviewed 2026-09-04T05:52:08.861Z sha 09e88f7 :: blocked before merge. :: [P2] Enforce the deadline in lower timeout owners
  • reviewed 2026-09-25T19:59:03.829Z sha 09e88f7 :: blocked before merge. :: [P2] Enforce the deadline inside the lower timeout owners | [P2] Report probes skipped because the budget expired
  • reviewed 2026-10-09T13:50:45.512Z sha 09e88f7 :: needs changes before merge. :: [P2] Enforce the deadline inside the lower timeout owners | [P2] Record timeout-skipped targets in the diagnostic result | [P2] Keep discovery from consuming every known-target probe opportunity

Reviewed October 21, 2026, 5:36 AM ET / 09:36 UTC (Revision 9).

@steipete
steipete force-pushed the codex/fix-gateway-probe-overall-timeout branch from 09e88f7 to e4ed40b Compare October 21, 2026 08:35
@steipete steipete changed the title fix(gateway): honor the overall probe timeout fix: honor the gateway probe overall timeout Oct 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 21, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 21, 2026
@clawsweeper clawsweeper Bot removed clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
Integrate current main while retaining its inlined discovery and SSH resolution owners. Keep the shared probe budget and finish same-port loopback probes before binding an SSH tunnel. Add deterministic regression coverage for that ordering.
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 21, 2026
@steipete
steipete merged commit 7bd7a3a into main Oct 21, 2026
126 of 127 checks passed
@steipete
steipete deleted the codex/fix-gateway-probe-overall-timeout branch October 21, 2026 17:51
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
* fix: share the gateway probe timeout across discovery and connections

* test: type gateway probe mocks against the production contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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.

gateway probe overall timeout is multiplied by Darwin DNS-SD resolution

2 participants