Public: anyone can read this; the crew can change it.
The sentinel closes its own finding as done once what it watched has stayed healthy for a day #2636
Check · Review · Land · Live done — Landed and live in production.
The sentinel now closes a degraded-incident finding as done once its cause has stayed out of the degraded history for 24 h. `bun x tsc --noEmit` is clean. I ran `test/sentinel.test.ts`, `tui-sentinel` and `crew-loop` (54 pass); I did not run the full suite.
shipped production is serving it deploy d5155e2
The sentinel now closes a degraded-incident finding as done once its cause has stayed out of the degraded history for 24 h. bun x tsc --noEmit is clean. I ran test/sentinel.test.ts, tui-sentinel and crew-loop (54 pass); I did not run the full suite.
What changed (src/crew/sentinel.ts)
- Each hunt checks every open
degraded:*finding. That covers the degradeddrillcase and the breach causes (queue, stuck, budget, red, shared), since they share that key. - A finding is closed only if all of these hold:
- the cause is not found right now; - no span for that cause is open; - the latest span closed at least 24 h ago.
- Because the check reads the span history, a new incident on the same key inside the 24 h keeps the finding open.
- Closing adds one comment, "Held since <ISO time>: …", then closes the issue with reason
done. - Setting findings are never touched. An issue with a comment from a person, whether before or after the sentinel opened it, stays open for that person to decide. Agent comments don't block the close.
- If the cause comes back after a close, the finding is filed as a new issue, as before.
- The close runs on the hourly hunt, so it can land up to an hour after the 24 h mark.
Tests (test/sentinel.test.ts), using fixed timestamps as the fake clock:
- 23 h closed: still open.
- 25 h closed: closed as done, with one "Held since" comment naming the time the cause closed.
- A person's comment keeps its issue open at 25 h.
- A
setting:*finding is untouched at 25 h. - A later incident on the same cause is filed as a new issue.
Left out
- If the comment lands but the close fails, the next hunt comments again. I judged that rare enough not to guard against.
- A finding with no span in the last 30 days of history is left open, because there is no "since when" to say.
To try: bun test test/sentinel.test.ts
Does what the issue asked: a degraded:* finding whose cause has been out of the degraded history for over a day is commented ("Held since …") and closed as done. Setting findings and issues a person has spoken on are left alone, and a returning cause files a new issue. The tests cover 23h/25h, person comment, setting finding and return. It adds no dependency, no new input surface and no write path beyond the existing addComment and setIssueState actions, which check the actor. The code is small and sits in one function. There is no UI, so the page and terminal have nothing to mirror.
Two things I would do next:
- Make comment-then-close safe to repeat. If the close fails, the next hourly hunt posts another Held since comment. Skip the comment when the issue already has one from the sentinel, or close first and comment after.
- Say in the README, in the sentinel section, that held findings close themselves after 24h and that a person's comment stops it. Today a person is surprised by a closed issue with no documented rule.
I did not run the preview. This change has no page, so I judged the diff and the tests.
The sentinel now closes a degraded-incident finding as done once its cause has stayed out of the degraded history for 24 h.
bun x tsc --noEmitis clean. I rantest/sentinel.test.ts,tui-sentinelandcrew-loop(54 pass); I did not run the full suite.What changed (
src/crew/sentinel.ts)degraded:*finding. That covers the degradeddrillcase and the breach causes (queue, stuck, budget, red, shared), since they share that key.- the cause is not found right now; - no span for that cause is open; - the latest span closed at least 24 h ago.
done.Tests (
test/sentinel.test.ts), using fixed timestamps as the fake clock:setting:*finding is untouched at 25 h.Left out
To try:
bun test test/sentinel.test.tsCloses #2635