Skip to content

fix(pm-stack): damp stack-sentinel flapping — 3 consecutive probe failures before down (#9049) - #9053

Merged
developing-today-fleet[bot] merged 1 commit into
mainfrom
fix/sentinel-flap-damping-9049
Nov 12, 2026
Merged

developing-today-fleet[bot] merged 1 commit into
mainfrom
fix/sentinel-flap-damping-9049

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What

Flap damping for the stack sentinel, per #9049 (Drew, 2026-11-12: "Tune the health check so load spikes stop paging me").

The sentinel flipped a service to down — and posted the transition that pages Drew — on a single failed probe. Today that produced 433 notification events (30 sent); service:projector alone had 118 events / 4 sends while pm-projector.service never crashed (running since 2026-11-10, same PID). The probes were timing out at 3s under load average 8–10.

Changes

  • src/sentinel-damping.ts (new) — the pure state fold, unit-tested:
    • A service becomes down only after 3 consecutive failed probes (~90s at the 30s cadence). One failure only advances a streak recorded on the entry; a success resets it.
    • A damped down stamps since at the streak start (when the outage actually began).
    • Recovery flips on the first success, and a recovery is only ever posted when the corresponding down was actually posted (the existing postedState bookkeeping, now pinned by tests) — blips and unlanded downs leave no trace.
    • First-sighting baseline amended: a failed first probe starts the streak instead of posting an immediate down.
    • normalizeSentinelEntry migrates pre-fix(pm-stack): stack sentinel flaps on single probe timeouts — paging Drew for load spikes #9049 persisted entries (no streak fields) at load.
  • scripts/stack-sentinel.ts — probes fold through applySentinelProbe; probe timeouts 3s → 10s for projector/kaneo/dispatch/opencode/queue-broker (aggregator /board stays 15s), so a slow-but-alive service under load answers in time.
  • test/sentinel-damping.test.ts (new) — 12 oracle-named tests: 1 failure → still up, no post; 2 → still up; 3 → down + one post owed; streak reset on success; recovery only after a posted down; silent recovery for an unposted down; first-sighting behavior; legacy-entry migration.

Cooldown + dedupe in the notification engine are untouched.

Out of scope, deliberately: health:fleet-feed (4 sends today) is a different mechanism — a 5-minute feed-staleness window in src/health.ts, not a single-probe flip.

Verification

  • New tests: 12/12 pass. Neighboring suites (alerts, notifications, health, notification-preferences, section-risk, projector, watchdog): 133 pass; the only failures are the known environmental server-boot flakes (5s hook timeouts under load; one test binds the live aggregator's port 4871) — identical on unmodified origin/main paths.
  • tsc --noEmit: no errors in the touched files (25 pre-existing errors in unrelated test files, unchanged).

Refs #9049.


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@developing-today-fleet
developing-today-fleet Bot requested review from a team and dezren39 as code owners November 12, 2026 22:05
@coderabbitai

coderabbitai Bot commented Nov 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab2683bf-ad9f-4387-8b3c-07c3f90ed2ce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants