Repository navigation
fix(node): debounce health failures and recovery - #950
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughNode health checks now use configurable consecutive failure and recovery thresholds. The job tracks per-node result streaks and assigns shared status transitions and core restarts to the health-check owner. Status writes can require the database status to match the observed status. ChangesNode Health Check Flow
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant process_node_health_check
participant verify_node_backend_health
participant NodeOperation
participant update_node_status
process_node_health_check->>verify_node_backend_health: Probe node health
verify_node_backend_health-->>process_node_health_check: Return health result
process_node_health_check->>process_node_health_check: Apply configured streak threshold
process_node_health_check->>NodeOperation: Request status update with observed status
NodeOperation->>update_node_status: Apply guarded database update
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue was established in the reviewed changes. Normal checks can proceed. Security Architecture Review
Pre-merge checks |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
8894045 to
8dc37e7
Compare
Add tests for the fail and recover thresholds: probes below the fail threshold keep a node connected, a good probe restarts the failure streak, an errored node needs consecutive good probes, streaks restart for a replaced node object or a changed stored status, followers never write status or repair, a dead core is repaired before the threshold, and thresholds of 1 react to a single probe. List NODE_HEALTH_FAIL_THRESHOLD and NODE_HEALTH_RECOVER_THRESHOLD in .env.example, with the usage polling note for dead nodes.
|
@coderabbitai review |
✅ Action performedReview finished.
|
…e03754dec Checked with git ls-remote on 2026-10-11 14:49 UTC; every other forked repository, tag and release is unchanged since 02:55 UTC. - PasarGuard#617 (ef84f21) and the confirmation-dialog escaping (1c25036) are ported by design: the fork has 24bcbba and 0e08156 for the CORS credentials and the constant-time signature compare, and 9c3ae14 for the dialogs (escapeValue on, Trans instead of raw HTML). - The chart stylesheet escaping (a1d697b) and PasarGuard#859 (ba4a0ab, the device-limit race and the proxy_settings leak in /info and /raw) are queued security: yes; the fork has neither, so the gate is red on them until they are ported. - PasarGuard#950, PasarGuard#947, PasarGuard#857, PasarGuard#903, PasarGuard#908 and PasarGuard#996 are queued security: no until 2026-10-25, each with its reason. - Node PasarGuard#64 (e03754dec, WireGuard peers through Xray's UserManager, Go 1.27.1, unpinned pre-release Xray by default) is queued security: no until 2026-10-25; a port must pin the Xray tag. Against live upstream the panel gate now fails only on the 19 port-queue commits classified security: yes, and the node ledger only on f72ac0efacdb (security: yes).
…rt queue; 922d235 waits for PasarGuard#950
* fix(node): debounce health failures and recovery * test(node): cover the health probe thresholds and document them Add tests for the fail and recover thresholds: probes below the fail threshold keep a node connected, a good probe restarts the failure streak, an errored node needs consecutive good probes, streaks restart for a replaced node object or a changed stored status, followers never write status or repair, a dead core is repaired before the threshold, and thresholds of 1 react to a single probe. List NODE_HEALTH_FAIL_THRESHOLD and NODE_HEALTH_RECOVER_THRESHOLD in .env.example, with the usage polling note for dead nodes. --------- Co-authored-by: T3ST3ST3R0N <[email protected]> (cherry picked from commit 4cfcdd0)
A single failed probe currently changes node health and can trigger a reconnect, while a single successful probe or automatic reconnect immediately reports recovery. This adds consecutive failure/recovery thresholds so transient errors do not produce false downtime or premature recovery notifications.
NODE_HEALTH_FAIL_THRESHOLD=3andNODE_HEALTH_RECOVER_THRESHOLD=2, validated as positive integers. Setting both to1restores single-probe transitions.Validation: 134 passing tests on Python 3.14 with node-bridge 0.9.2: 58 existing node/leader/database tests, 33 local threshold/configuration/race checks, 2 real-NATS integration tests (including four Python processes), and 41 node API tests. Ruff and
git diff --checkpass. The PR contains only four production Python files; local validation files are excluded.Existing test limitation:
test_health_poll_recovers_claim_that_expires_after_startuptimes out at line 291 while awaiting the bridge's idle sync worker, before invoking the health checker. The same failure was reproduced with the unchangedorigin/devhealth checker and node-bridge 0.9.2.Closes #620.
Summary by CodeRabbit