fix(gateway): add max reconnect limit to scheduleReconnect (#45469)#77556
fix(gateway): add max reconnect limit to scheduleReconnect (#45469)#77556stellamariesays wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. Source inspection shows current main can keep scheduling ordinary reconnects indefinitely, and the latest PR diff only caps clients that explicitly pass Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Define a caller-aware reconnect policy, wire it to the intended production surface with regression coverage, preserve node-host recovery unless maintainers choose otherwise, and document any new client option or terminal reconnect behavior. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main can keep scheduling ordinary reconnects indefinitely, and the latest PR diff only caps clients that explicitly pass Is this the best way to solve the issue? No. The opt-in cap avoids the prior node-host regression, but it does not solve the reported production behavior; the narrower maintainable path is an explicit caller-specific policy or threshold callback chosen by maintainers. Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against b31774749cc0. |
26881f7 to
e2c4778
Compare
…45469) scheduleReconnect() retried indefinitely with exponential backoff capped at 30s but no maximum retry count. If the gateway is unreachable, the client loops forever accumulating listeners and zombie processes. Changes: - Add MAX_RECONNECT_ATTEMPTS (30) as a static class constant - scheduleReconnect() now gives up after 30 failed attempts, fires onReconnectPaused with a descriptive reason, and sets closed = true - reconnectAttempts resets to 0 on successful hello handshake - reconnectAttempts resets to 0 on explicit stop() - Two new tests: max-reconnect-gives-up and counter-resets-on-success Closes openclaw#45469
TypeScript strict null checks require string | null, not undefined.
8913ad3 to
71c3132
Compare
Address ClawSweeper review feedback: - P2: Make reconnect cap opt-in via maxReconnectAttempts option. Undefined = unlimited, preserving node-host unbounded retry behavior. - P3: Fix reset test to send proper type:"res" with payload.type:"hello-ok" instead of type:"connect" so handleMessage actually processes it.
|
Closing in favor of a new PR. Fixed review feedback: made reconnect cap opt-in via maxReconnectAttempts option. |
scheduleReconnect() retried indefinitely with exponential backoff capped at 30s but no maximum retry count. If the gateway is unreachable, the client loops forever accumulating listeners and zombie processes.
Changes:
Closes #45469
Summary
Describe the problem and fix in 2–5 bullets:
If this PR fixes a plugin beta-release blocker, title it
fix(<plugin-id>): beta blocker - <summary>and link the matchingBeta blocker: <plugin-name> - <summary>issue labeledbeta-blocker. Contributors cannot label PRs, so the title is the PR-side signal for maintainers and automation.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.Diagram (if applicable)
For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write
N/A.Security Impact (required)
Yes/No)Yes/No)Yes/No)Yes/No)Yes/No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No)Yes/No)Yes/No)Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.