Repository navigation
Description
Update 2026-11-26 (infra move): docs/SRE.md is now docs/guidelines/sre.md.
The guideline holds no service table. The services of a cluster are in the catalog of its environment tree (k8s/catalog.toml, in dan-petty/homelab).
Problem or Motivation
The SRE service spec (docs/guidelines/sre.md, #5445) sets the incident triggers that the owner chose on 2026-11-11 (#4714), and an error budget policy. In the 30 days to 2026-11-13, 2 triggers were met with no incident record: SLO 3 used 124 % of its budget, and NodeNotReady fired for 67 hours.
- No job opens an incident record when a trigger fires.
- No job reads the SLO state and the state of the running jobs.
- No job holds other work when the budget of an SLO is spent.
The pipeline split that the owner approved on 2026-11-13 gives each job one purpose, one due predicate and one result line.
Proposed Solution
- The incident job. It is due at the first crossing of a trigger. It reads the alert state from the Alertmanager API, so a silenced alert is not a trigger. It keeps at most one open incident issue for each SLO or alert. It files the issue with the trigger, the SLO and the burn rate, and the first timeline rows from the alerts, the releases and the commits of
k8s/. It does not mitigate. - The supervise job. It is due on a schedule. It reads the SLO state of each service from the Sloth rules of feat(monitoring): define the Service SLOs in a Sloth spec #4709. It also reads the state of each running job: a stall, a passed deadline or a spent budget. It acts only through the existing controls of the Service, such as the mode of a row. It writes a ticket for each other finding.
- The error budget policy. When an SLO has spent its 28-day budget, the supervise job holds each item for that service that is not a fix of the SLO, a P0 item or a security fix. An item is for a service when its scope label or its changed paths name the service in the catalog of the environment tree (
k8s/catalog.toml). - Each new row starts in mode
plan. The owner confirms the error budget policy before modeon.
Acceptance Criteria
- A test with an Alertmanager fixture proves 3 cases: a first crossing opens one incident issue, a trigger that stays true opens no second issue, and a silenced alert opens none.
- A test proves that a spent budget holds an item for its service that is not a fix, and lets a P0 item and a security fix through.
- Live proof in mode
plan: the result lines of both jobs for 7 days, with the incidents that they would open.
Existing Tool Considered
The Alertmanager API v2 (alerts and silences), the Sloth recording rules of #4709 and the rows of the Service. No new tool: the jobs read Prometheus and Alertmanager over HTTP and write issues through the existing GitHub client. Cost: about 1.5 M tokens and 8 hours.
Related
#4709, #4714, #3655, #5443 (the agentic workflow spec).
Source: #5445
Owner decision 2026-11-13
The approved roadmap pipeline split (tracker #5482, Phase 5) uses this item as its incident job, and adds these rules:
-
A red required check on
mainis an incident class too, beside the SLO and alert triggers. -
Reuse
raise_alarm(src/devops_cli/ci/job_time.py, fix(ci): the duration alarm fires at 360 s and files a P0 issue #5247), made general: one marker for each class, one open issue, and a comment when the class repeats. The CI duration alarm keeps its behavior. -
The public text comes from an allowlist of label fields and passes through
mask_secrets. No security-class text goes in a public issue (SECURITY.md). -
No Alertmanager route and no new webhook provider: the job reads the alert state. feat(monitoring): route page alerts to chat and ticket alerts to issues #5471 must not file a second issue for the same alert.
-
A weekly drill sends a test alert and a synthetic red check. Mode
planfirst. -
The supervise job of this item holds work on a spent budget. The extra resources for an incident P0 item (D10) are in feat(roadmap): supervise gives an incident P0 item extra resources #5511.
-
A masking test fails on a label value outside the allowlist or an RFC 1918 address.
-
Live proof: after the merge and the release, a drill alert makes an incident issue as the App in 10 min or less. A comment gives the result lines and the time.
Alternatives check of 2026-11-29: in-use.
The repository already uses this tool.
Tool: slok/sloth (https://github.com/slok/sloth), Apache-2.0, last activity 2026-10-28, maintained.
Reason: Searches found only Sloth, already used for the SLO rules that the job would read; it generates burn-rate alerts but opens no incident issue, honors no silence, holds no work.
Covers:
- SLO spec to Prometheus recording and metadata rules
- Multi window multi burn page and ticket alert rules
- 28 and 30 day SLO windows with validation command
Lacks:
- No read of the Alertmanager API or its silence state
- No incident issue, hidden marker or repeat comment
- No supervise job and no error-budget hold on items
- No allowlisted label text or mask_secrets step
Proposed design
Problem statement
Build the incident job now. The SRE guideline sets incident triggers for SLO burn, spent budget, critical alerts, red required checks and revert commits. No job opens an incident record when a trigger fires. The incident job reads alert and SLO state, files one deduplicated incident issue for each class, keeps public text safe, and starts in mode plan. The supervise job and the error-budget hold are deferred. The post-merge drill is a person gate.
Acceptance criteria
Requirement: Incident trigger settings
The incident job SHALL read each incident trigger threshold from its settings and use the SRE guideline defaults when a setting is absent.
Scenario: Configured trigger 1
- WHEN The incident job settings set trigger 1 to 14.4 and leave the other triggers unset.
- THEN A source test asserts that the job uses 14.4 for trigger 1 and the SRE guideline default for each other trigger.
Requirement: SLO burn incident
The incident job SHALL open one incident issue when an SLO burn alert is at or above its configured trigger for 1 hour or more, with at least 20 events.
Scenario: First SLO burn crossing
- WHEN An Alertmanager fixture holds one active, unsilenced SLO burn alert at or above the trigger for 1 hour or more, with at least 20 events.
- THEN A source test asserts that the job creates one issue with the trigger, the SLO and the burn rate.
Requirement: Spent budget incident
The incident job SHALL open one incident issue when 50 % or more of the budget of an SLO is used in its 28-day window.
Scenario: Half the budget spent
- WHEN The SLO state shows that SLO 3 used 50 % or more of its 28-day budget.
- THEN A source test asserts that the job creates one incident issue for SLO 3.
Requirement: Silenced alert
The incident job MUST NOT open an incident issue for a silenced alert.
Scenario: Silenced SLO burn alert
- WHEN An Alertmanager fixture holds one SLO burn alert that an active silence matches.
- THEN A source test asserts that the job creates no issue.
Requirement: Repeated trigger
The incident job SHALL keep one open incident issue for a trigger and add one comment when the trigger repeats.
Scenario: Trigger stays true
- WHEN The same SLO burn alert stays active for two runs of the incident job.
- THEN A source test asserts that the job has one open issue and one new comment after the second run.
Requirement: Critical alert incident
The incident job SHALL open one incident issue for a firing critical alert or a node that is not Ready for 30 minutes or more.
Scenario: Node not ready fires
- WHEN An Alertmanager fixture holds one active, unsilenced NodeNotReady alert for 30 minutes or more.
- THEN A source test asserts that the job creates one issue for the alert rule and label set.
Requirement: Red required check
The incident job SHALL open one incident issue when a required check on main is red.
Scenario: Required check is red
- WHEN A GitHub fixture reports Tests & Coverage as a failed required check on main.
- THEN A source test asserts that the job creates one issue for the check.
Requirement: Red non-required check
The incident job MUST NOT open an incident issue when a check that is not required on main is red.
Scenario: Non-required check is red
- WHEN A GitHub fixture reports a failed check that the main ruleset does not require.
- THEN A source test asserts that the job creates no issue.
Requirement: Revert commit incident
The incident job SHALL open one incident issue when a revert commit lands on the default branch.
Scenario: Revert commit on main
- WHEN A GitHub fixture reports a revert commit on main.
- THEN A source test asserts that the job creates one incident issue for the commit.
Requirement: Public text masking
The incident job SHALL build the public issue text from allowlisted label fields and pass it through mask_secrets and the private-host mask.
Scenario: Private label value
- WHEN An alert label set holds a key outside the allowlist, an RFC 1918 address and a security-class value.
- THEN A source test asserts that the issue omits the key, does not hold the RFC 1918 address and omits the security-class value.
Requirement: Incident timeline
The incident issue SHALL hold timeline rows from the alerts, the releases and the commits of the environment tree k8s/ path.
Scenario: First incident issue
- WHEN The job opens an incident issue from an Alertmanager fixture.
- THEN A source test asserts that the issue body holds one row for the alert, one for the latest release and one for the latest environment tree k8s/ commit.
Requirement: No mitigation
The incident job MUST NOT mitigate an incident.
Scenario: Incident job opens a record
- WHEN The job opens an incident issue from an Alertmanager fixture.
- THEN A source test asserts that the job makes no revert, pause or GitOps change call.
Requirement: General alarm repeat
The generalized raise_alarm SHALL keep one open issue for each incident class and add a comment when the class repeats.
Scenario: Incident class repeats
- WHEN raise_alarm runs twice for the same incident class marker.
- THEN A source test asserts that the second run adds one comment and creates no second issue.
Requirement: CI duration alarm unchanged
The CI duration alarm MUST keep its body-replacement behavior after raise_alarm is generalized.
Scenario: CI duration alarm repeats
- WHEN raise_alarm runs twice for the CI job-time alarm.
- THEN A source test asserts that the second run replaces the report in the issue body and posts no comment.
Requirement: Incident row starts in plan
The incident job row SHALL start in mode plan.
Scenario: Default mode
- WHEN The incident job row settings hold no mode.
- THEN A source test asserts that the mode defaults to plan and that a run in mode plan writes no issue.
Requirement: Weekly drill workflow
The weekly drill workflow SHALL pass the actionlint and zizmor checks.
Scenario: Drill workflow validation
- WHEN The workflow is checked with
uv run devops ci --check --only actionlint,zizmor. - THEN The command reports no actionlint or zizmor finding.
Requirement: Pending a person after the merge
The incident job SHALL create an incident issue from each weekly drill signal as the App in 10 minutes or less after the release.
Scenario: Drill signals after release
- WHEN A person runs the weekly drill after the merge and release, and the drill sends a test alert and a synthetic red check.
- THEN The App creates one incident issue for each signal in 10 minutes or less, and a comment gives the result lines and the time.
Existing Tool Considered
The alternatives check of 2026-11-29 records in-use for slok/sloth (https://github.com/slok/sloth), Apache-2.0 and maintained. The block in the issue body names what the tool covers and lacks. The incident job adds the missing parts. It reads the Alertmanager API and the SLO state. It compares the required checks of main. It reuses a generalized raise_alarm for one open issue for each class. Cost: about 1.5 M tokens and 8 hours.
Key questions
- Which incident classes open an incident issue?: Five classes open an incident issue. They are SLO burn, spent budget, critical alert or node not Ready, red required check on main, and revert commit on main. A warning alert follows SRE4 and its runbook row. It does not open an incident issue for each firing. (best practice) [sources: docs/guidelines/sre.md, docs/SDLC.md]
- Chosen: SLO burn and spent budget triggers, critical alert or node not Ready, red required check, revert commit. The SRE guideline lists these triggers. The owner decision adds the red required check.
- Rejected: Every firing alert. It creates too many issues for a repeated trigger.
- Rejected: Warnings as incidents. SRE4 makes a warning a ticket, and its runbook row names the issue to open or comment on.
- How does the incident job avoid a second issue for the same trigger?: The job writes a hidden marker for the class and fingerprint. It searches open issues for the marker and updates the open issue. A repeat adds one comment. It reuses a generalized raise_alarm. The CI duration alarm keeps its body-replacement behavior. (best practice) [sources: src/devops_cli/ci/job_time.py, docs/guidelines/sre.md]
- Chosen: One open issue per class marker with a comment on repeat. It gives one record for each class and keeps the history in comments.
- Rejected: One issue per firing. It creates duplicate issues for a trigger that stays true.
- Rejected: One issue per alert fingerprint including the instance. It splits one alert rule across many instances.
- How does the incident job honor Alertmanager silences?: The job reads active, uninhibited, unsilenced alerts from the Alertmanager API. It adds no Alertmanager route and no webhook provider. An alert that an active silence matches is not a trigger. (best practice) [sources: docs/guidelines/sre.md]
- Chosen: Poll the Alertmanager API with the silence filter. It reads the alert state and honors silences.
- Rejected: A webhook for each alert. The owner decision forbids a new Alertmanager route and a new webhook provider.
- Rejected: Read Prometheus ALERTS only. It does not show the Alertmanager silence state.
- Where do the incident trigger settings live?: The triggers live in the incident job settings. The defaults are the SRE guideline values. The environment README records an owner value. The job does not read a document at run time. (best practice) [sources: docs/guidelines/sre.md]
- Chosen: Job settings with SRE guideline defaults. The guideline keeps the triggers as settings of the job that opens the incident.
- Rejected: Constants in the incident job. A change of a trigger would not change the job settings.
- Rejected: Read the README at run time. A document is not a run-time settings source.
- How is public issue text kept safe?: The job builds the issue body from allowlisted label fields. It passes the text through mask_secrets and the private-host mask. It omits security-class text. A value outside the allowlist, an RFC 1918 address or a security-class value fails the masking test. (best practice) [sources: SECURITY.md, src/devops_cli/security/sanitizer.py]
- Chosen: Allowlist plus mask_secrets and the private-host mask. It follows the owner decision and SECURITY.md. mask_secrets alone leaves a private address.
- Rejected: Raw label values in the issue. It can publish a private address or a secret.
- Rejected: Mask only. It still publishes a field that the allowlist does not name.
- How does the job detect a red required check on main?: The job reads the check runs on main. It compares them with the required checks of the main ruleset. Only a red required check opens an issue. (best practice) [sources: CONTRIBUTING.md, docs/SDLC.md]
- Chosen: Required checks only. ADR 0043 and the main ruleset make the required checks the merge gate.
- Rejected: Any red check on main. It reports checks that the merge gate does not require.
- Can the incident job and the supervise job ship in one pull request?: No. The incident job and the supervise job have different due predicates and result lines. This item delivers the incident job. The supervise job and the error-budget hold go to new issues. (best practice) [sources: docs/guidelines/agentic-jobs.md, docs/guidelines/sre.md]
- Chosen: Separate pull requests. Each job keeps one purpose, one due predicate and one result line.
- Rejected: One pull request for both jobs. It mixes two jobs and the error-budget hold in one delivery.
- What does the owner decision of 2026-11-13 require for this item?: The item is the incident job. It adds a red required check class. It generalizes raise_alarm. It uses an allowlist and masks. It adds no Alertmanager route. It adds a weekly drill in mode plan. The supervise job and the error-budget hold are deferred to new issues. (best practice) [sources: docs/guidelines/sre.md, src/devops_cli/ci/job_time.py, SECURITY.md]
- Chosen: Owner decision of 2026-11-13. The owner recorded this decision in the issue body.
- Rejected: Build both jobs in this item. The owner decision uses this item as the incident job and gives the supervise job a separate result.
- Rejected: Build no incident job. The owner decision names this item as the incident job.
- How does the incident job start and how is the drill gated?: The incident job row starts in mode plan. A run in mode plan writes no issue. The weekly drill sends a test alert and a synthetic red check in mode plan. After the merge and release, a person runs the drill. The person records the result lines and the time. (best practice) [sources: docs/guidelines/agentic-jobs.md, docs/guidelines/sre.md]
- Chosen: Mode plan first, then a person drill after release. The owner decision requires mode plan first and a live drill after the merge and release.
- Rejected: Mode on at once. It writes issues before the owner sees the result lines.
- Rejected: No drill. The owner decision requires a weekly drill.
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 13, 2026
Both items work on SLOs; #4709 defines the Sloth rules, while the candidate adds jobs that read those rules and act on triggers and budget.dan-petty commentedon Nov 13, 2026
Design decision (agent, 2026-11-13, standard practice; the owner can change it). This answers the open question from #5471: which
warningalerts become issues once chat carries onlycritical.criticalalert, or a red main. This is the SRE practice of paging on symptoms and sending slow problems to tickets.warningalert does not get an issue for each firing. The incident job keeps one issue for each alert rule and label set (the alert fingerprint without the instance). It opens the issue when the alert fires for 4 hours or more, or fires 3 times or more in 24 hours. Each new firing adds a comment, with no new issue. The issue closes when the alert stays resolved for 24 hours.Acceptance (add to this issue):
dan-petty commentedon Nov 13, 2026
Owner approved the warning rule above on 2026-11-13 ("proceed as recommended"). It is now an owner decision for this issue.
dan-petty commentedon Nov 13, 2026
Scope from the spec split (2026-11-13)
Read the incident triggers as settings of the incident job, not as constants. The defaults of the settings are the default triggers of the SRE guideline (
docs/guidelines/sre.mdafter #5538). The configured value of trigger 1 is the owner value 14.4x. Until this item merges,k8s/README.md"Service levels" holds the owner value.The project review (#4714) reads the same settings. Then the triggers live in one place, and a change of a trigger changes the incident job and the review together.
devops-cli-service commentedon Nov 17, 2026
Alternatives check: in-use
Reason: The searches returned no tool that opens an incident issue from a firing or silenced-aware Alertmanager alert and holds roadmap items on a spent error budget. Sloth (already the source of the SLO rules that this issue plans to read, #4709) covers the SLO and burn-rate side of both jobs, but it only generates Prometheus rules: it does not file or dedupe incidents, read alert state, supervise jobs, or hold work.
The repository already uses this tool.
Tool: slok/sloth (https://github.com/slok/sloth)
Covers:
Lacks:
Tools considered:
Searches run:
Sources:
Checked on 2026-11-17. A person decides what this means for the item. The check changes no label and closes no issue.
devops-cli-service commentedon Nov 18, 2026
Refine cannot set this item to Ready at 1130cd4 while the items below stay open. The next refine round looks at the item again when they close, or when a person replies in a comment or edits the body.
devops-cli-service commentedon Nov 27, 2026
Next step: the open items close, or a person replies in a comment or edits the body. See Dependencies in the section Proposed design of the body.
devops-cli-service commentedon Nov 29, 2026
Next step: the stage job writes the plan of the item. See Moved to new items in the section Proposed design of the body.
test(roadmap): cover incident edge branches and runner dispatch (#5477)
chore(main): release 0.258.0 (#7846)
devops-cli-service commentedon Nov 29, 2026
Released in v0.258.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.258.0
devops-cli-service commentedon Nov 30, 2026
Live since 2026-11-30 00:51 UTC