Skip to content

sre: exclude probe routes from 5xx gate, surface SRE report, stop asking questions in CI - #474

Merged
Szer merged 2 commits into
mainfrom
sre-agent-noninteractive-report
Sep 8, 2026
Merged

Szer merged 2 commits into
mainfrom
sre-agent-noninteractive-report

Conversation

@Szer

@Szer Szer commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • scripts/verify-deploy.sh: exclude /ready//healthz from the 5xx gate PromQL selector; readiness 503s during a DB blip are expected and already covered by Phase 2. FAILED log line and the FAILED summary bullet now print the raw value plus "(probe routes excluded)".
  • .github/workflows/_sre-agent.yml: the codex step now writes output-file: /tmp/codex-output/sre-report.md (id: run-agent); a new if: always() step uploads /tmp/codex-output/ as artifact sre-report-${{ inputs.bot }} (14-day retention, ignore-if-missing), mirroring monitor.yml; a new if: always() step appends the report (or a fallback line if the agent step failed/was cancelled) to $GITHUB_STEP_SUMMARY under ## SRE agent report — ${{ inputs.bot }}. Both new steps run before the existing "Re-enable ArgoCD auto-sync" safety net, which (with "Disconnect VPN") stays last.
  • .github/prompts/sre.md: added a "Non-interactive run" rule (never end on a question/offer/menu in unattended CI — execute via Path A or file an issue via Path B, final message is the finished Step-7-style report); corrected the Step 1 claim that the 5xx rate is "structurally always zero" (it isn't — /ready 503s by design on DB-ping failure, and with 2 replicas + no per-pod scrape label, rate()/increase() on any counter for that job can report a constant phantom rate off frozen counters; 2026-09-08 worked example + changes()/resets() diagnostic included); added a Step 4 rule that a metric-threshold failure's root cause must cite the metric's actual value/series/since-when, not just "transient race".

Context

Incident 2026-09-08: verify-deploy.sh failed a coupon-bot deploy on 5xx_rate=0.63. Root cause (proven from Prometheus): shared Postgres restart caused ~2 min of expected /ready 503s on both coupon-bot and vahter-bot; those counters froze but 2-replica/no-per-pod-label scrape collision made rate() report a constant phantom non-zero rate for 9 hours afterward. The deploy itself was fine (no rollback needed). Separately, the SRE agent's last run ended by asking the user a question in a fully non-interactive CI run, which must never happen again. The per-pod-label scrape fix itself is being done in the infra repo, not here.

Test plan

  • bash -n scripts/verify-deploy.sh — syntax OK
  • shellcheck scripts/verify-deploy.sh — 0 findings
  • python3 -c 'import yaml; yaml.safe_load(open(".github/workflows/_sre-agent.yml"))' — OK
  • actionlint .github/workflows/_sre-agent.yml — 0 findings
  • .githooks/pre-commit comment-ratio gate — passed (Shell +1/+0, ratio 1.00 but under floor 5; YAML +2/+19, ratio 0.10 under limit 0.30)
  • CI (watching after open)

🤖 Generated with Claude Code

https://claude.ai/code/session_01DzfsFzcMzXbJNiLthAfUQg

Szer and others added 2 commits September 8, 2026 10:27
…ing questions in CI

verify-deploy.sh's 5xx gate was tripping on expected /ready 503s during DB
blips (2026-09-08 coupon-bot false-fail); exclude http_route!~"/ready|/healthz"
and print the raw value with a note. _sre-agent.yml now captures the codex
report to a file, uploads it as an artifact, and posts it to the job summary,
so it's visible without opening raw logs. sre.md gets a non-interactive-run
rule (never end on a question in unattended CI), corrects the Step 1 claim
that the 5xx rate is "structurally always zero" (it isn't — readiness 503s +
the 2-replica/no-per-pod-label scrape collision produce phantom non-zero
rates, per the 2026-09-08 incident), and requires Step 4 root-cause reports
to cite the metric's actual value/series/since-when instead of "transient race".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzfsFzcMzXbJNiLthAfUQg
Failure-class note, Step 2 Loki-marker note, and Reference/Key-Metrics
closing note all still said 5xx is structurally always 0; point each at
the Step 1 raw-counter/phantom-rate explanation instead.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DzfsFzcMzXbJNiLthAfUQg
@Szer
Szer merged commit afb032a into main Sep 8, 2026
8 checks passed
@Szer
Szer deleted the sre-agent-noninteractive-report branch September 8, 2026 09:37
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