Phase 1, PR 3: reboots (#4), fencing and partitions, maintenance, known conditions, and the T2 to T4 replays #7

Merged
jared merged 1 commits from reboots into main 2026-11-25 23:21:41 -05:00
Owner

Third phase 1 PR from the plan on #1. It covers thor#4 plus the rest of the Area 7 test cases, still all in shadow.

Replays (recorded read-only from the real Prometheus and Loki)

Case Thor's outcome
T1 11-23 OOM unchanged: one P1 ticket, cleared 06:18
T2 11-25 planned maintenance 0 tickets. Gandalf's "switch update" suppression (03:11:39 to 03:41:39) becomes a maintenance incident that never tickets. Every reboot goes on its timeline: compute-storage-01 and -02 as planned (logind power-off at 03:21:35), the rest as power loss. Thor is modelled as dark with the rack (03:16:30 to 03:39) and catches up on the whole gap when it's back.
T3 10-27 1 ticket, P2, at 15:58: "compute-storage-01 lost its cluster link and was fenced". MON_DOWN, OSD_HOST_DOWN, OSD_DOWN, PG_* and its scrape failures are "Also seen". The host stayed down until 19:20, so the incident stays active while it's down and clears after. PBS also stopped answering 15:54 to 19:47, which hints at a network cause, but nothing in Gandalf's records says so.
T4 11-04 1 ticket, P1, at 20:54: cluster partition. storage-01, which fenced itself at 20:54 and showed up on its own a few minutes later, folds in, along with all reboots and the scrape and pvestatd timeouts on every host. Cleared 22:28.
DIMM 11-21 0 tickets, 1 note on 693930698: "Seen again: Unexpected reboot of compute-storage-02", via the known condition.

T3 and T4 have no Gandalf suppression on record (checked over 31 days), so they're unplanned. If Gandalf had network evidence at the time, its ticket would have owned them; that's gandalf#66's pre-check, which is still to come.

New checks

  • Reboots (checks/reboots.py, thor#4): a node_boot_time_seconds change is classified as planned (logind shutdown line: note only, since Gandalf tickets one that doesn't come back), unexpected (P3), or unknown (the journal stopped reaching Loki before the host went down; P4, says so in the text). Several unexplained reboots within 15 min become one P2 "N hosts rebooted at once", with power and corosync checks listed.
  • Fencing and partitions (checks/cluster.py): HA manager node 'X' ... => 'fence', watchdog self-fences, corosync non-primary component and link-down. One host is P2, two or more is a P1 partition (thor#1: Thor owns these unless Gandalf has network evidence).
  • Maintenance (checks/maintenance.py): Gandalf suppressions (all or host, ended ones included, gandalf#68). If Gandalf can't answer, Thor fails open and things may get tickets.

Engine rules added

  • Causes are processed highest first; a lower cause they explain becomes their symptom.
  • A higher cause found later (fence lines can arrive after the reboot) folds in a still-pending lower incident. One that already opened gets a "Root cause found" comment, and you close it (thor#1 contract).
  • A host-scoped cause, like tonight's kernel update maintenance on compute-storage-01, never explains another host's cause. It still explains other hosts' plain symptoms.
  • An incident stays active while an attached symptom continues (a host still down).
  • Bug fixed (found by the DIMM replay): an incident that changed state silently (timeline-only or known condition) wasn't saved.
  • Planned reboots (notes) join timeline-only incidents, so the maintenance timeline is complete.

Known conditions (migration 3, seeded)

known_conditions (kind, subject, ticket, reason, who, when, ended). Seeded with the entries named in thor#1:

  • compute-storage-02 reboots, tracked by 693930698
  • Ceph noout, tracked by 693930698 (used when Ceph moves over in phase 2)
  • the old UPS battery (no ticket)

A match sends a note to that ticket instead of opening one. Managing these through the UI and MCP comes in PRs 4 and 5. Ending one automatically when its ticket closes needs the Tinker key.

Verification

  • 111 unit tests plus 6 MariaDB tests; coverage is 98% with the DB.
  • flake8, bandit and shellcheck are clean. No em or en dashes.
  • Fixtures total 2.8 MB (journal lines used only for "when did it last log" keep timestamps only).
  • PR #6 in production: migration 2 applied, every cycle ok, no incidents on a quiet night, no tracebacks.

🤖 Generated with Claude Code

Third phase 1 PR from the plan on #1. It covers thor#4 plus the rest of the Area 7 test cases, still all in shadow. ## Replays (recorded read-only from the real Prometheus and Loki) | Case | Thor's outcome | |---|---| | **T1** 11-23 OOM | unchanged: one P1 ticket, cleared 06:18 | | **T2** 11-25 planned maintenance | **0 tickets.** Gandalf's "switch update" suppression (03:11:39 to 03:41:39) becomes a maintenance incident that never tickets. Every reboot goes on its timeline: compute-storage-01 and -02 as planned (logind power-off at 03:21:35), the rest as power loss. Thor is modelled as dark with the rack (03:16:30 to 03:39) and catches up on the whole gap when it's back. | | **T3** 10-27 | **1 ticket, P2**, at 15:58: "compute-storage-01 lost its cluster link and was fenced". `MON_DOWN`, `OSD_HOST_DOWN`, `OSD_DOWN`, `PG_*` and its scrape failures are "Also seen". The host stayed down until 19:20, so the incident stays active while it's down and clears after. PBS also stopped answering 15:54 to 19:47, which hints at a network cause, but nothing in Gandalf's records says so. | | **T4** 11-04 | **1 ticket, P1**, at 20:54: cluster partition. storage-01, which fenced itself at 20:54 and showed up on its own a few minutes later, folds in, along with all reboots and the scrape and pvestatd timeouts on every host. Cleared 22:28. | | **DIMM** 11-21 | **0 tickets, 1 note on 693930698**: "Seen again: Unexpected reboot of compute-storage-02", via the known condition. | T3 and T4 have no Gandalf suppression on record (checked over 31 days), so they're unplanned. If Gandalf had network evidence at the time, its ticket would have owned them; that's gandalf#66's pre-check, which is still to come. ## New checks - **Reboots** (`checks/reboots.py`, thor#4): a `node_boot_time_seconds` change is classified as planned (logind shutdown line: note only, since Gandalf tickets one that doesn't come back), unexpected (P3), or unknown (the journal stopped reaching Loki before the host went down; P4, says so in the text). Several unexplained reboots within 15 min become one P2 "N hosts rebooted at once", with power and corosync checks listed. - **Fencing and partitions** (`checks/cluster.py`): HA manager `node 'X' ... => 'fence'`, watchdog self-fences, corosync non-primary component and link-down. One host is P2, two or more is a P1 partition (thor#1: Thor owns these unless Gandalf has network evidence). - **Maintenance** (`checks/maintenance.py`): Gandalf suppressions (`all` or `host`, ended ones included, gandalf#68). If Gandalf can't answer, Thor fails open and things may get tickets. ## Engine rules added - Causes are processed highest first; a lower cause they explain becomes their symptom. - **A higher cause found later** (fence lines can arrive after the reboot) folds in a still-pending lower incident. One that already opened gets a "Root cause found" comment, and you close it (thor#1 contract). - A host-scoped cause, like tonight's `kernel update` maintenance on compute-storage-01, never explains *another* host's cause. It still explains other hosts' plain symptoms. - An incident stays active while an attached symptom continues (a host still down). - **Bug fixed** (found by the DIMM replay): an incident that changed state silently (timeline-only or known condition) wasn't saved. - Planned reboots (notes) join timeline-only incidents, so the maintenance timeline is complete. ## Known conditions (migration 3, seeded) `known_conditions` (kind, subject, ticket, reason, who, when, ended). Seeded with the entries named in thor#1: - compute-storage-02 reboots, tracked by 693930698 - Ceph `noout`, tracked by 693930698 (used when Ceph moves over in phase 2) - the old UPS battery (no ticket) A match sends a note to that ticket instead of opening one. Managing these through the UI and MCP comes in PRs 4 and 5. Ending one automatically when its ticket closes needs the Tinker key. ## Verification - 111 unit tests plus 6 MariaDB tests; coverage is 98% with the DB. - flake8, bandit and shellcheck are clean. No em or en dashes. - Fixtures total 2.8 MB (journal lines used only for "when did it last log" keep timestamps only). - PR #6 in production: migration 2 applied, every cycle ok, no incidents on a quiet night, no tracebacks. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-25 23:14:20 -05:00
Reboots, fencing and partitions, maintenance from Gandalf, known conditions; T2/T3/T4/DIMM replays
CI / Lint (flake8, house style) (pull_request) Successful in 54s
CI / Test (pytest) (pull_request) Successful in 55s
CI / Security (bandit, pip-audit) (pull_request) Successful in 56s
CI / Integration (MariaDB) (pull_request) Successful in 2m2s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m30s
CI / Deploy (pull_request) Skipped
e70dee0ad8
- checks/reboots.py (thor#4): boot-time changes classified as planned (logind line),
  unexpected, or unknown (journal went quiet first); several together are one event.
- checks/cluster.py: HA fence lines, watchdog self-fences, corosync quorum loss: one host is
  'lost its cluster link and was fenced' (P2), two or more a cluster partition (P1).
- checks/maintenance.py: Gandalf suppressions (with ended ones) as a cause that never
  opens a ticket; everything under it goes on the timeline.
- Engine: higher causes first, lower causes they explain become symptoms; a higher cause
  found later absorbs pending ones and comments 'Root cause' on opened ones; host-scoped
  causes never explain another host's cause; incidents stay active while an attached host
  is still down; silent state changes are saved; notes join timeline-only incidents.
- Known conditions (migration 3, seeded): compute-storage-02 reboots and Ceph noout ->
  693930698, the old UPS battery. A match sends a note to that ticket instead of a new one.
- Replays: T2 0 tickets; T3 one P2 (fenced, cleared when the host is back); T4 one P1
  partition (storage-01's later fence and all reboots fold in); DIMM one note on 693930698.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jared merged commit 6c2328c2b1 into main 2026-11-25 23:21:41 -05:00
Author
Owner

Merged and deployed through CI (run 4024; every job green, including deploy and its "production runs this commit" check).

Deploy verified on CT 173:

  • Prod HEAD: 6c2328c2b17fb833429ce810ef2ffecc005be557; /health returns 200 with that sha.
  • thor and thor-monitor are active. The deploy log shows deployed 6c2328c...: healthy, 3 s after starting.
  • On start: Applied schema migration 3; the monitor runs 7 checks (maintenance, cluster, reboots, memory, scrapes, pvestatd, Ceph alerts) and resumed from the stored window (110 s).
  • known_conditions seeded: compute-storage-02 reboots and Ceph noout (both tracked by 693930698), and the UPS battery (no ticket).
  • Every cycle so far is ok; no tracebacks.
Merged and deployed through CI (run 4024; every job green, including deploy and its "production runs this commit" check). **Deploy verified on CT 173:** - Prod HEAD: `6c2328c2b17fb833429ce810ef2ffecc005be557`; `/health` returns 200 with that sha. - `thor` and `thor-monitor` are active. The deploy log shows `deployed 6c2328c...: healthy`, 3 s after starting. - On start: `Applied schema migration 3`; the monitor runs **7 checks** (maintenance, cluster, reboots, memory, scrapes, pvestatd, Ceph alerts) and resumed from the stored window (110 s). - `known_conditions` seeded: compute-storage-02 reboots and Ceph `noout` (both tracked by 693930698), and the UPS battery (no ticket). - Every cycle so far is ok; no tracebacks.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/thor#7