Repository navigation
Conversation
added 7 commits
November 9, 2026 01:39
Restore incidents acked earlier on the same ET date from risk_events before the first evaluation; record close and ack_void lifecycle rows (retried); per-process incident id prefix.
…a review) Replace folding of notification rows (write order != lifecycle order, unapplied acks, lost close rows) with a full acked-state snapshot written by one serialized writer on every change; validate every restored field; keep the latest worsening reference; uuid incident-id nonce.
…refs only (Astra review 2) Write the acked set at once on ack and directly at shutdown (no write cap); proc nonce + seq so a late write never wins; restore waits for a resolved scope and a scope change clears acks; persist a worsening reference only after its alert reached a channel; no restore cooldown; require complete, float-safe references.
…nding worsening refs; restore flag after the read (Astra review 3)
… (Astra review 4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tail-risk guard P2.0: an acked incident no longer re-pages after a guard restart (deploy, api recreate). Before, every deploy re-paged the acked FAST incident every 30 s until someone acked it again (seen twice on 2026-11-09).
ack_staterows inxenon.risk_events. No schema change.flush_statewrites the final set first (0.6 s, outside the 4-write cap).changed), and the writer never publishes an account before its restore.GET /risk/statehidesack_staterows.Also includes the P2 plan,
docs/superpowers/plans/2026-11-09-tail-risk-guard-p2a.md(v4): IB and Futu atomic closes, delivered as P2.1–P2.5. That plan is not implemented here.Limits (runbook)
Review
Test plan
uv run pytest -p no:xdist src/xenon/api/tests/test_risk_guard_*.py scripts/tests/test_risk_guard_queries.py src/xenon/api/tests/test_read_only_mode.py src/xenon/api/tests/test_health_observability.py scripts/tests/test_runtime_settings.py→ 356 passed (local scratch DB)ruff check --select F src scripts, ruff formatThe guard places, cancels and modifies no order (
test_risk_guard_no_order_path.py).🤖 Generated with Claude Code