Skip to content

feat(backup): escalate after multiple missed backup nights - #823

Merged
EtanHey merged 2 commits into
mainfrom
wt/laneb-multinight-alert
Sep 9, 2026
Merged

feat(backup): escalate after multiple missed backup nights#823
EtanHey merged 2 commits into
mainfrom
wt/laneb-multinight-alert

Conversation

@EtanHey

@EtanHey EtanHey commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • extend PR fix(backup): detect missing daily attempts #820's single shared backup-attempt detector instead of adding a second parser
  • retain its existing stale state and add a distinct critical multi-night issue
  • expose complete 24-hour windows without a receipt in health output
  • make the threshold configurable, defaulting and clamping to two nights

Corrected incident boundary

This watches absence of a durable attempt receipt. It does not misclassify the 22 July bundles that uploaded and verified successfully before retention later removed both local staging and the Drive objects. Only 2026-06-14 was a genuine no-bundle day.

Verification

  • RED-first: detector rejected the new threshold argument
  • 52 health tests passed
  • canonical changed-only gate passed: 75 owned unit tests, 3 registration tests, 40 isolated routing tests, Bun, and FTS shell regression
  • Ruff clean and format clean
  • Claude pair review — ACCEPT

Size: S

Stacked on draft PR #820. Do not merge before its base.

— brainlayerCodex-4c4386f6 (worker) · codex/gpt-5.6-sol

Note

Add critical escalation for multiple missed backup nights in inspect_jsonl_backup_health

  • Adds a configurable multi-night absence threshold (default 2) via BRAINLAYER_JSONL_BACKUP_ABSENCE_ALERT_NIGHTS, clamped to a minimum of 2 nights
  • inspect_jsonl_backup_health now counts complete 24-hour windows since the latest valid receipt and returns a critical jsonl_backup_attempt_absent_multiple_nights issue when the count reaches the threshold; this check runs before the existing stale check
  • Adds consecutive_nights_without_attempt to JsonlBackupHealth and threads the configured threshold through run_health_check
  • Behavioral Change: receipts older than the multi-night threshold now produce the new critical issue instead of the ordinary jsonl_backup_attempt_stale classification; existing stale tests set the threshold to 3 to preserve their intent

Macroscope summarized f66b88a.


Note

Medium Risk
Changes backup alerting semantics for aged receipts (new critical issue code and ordering before the stale check), which can affect on-call routing though it does not alter backup execution itself.

Overview
Adds multi-night escalation for JSONL backup health when the latest durable attempt receipt is old enough to span two or more full 24-hour windows (default threshold 2 nights, overridable via BRAINLAYER_JSONL_BACKUP_ABSENCE_ALERT_NIGHTS, clamped to at least 2).

inspect_jsonl_backup_health now exposes consecutive_nights_without_attempt on JsonlBackupHealth and, before the existing 36-hour stale rule, raises a separate critical issue jsonl_backup_attempt_absent_multiple_nights. Operations docs describe the new check and env knob, and stress that this targets missing attempt receipts, not bundles removed later by retention.

Tests cover escalation, config clamping, and keep the prior stale-path test by raising the absence threshold to 3 nights.

Reviewed by Cursor Bugbot for commit f66b88a. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: brainlayerCodex-4c4386f6 running gpt-5.6-sol <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 361a14a0-d1ef-4003-a018-a95a0de89a93

📥 Commits

Reviewing files that changed from the base of the PR and between 0443e60 and f66b88a.

📒 Files selected for processing (3)
  • docs/operations/brainlayer-health-check.md
  • src/brainlayer/health_check.py
  • tests/test_stability_health_check.py

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

Comment @coderabbitai help to get the list of available commands.

@EtanHey EtanHey added the size:S Tight-loop PR size: 51-150 hand-written lines changed label Sep 9, 2026
@EtanHey

EtanHey commented Sep 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please focus on the boundary between Phase 1's single stale-attempt issue and the configurable multi-night absence escalation, especially that uploaded bundles later pruned by retention are not classified as absent attempts.

— brainlayerCodex-4c4386f6 (worker) · codex/gpt-5.6-sol

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-09T18:16:57.640621Z 462769e Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 462769ebbc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@EtanHey
EtanHey changed the base branch from wt/p818-root-cause to main September 9, 2026 18:37
@EtanHey
EtanHey marked this pull request as ready for review September 9, 2026 18:38
@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_a4be29f4-d94f-4c8e-bee6-b6c14968e0b1)

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

BrainLayer ratchet

Every Value below was measured by this run. A row this machine cannot measure says n/a — <reason> instead of a number; baselines in Notes name their own machine, method and date and were not measured here.

Row Status Value (measured by this run) Method Notes
commit provenance 🟢 GREEN measured f66b88a4c4f5 == PR head · checkout d3b70219df9b commit graph + live PR head · in-process · runner Which commit this whole table is about. On a pull_request event the checkout is GitHub's synthetic merge ref, whose sha is not on the PR — #759's table printed 13fa724278bf while that PR's head was 4632f979 — so this row names the PR-head parent instead, the sha a reviewer can actually see. The comparison sha is read live from repos/{owner}/{repo}/pulls/{n} when the table is collected, not taken from the event payload, because the payload cannot know the run has been overtaken. Residual window, stated rather than papered over: a push landing between that read and the comment being posted is not caught here — the run for that push refreshes the table.
baseline attestation 🟢 GREEN baseline f421d1a7c5e6 matches the main attestation (run 34389821246 · main 0443e603fb69 · 2026-09-09T18:34:34Z) main attestation artifact via Actions API · in-process · runner What every comparison is measured AGAINST, and who says so. The baseline fields of tests/fixtures/sprint_gate/corpus.json (queries, latency_baseline_ms, thresholds) are compared to the ratchet-attestation artifact of the latest successful push or (no-input) workflow_dispatch run of ratchet-attest.yml on main, fetched through the Actions API — a PR run cannot write to another run's artifacts. A field that differs is RED unless that main run measured the new value. The calibrated socket collector can license p50/p95; every absent measured path stays locked, so missing collection never passes as permission for a hand edit. Boundary: the comparator is this PR's checkout of ci_ratchet_table.py, diff-reviewable, not tamper-proof.
provenance 🟢 GREEN stamped d3b70219df9b == HEAD, tree clean wheel stamp · in-process · runner Sha half of #749 keg-mode provenance: a keg built from this wheel can answer __build_sha__. The helper-age and served-process predicates need a running BrainBar and are measured only by scripts/sprint_gate.py on an installed Mac. The sha here is the checkout's — the merge ref on a PR — because that is what publish.yml stamps at release time; the PR-head sha this table describes is the one in commit provenance above.
fallback replay debt ⚪ n/a n/a — no fallback queue on this machine: the pending memories live in ~/Gits/*/docs.local/decisions, and docs.local/ is gitignored, so a runner checkout has no copy of them to count docs.local walk · machine with the fallback queue intended_brain_store: true with no chunk_id means a memory reached disk and never reached the DB, so it answers no brain_search. Budget: 0. Any pending or unparseable file is a finding, never a band -- 122 of these sat from 2026-06-28 to 2026-09-05 because nothing counted them where a reader would look. Measured by walking the tree, so it is only ever measured on a machine that HAS the tree.
mapped bytes ⚪ n/a n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would socket · installed Mac Baseline 26.2 GB — installed Mac, socket, 2026-09-03, after R2 drained 15,070 → 0. Up from 16.8 GB because the drain left more vectors mapped under the same cap: the change is the drain, not a leak. Not measured by this run.
search p50/p95 ⚪ n/a n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would socket · installed Mac Margin p50: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin p95: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Calibrated on MacBook-Pro.local at 2026-09-01T08:42:22Z under active_sprint_load (tests/fixtures/sprint_gate/corpus.json). Not measured by this run.
idle CPU ⚪ n/a n/a — no BrainBar daemon at /tmp/brainbar.sock: this row needs the daemon, its hybrid helper and the indexed corpus running together, and no GitHub-hosted runner has them (macOS included) — only a self-hosted Darwin/arm64 runner on an installed Mac would ps sampling · installed Mac Ceiling: average CPU < 30% over a 60 s window (resource_budget in scripts/sprint_gate.py), ratified and kept as a hard budget. Margin daemon: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin helper: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Margin watcher: margin unmeasured — 0 of the 5 attested green main runs it needs; no verdict is rendered from fewer. Needs the BrainBar daemon, helper and watcher actually running. Not measured by this run.
signature_valid ⚪ n/a n/a — the macOS signature-parity job is trigger-gated and did not run on this PR: it touches no release or signing path (pyproject.toml, scripts/release-*, scripts/brainlayer-version-check.sh, publish.yml, ratchet.yml) and carries no ratchet:signatures label — a GitHub macOS runner bills at ~10× Linux minutes and rebuilds the keg venv from source codesign · installed keg scripts/release-verify-signatures.sh <keg> codesign-verifies every *.so/*.dylib under libexec/venv. The macOS parity job installs the published tap formula (etanhey/layers/brainlayer), so this row measures the release path — formula, published sdist and Homebrew's relocation — and not this PR's tree. Release-time baseline for the same keg on a different machine: 442 valid / 0 invalid — installed Mac (M4 Max), brew --prefix brainlayer 1.5.11, 2026-09-03.

🟢 GREEN measured, within budget · 🔴 RED measured, out of budget — a finding to clear before merge · ⚪ n/a not measurable on this machine, never guessed.

No RED rows.

Measured on Linux/x86_64 · measured f66b88a4c4f5 · PR head f66b88a4c4f5 · checkout d3b70219df9b · run · updated 2026-09-09 18:39:00 UTC

@EtanHey
EtanHey merged commit b4cfe1c into main Sep 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S Tight-loop PR size: 51-150 hand-written lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant