Skip to content

fix(gateway): keep long probe timeouts from failing immediately - #186528

Merged
obviyus merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-gateway-probe-deadline-20261028
Oct 28, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
Alix-007:alix/fix-gateway-probe-deadline-20261028

Conversation

@Alix-007

@Alix-007 Alix-007 commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

An accepted gateway probe --timeout above Node's native timer limit becomes a 1 ms timer. A healthy Gateway can therefore appear unreachable immediately, accompanied by TimeoutOverflowWarning.

User Impact

Long selected budgets no longer fail immediately. Ordinary and invalid timeout handling and reachable-but-scope-limited diagnostics retain their existing behavior.

Why This Change Was Made

The probe already owns an absolute monotonic deadline. Reuse scheduleAbsoluteDeadline with that same clock to chunk long waits and cancel it in the existing finally. No new cap, timeout policy/default, parser, protocol, SDK, discovery, SSH, TLS, or authorization change.

Evidence

Observed runtime capture.

Built CLI and real loopback Gateway in secretless Linux arm64 Docker, Node 24.22.1, with isolated profile/HOME/state/config:

Observation Current main, twice Candidate, twice
--timeout 2147488648 exit 1, ok:false, connection timeout exit 0, ok:true, real connection in 217/208 ms
Overflow warning Present Absent
  • Normal 5000 ms probes before and after each long-budget run succeeded on both refs. Tiny 1 ms probes timed out; 0, -1, invalid, and 1.5 retained validation failures.
  • Connected candidate probes preserve rpcOk:false, scopeLimited:true, missing scope: operator.read. This is reachable/degraded, not privileged diagnostics success.
  • Focused tests: 35 passed across probe-command and shared scheduler suites. The consolidated long-budget regression fails on main while its ordinary-budget control passes. Formatting, lint, and whitespace checks passed.
  • No physical multiweek wait is claimed. Deterministic tests exercise the complete long deadline and existing 30-day scheduler rearming. No model or channel credentials were needed.

Simplification: folded the added deadline cases into the existing discovery/unfinished-probe table and reused scheduler coverage. Removed duplicated fixture setup and the mock's competing late-timeout timer. Production +10/-5, tests +21/-23 (net -2), docs +2; no ceiling raised.

Two-way door: reverting restores native timer overflow; no migration or new stored format. Blast radius is the CLI probe's overall deadline and cleanup, not Gateway service or authentication policy.

@clawsweeper

clawsweeper Bot commented Oct 28, 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 commands Command implementations size: S labels Oct 28, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves long Gateway probe budgets by scheduling the existing monotonic deadline in safe timer intervals.

Example: Probe a healthy Gateway with --timeout 2147488648.

  • Before: The command immediately reports a timeout and emits TimeoutOverflowWarning.
  • After: The Gateway connects successfully without the overflow warning.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, source-verified repair with shipped-CLI before/after evidence, meaningful consolidated regression coverage, and successful exact-head gates.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): obviyus's linked built-CLI capture exercises the changed command against a real isolated loopback Gateway on Linux arm64 with Node 24.22.1: the long-budget probe connects without overflow warnings, ordinary and invalid budgets retain their behavior, and scope-limited RPC diagnostics remain visible; deterministic tests separately cover long-deadline expiry.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A healthy Gateway appears unreachable immediately when the user selects an accepted timeout above the native timer limit.
Reason: The change restores the documented selected-budget behavior without altering options, defaults, authorization, or output semantics.

Regression provenance

Regression provenance — verified: source commit 7bd7a3afd2c2 by Peter Steinberger; canonical PR #127197 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

This PR fixes a current timeout-overflow bug with the existing deadline scheduler; no actionable defects remain, and exact-head CI passes.

Priority: P2
Reviewed head: ee3fd2764f4538393f4deb11b8116eb3d71c8d12

Before merge

None.

Findings

None.

Agent review details

How this fits together

The gateway probe CLI combines discovery and local, remote, and SSH checks under one deadline, then emits reachability and diagnostic results.

flowchart TD
  A[Gateway probe CLI] --> B[Parse selected budget]
  B --> C[Monotonic deadline]
  C --> D[Existing deadline scheduler]
  C --> E[Discovery and target probes]
  D --> F[Shared cancellation signal]
  F --> E
  E --> G[Reachability and diagnostics]
Loading

Technical review

Best possible solution:

Merge the focused scheduler reuse while preserving the existing shared deadline, cancellation, and diagnostic contracts.

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

Yes: current-main source exposes the overflowing timer, and the supplied built-CLI trace reproduces the failure twice with --timeout 2147488648; this read-only review ran no target code.

Is this the best way to solve the issue?

Yes: the existing scheduler already handles long deadlines and cancellation, making reuse smaller and safer than adding a cap, parser policy, or timeout manager.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Probe command overall deadline and cleanup keeps the original intent (7bd7a3a: Make discovery, SSH setup, connections, and read checks consume one monotonic budget, with cancellation and cleanup.)
  • Discovery and unfinished-probe regression coverage keeps the original intent (7bd7a3a: Protect concurrent known-target probing and cancellation at the overall deadline.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +5, Tests -2, Docs +2. Total +5 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 10 5 +5
Tests 1 21 23 -2
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 33 28 +5

Review metrics

Metric Value Why it matters
Production versus test delta Production +10/-5; tests +21/-23 The small production increase reuses the existing scheduler, while consolidated regression coverage reduces test code.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A reproducible diagnostic bug affects unusually long explicitly selected budgets, with limited blast radius.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (1 earlier review cycle)
  • reviewed 2026-10-28T04:57:44.719Z sha 6d57a43 :: needs maintainer review before merge. :: none

Reviewed October 28, 2026, 1:52 AM ET / 05:52 UTC (Revision 2).

@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 28, 2026
@clawsweeper

clawsweeper Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Built-CLI proof on Linux arm64, Node v24.22.1, against a real isolated loopback Gateway. Main eccef96eacebd8e267f9e1610c854bc8e2e2bc29; candidate production code matches ee3fd2764f4538393f4deb11b8116eb3d71c8d12 (subsequent changes consolidate tests and document the budget).

openclaw --profile <isolated> gateway probe --url ws://127.0.0.1:<task-port> --token <synthetic> --timeout 2147488648 --json

main #1: exit=1 ok=false connect.ok=false error=timeout TimeoutOverflowWarning=true
main #2: exit=1 ok=false connect.ok=false error=timeout TimeoutOverflowWarning=true
fix  #1: exit=0 ok=true  connect.ok=true latencyMs=217 TimeoutOverflowWarning=false
fix  #2: exit=0 ok=true  connect.ok=true latencyMs=208 TimeoutOverflowWarning=false

Both fixed connections:
  rpcOk=false scopeLimited=true error="missing scope: operator.read"

This proves actual transport hello/reachability, not privileged diagnostics success. The limited RPC result was preserved, not suppressed or converted to success.

Normal 5000ms probes before and after each long-budget probe succeeded on both refs. Tiny 1ms timed out. Invalid 0, -1, invalid, and 1.5 budgets rejected on both. The Gateway trees were stopped and joined. No handler replacement, mocked WebSocket peer, accelerated native timers, model keys, or channel credentials.

35 focused tests passed: probe command and existing scheduler. Identical consolidated test on main: ordinary case passes; long case fails because it aborts before the selected budget. Existing deterministic scheduler tests exercise 30-day rearming; no physical multiweek wait is claimed. Regression test delta is -2 lines, with no baseline increase.

@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 28, 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-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 28, 2026
@obviyus
obviyus merged commit b44c771 into openclaw:main Oct 28, 2026
131 of 136 checks passed
@obviyus

obviyus commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

Landed in b44c771. Thanks @Alix-007. gateway status now honors very long --timeout values.

github-actions Bot pushed a commit to Anti-RombikAnti-Rombik8790/openclaw that referenced this pull request Oct 28, 2026
…528)

fix(gateway): keep long gateway status probe timeouts from firing immediately

gateway status accepted a --timeout above the native timer limit and passed it straight to a timer, which overflows to about 1 ms, so the probe reported the Gateway unreachable at once. The probe deadline now uses the existing scheduleAbsoluteDeadline helper.

Evidence: built CLI against a real Gateway on Linux, Node 24.22.1. On main the overflowing timeout failed immediately with an overflow warning (twice); with this change the probe connected in about 210 ms with no warning (twice). The rpcOk false, scope-limited and missing-read-scope results are unchanged, and the normal, tiny and invalid timeout controls behave the same on both refs. Details: openclaw/openclaw#186528 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for reviewing this and running the extra verification!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 29, 2026
…claw#186528)

fix(gateway): keep long gateway status probe timeouts from firing immediately

gateway status accepted a --timeout above the native timer limit and passed it straight to a timer, which overflows to about 1 ms, so the probe reported the Gateway unreachable at once. The probe deadline now uses the existing scheduleAbsoluteDeadline helper.

Evidence: built CLI against a real Gateway on Linux, Node 24.22.1. On main the overflowing timeout failed immediately with an overflow warning (twice); with this change the probe connected in about 210 ms with no warning (twice). The rpcOk false, scope-limited and missing-read-scope results are unchanged, and the normal, tiny and invalid timeout controls behave the same on both refs. Details: openclaw#186528 (comment).

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants