Public: anyone can read this; the crew can change it.

The sentinel files a degraded incident once: closed as done, the same incident is commented on, not filed again #2554

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

A degraded incident whose issue was closed as done now gets one comment a day instead of a new issue. The sentinel and TUI-sentinel test files pass (35 tests). The full suite was still running when I pushed, so I didn't see its result. The type check was too slow to finish in the sandbox, so I never saw its verdict.

shipped production is serving it deploy 4915f35

opened this

A degraded incident whose issue was closed as done now gets one comment a day instead of a new issue. The sentinel and TUI-sentinel test files pass (35 tests). The full suite was still running when I pushed, so I didn't see its result. The type check was too slow to finish in the sandbox, so I never saw its verdict.

What changed

  • Incident memory: degradedCauses and the budget-breach findings now carry an incident, the raw first-open time of the cause. It is not the 24-hour-window-clamped "first open" line, so an incident that outlives the window keeps one identity. Migration 20261018100000-incident-remembered adds incident and commented_at to sentinel_finding. hunt stores the incident when it files.
  • Same incident, closed as done: continuesDone in src/crew/sentinel.ts finds the latest closed issue for that cause and incident. If its close reason is done, it adds one comment: "Still degraded after the fix; the fix may not be live yet", the new minutes, and the current evidence. It does not file a new issue.
  • At most one comment per day: that comes from commented_at. A comment that fails is not followed by a refile, and the next hunt tries again.
  • Unchanged: a different first-open time files a new issue. An issue closed as dropped (or any non-done reason) is refiled as before. Settings findings and settingKept are untouched.
  • Tests: test/sentinel.test.ts has three new tests.

- An incident closed as done that continues is commented once per day and never refiled. - A new incident of the same cause is refiled. - A finding closed as dropped that returns is refiled.

Left out

  • Rows filed before the migration have no incident. A degraded incident that is already open and closed as done will therefore be refiled once more, and the new row is tracked from then on. I did not backfill from the evidence text.

Try it Run bun test test/sentinel.test.ts.

🤖 Generated with Claude Code

Closes #2553

commented

A degraded incident whose issue was closed as done now gets one comment a day instead of a new issue. The sentinel and TUI-sentinel test files pass (35 tests). The full suite was still running when I pushed, so I didn't see its result. The type check was too slow to finish in the sandbox, so I never saw its verdict.

What changed

  • Incident memory: degradedCauses and the budget-breach findings now carry an incident, the raw first-open time of the cause. It is not the 24-hour-window-clamped "first open" line, so an incident that outlives the window keeps one identity. Migration 20261018100000-incident-remembered adds incident and commented_at to sentinel_finding. hunt stores the incident when it files.
  • Same incident, closed as done: continuesDone in src/crew/sentinel.ts finds the latest closed issue for that cause and incident. If its close reason is done, it adds one comment: "Still degraded after the fix; the fix may not be live yet", the new minutes, and the current evidence. It does not file a new issue.
  • At most one comment per day: that comes from commented_at. A comment that fails is not followed by a refile, and the next hunt tries again.
  • Unchanged: a different first-open time files a new issue. An issue closed as dropped (or any non-done reason) is refiled as before. Settings findings and settingKept are untouched.
  • Tests: test/sentinel.test.ts has three new tests.

- An incident closed as done that continues is commented once per day and never refiled. - A new incident of the same cause is refiled. - A finding closed as dropped that returns is refiled.

Left out

  • Rows filed before the migration have no incident. A degraded incident that is already open and closed as done will therefore be refiled once more, and the new row is tracked from then on. I did not backfill from the evidence text.

Try it Run bun test test/sentinel.test.ts.

🤖 Generated with Claude Code

Changes requested — before the latest push

The degraded-incident path does what the issue asks and its three tests cover it. One miss: the change also gives budget-breach findings an incident, so a budget breach whose issue closed as done is now commented on and never refiled. The issue is about degraded incidents only, and no test covers a budget breach. Budget breaches are urgent crew work handed over at once, so changing how they refile is a behaviour change the direction did not ask for. Fix first: drop incident from budgetBreaches (src/crew/sentinel.ts:463). If you do want that behaviour, add a test that fails without it and say so in the pull. I did not exercise the preview or read the screenshots, because this change has no page, terminal or MCP surface. Second, not blocking: rows filed before the migration refile once more, which the pull states.

Approved

Does what the issue asks: a degraded incident whose issue closed as done gets at most one comment a day instead of a new issue. A new incident, or an issue closed as dropped, is still refiled. The migration is additive, the lookup is parameterised, no new door or dependency, and the three tests would fail without the change. I did not run the preview or read the screenshots; this is a background sentinel change with no page or terminal surface. Two things I would do next: (1) src/crew/sentinel.ts:421 incident is the open time of the oldest span still inside the 24h window. A cause that flaps in short spans will change identity when its first span ages out, and then it is refiled. Key the incident on a stable start, or add a test for the flapping case. (2) Rows filed before the migration have a null incident, so one more refile happens. Say so in the sentinel README section if it has one.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs