Skip to content

3.x.x: page when a frontend holds block submission, not only once it holds a found block (#666) - #676

Merged
RobertClarke merged 3 commits into
3.x.xfrom
RobertClarke/prism-666-held-submission-alert
Oct 5, 2026
Merged

RobertClarke merged 3 commits into
3.x.xfrom
RobertClarke/prism-666-held-submission-alert

Conversation

@RobertClarke

@RobertClarke RobertClarke commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Closes #666. Part of #291.

Problem

#661's kill switch, PRISM_BLOCK_SUBMIT_ENABLED=0, holds every block a frontend finds. A production frontend left that way paged only once a found block had been held for a while: PrismBlockCandidateOldestPendingCritical needs an age of 60 s and then a 3-minute dwell, about 4 minutes in all. That may be too late for the block. A held frontend's blocks wait in the shared outbox, where a peer that still submits offers them; when every frontend is held, none is offered.

Change

This adds the paging rule PrismBlockSubmissionHeld.

Field Value
Severity critical, labelled page="true"
Fires when the gauge's last sample in the past 2 minutes is not 1, with at least one successful scrape in that window
Dwell 1 minute
No data / evaluation error OK
(last_over_time(qbit_prism_block_submission_enabled{job="qbit-prism",network="__NETWORK__"}[2m]) != bool 1)
  and on(job, instance, network) (max_over_time(up{job="qbit-prism",network="__NETWORK__"}[2m]) == 1)
  • Pages before a block is lost. It fires a minute after a held frontend starts, before it has found anything. It also pages for -1, a setting not yet published, since nothing then shows the frontend submits.
  • Gated on the scrape, not the snapshot, and over a failed scrape. The gauge is fixed at process start and served from the cached metrics snapshot. So the rule is gated on a successful scrape rather than a fresh snapshot, and a held frontend keeps paging while its snapshot is stale. A failed scrape writes staleness markers, which would drop an instant series and restart the dwell. The rule therefore reads the gauge's last sample in the past 2 minutes and requires one successful scrape in that window.
  • No new noise. A missing endpoint and no data stay with PrismMetricsEndpointDown and PrismMetricsNoData, and an image older than 3.x.x: add a block submission and broadcast kill switch for rehearsals against a real node (#291) #661 exports no series.
  • Placement. The rule sits in docs/prism-native-alert-rules.json, after the block-candidate rules. The generated migration table row and the review-only qbit-tools patch are regenerated from the pinned snapshot.
  • Docs.
    • The rehearsal runbook (docs/prism-ledger-ops.md) says to scrape a rehearsal's frontends under another job or network, or to silence this rule and the pending-candidate rules for the rehearsal. Any such silence must match the rehearsal frontends' instance labels, never the alert name alone.
    • docs/prism-configuration.md and the go-live checks in docs/mainnet-deployment.md name the rule.

Tests

  • Nine promtool scenarios in tests/fixtures/prism-alert-scenarios.json:
    • held for 70 seconds has paged;
    • held for 50 seconds is still pending, which together pin the 1-minute dwell;
    • a failed scrape every 50 seconds does not restart the dwell (the instant expression fails this one);
    • a submitting frontend is quiet;
    • -1 pages;
    • a failed scrape gives no sample;
    • a missing series gives no sample;
    • only the held frontend of a pair pages;
    • a held frontend pages through a stale snapshot.
  • scripts/test_prism_alert_deployment.py now expects 79 rules, includes the rule in the paging set, and checks its 1m dwell, its last_over_time gauge, its != bool 1, its max_over_time(up) gate, and that it is not gated on the snapshot.

Run locally:

  • scripts/test_prism_alert_promql.py, with promtool 3.14.0 from the pinned release: 45 expressions, 188 scenarios, 387 expression and 282 alert assertions passed.
  • scripts/test_prism_alert_deployment.py --snapshot <qbit-tools templates>: patch applies cleanly; 10 Jinja gate combinations; 78 original and 79 proposed rules.
  • scripts/generate_prism_alerts.py --check --snapshot …: generated artifacts are current.
  • cargo test -p qbit-prism-server --test observability: 17 passed.
  • The Python unit suite: 938 tests OK; the Docker-only compose tests are skipped locally and run in CI.

Notes

🤖 Generated with Claude Code

… found block (#666)

#661's kill switch (PRISM_BLOCK_SUBMIT_ENABLED) holds every block a
frontend finds. A production frontend left that way paged only once a
found block was held, through the pending-candidate rules 15 s later,
which may be too late for the block.

PrismBlockSubmissionHeld pages (critical, page=true) a minute after a
frontend reports qbit_prism_block_submission_enabled != 1, whether or
not it has found anything: 0 while the switch holds submission, and -1
for a frontend that has not published its setting. The gauge is fixed at
process start and served from the cached metrics snapshot, so the rule
is gated on a successful scrape (up == 1), not on a fresh snapshot, and
a held frontend keeps paging through a stale one; no data and evaluation
errors are OK, as for the other paging rules, and an image older than
#661 exports no series.

Eight promtool scenarios cover the page, the pending dwell, a submitting
frontend, the unpublished setting, a failed scrape, a missing series,
one held frontend of a pair, and a stale snapshot. The deployment test
now expects 79 rules and checks the rule's dwell, gauge and gate; the
migration table and the review-only qbit-tools patch are regenerated.
The rehearsal runbook says to scrape a rehearsal's frontends under
another job or network or to silence the rule, and the configuration
reference and go-live checks name it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 5, 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-10-05T20:42:00.073026Z 06a0db4 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 chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7efdc3c945

ℹ️ 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".

Comment thread docs/prism-native-alert-rules.json Resolved
…at a held frontend loses (#666)

Review follow-ups:

- The rule reads the gauge's last sample in the past two minutes
  (last_over_time) and requires a successful scrape in that window
  (max_over_time(up) == 1). A failed scrape writes staleness markers, so
  the instant form dropped the series and restarted the one-minute dwell:
  a held frontend whose scrapes failed about once a minute never paged.
  A scenario with a failed scrape every 50 seconds pages under the new
  expression and not under the old.
- Two scenarios bracket the dwell (held for 70 seconds has paged, for 50
  seconds is still pending) instead of evaluating long after it.
- The description no longer says a held frontend's blocks are never
  offered: they wait in the shared outbox, where a peer that still
  submits offers them. The candidate rules page about four minutes after
  a held block (60 s, then a three-minute dwell), not 15 s.
- The runbook scopes a rehearsal silence to the rehearsal frontends'
  instance labels, never the alert name alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RobertClarke

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: 54dfd27fa8

ℹ️ 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".

…ks, not ahead of them (#666)

Codex's review: within its own one-minute dwell the rule cannot promise
to page before a held frontend finds a block, so its description and the
rehearsal runbook say it pages independently of found blocks instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@RobertClarke RobertClarke changed the title 3.x.x: page when a frontend holds block submission, before it holds a found block (#666) 3.x.x: page when a frontend holds block submission, not only once it holds a found block (#666) Oct 5, 2026
@RobertClarke

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 06a0db4a96

ℹ️ 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".

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.

1 participant