Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 12:44 AM ET / 04:44 UTC. ClawSweeper reviewWhat this changesClamp the Gateway discovery advertise timeout after parsing so oversized configured values do not overflow Node’s timer and prematurely continue startup. Merge readinessThis PR remains necessary: current Priority: P2 Review scores
Verification
How this fits togetherGateway startup invokes registered discovery plugins to advertise the local Gateway before reporting readiness. The configured advertise timeout bounds each plugin’s startup wait, then either retains its shutdown hook or logs a timeout and continues. flowchart LR
Config[Gateway timeout environment value] --> Parse[Strict positive timeout parsing]
Parse --> Clamp[Timer-safe duration]
Plugin[Discovery plugin advertise call] --> Wait[Startup wait race]
Clamp --> Wait
Wait --> Ready[Gateway ready or timeout warning]
Wait --> Cleanup[Publisher shutdown hook]
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +35. Total +35 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Merge the owner-local clamp and regression test after the current checks complete, so every parsed discovery advertise timeout is timer-safe before Gateway startup races the publisher. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s resolver forwards the overflowing value to the discovery timer, and a direct Node probe confirms the 1 ms overflow behavior; the PR body additionally provides a real Gateway before/after run. Is this the best way to solve the issue? Yes. Clamping at the timeout-resolution boundary is the narrowest maintainable repair: it preserves the existing invalid-value default while protecting every discovery publisher from the unsafe timer value. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 618f3298c7dc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
1e09c56 to
5f19b32
Compare
|
Land-ready verification for original contributor head 5f19b32: actual Node setTimeout(2147483648) emits TimeoutOverflowWarning and silently schedules in 1ms, making Gateway plugin discovery falsely time out immediately. The contributor fixes the canonical Gateway timeout owner with the existing clampTimerTimeoutMs helper; actual Node preserves the correct maximum 2147483647ms. The full real Gateway discovery owner suite passed 11/11, including a delayed asynchronous advertisement and its shutdown hook. Only contributor-branch repair was converting the regression Promise executor to its equivalent lint-safe block; original author and exact production fix are preserved. Proof: OPENCLAW_VITEST_MAX_WORKERS=1 node /Users/steipete/Projects/openclaw/scripts/run-vitest.mjs src/gateway/server-discovery-runtime.test.ts; actual oxlint and oxfmt both passed; fresh complete-branch Codex xhigh autoreview passed (0.99). Exact-head full hosted CI run 30684363996 attempt 2 is green, including Gateway, lint, types, QA, and openclaw/ci-gate; first attempt hit the independently diagnosed unrelated private-QA integration flake and was retried without source changes. |
|
Merged via squash.
|
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.
What Problem This Solves
Fixes an issue where Gateway startup could treat a configured discovery advertise timeout above Node's timer ceiling as approximately 1ms. A discovery service that needed only 50ms could therefore be reported as timed out almost immediately.
Why This Change Was Made
The parsed discovery timeout is now passed through the project's existing timer clamp before it reaches
setTimeout. Values up to the project timer ceiling keep their configured duration, oversized values are capped consistently with other timers, and invalid values still use the existing default.User Impact
Operators can use a large positive discovery advertise timeout without triggering
TimeoutOverflowWarningor accidentally shortening Gateway startup tolerance to about 1ms.Evidence
Fresh reproduction on latest
main(c50237e37df) with a 50ms discovery advertiser:After the fix, an isolated real Gateway loaded a manifest-backed discovery plugin with the same timeout and delay:
Focused verification:
node scripts/run-vitest.mjs run src/gateway/server-discovery-runtime.test.ts— 11 tests passed.pnpm exec oxfmt --check src/gateway/server-discovery-runtime.ts src/gateway/server-discovery-runtime.test.ts— both changed files passed.