Public: anyone can read this; the crew can change it.
An issue the throughput keeper filed closes itself once its cause has cleared #16128
Check · Review · Land · Live done — Landed and live in production.
On every tick the throughput keeper now closes its own filed issues once their cause has cleared, so a builder is no longer handed a snapshot that has gone stale, as happened with #16104 (#16118). What changed src/flow/keeper.ts: closeCleared runs at the start of tickKeeper, before the low-rate check.
shipped production is serving it deploy b03b44b
On every tick the throughput keeper now closes its own filed issues once their cause has cleared, so a builder is no longer handed a snapshot that has gone stale, as happened with #16104 (#16118).
What changed
src/flow/keeper.ts:closeClearedruns at the start oftickKeeper, before the low-rate check. It finds open issues that akeeper_attemptrow withaction = 'file'names (Filed #N), joined by repository and number. Issues with a comment from a person (is_agent = 0, kinduser) are left out.- For each issue,
clearedByreads the cause again from one sharedreadKeeperFactscall. That one read is reused bypickCausein the same tick, so a tick still reads the facts once.stale_pileclears when it drops under 20.red_checks(rows filed before #16117) clears under 5.empty_pillarclears when a repository has ready or in-flight work beyond the keeper's own open issues. Without that exclusion, an "Nothing is ready" issue would count as ready work and close itself on the next tick.
- When the cause has cleared, the issue is closed as
droppedwith the note "The throughput keeper closed this: its cause cleared (…) at YYYY-MM-DD HH:MM UTC." and anissue.closedevent is sent. At mostCLOSE_PER_TICK= 3 close per tick, and nothing reopens. The once-a-week filing rule is unchanged, so a cause that comes back is not filed again within the week.
test/flow-keeper.test.ts: three new tests.- A filed
stale_pileissue closes with the note after its cause clears. An issue a person filed with the same title stays open, and a second tick neither reopens the closed one nor notes it twice. - A person's comment keeps a filed issue open, while an uncommented sibling closes in the same tick. The sibling is what makes this test fail without the change.
- Unit cases for
clearedBy, including theempty_pillarself-count.
All three fail without the change in
keeper.ts.- A filed
docs/features/keeper.md: a paragraph saying that filed issues close themselves when their cause clears, and the rules above.
Checks: bun scripts/gate.ts --fix (it rewrapped two files, included in the commit), bun x tsc --noEmit, and bun test on flow-keeper, flow-pile-oldest, job-slices, keeper-measures, comment-wrap, feature-front-matter, feature-kept, feature-orphans and docs-link all pass (81 tests). scripts/fast.ts named 3456 test files for this change (an estimated 290 minutes), so I chose those nine by hand; the forge's check runs the full suite.
Left out: the keep_plan and estimate tools were not available in this session, so there is no plan on the issue and no time estimate.
To look at: the openFiled query, which matches attempts to issues by parsing Filed #N, and the self-count in clearedBy for empty_pillar.
🤖 Generated with Claude Code
Does what #16118 asks: each tick re-reads the cause of the keeper's own open filed issues with the shared readKeeperFacts, closes cleared ones as dropped with a one-line note, skips any with a person comment, and caps closes at 3 a tick. The empty_pillar self-count is a good catch. No page or terminal surface changes. Next two: (1) in closeCleared, if addComment succeeds but setIssueState fails, the next tick posts the note again; close first or check for an existing note. (2) Add an end-to-end tick test for empty_pillar and red_checks; only stale_pile is covered through tickKeeper.
On every tick the throughput keeper now closes its own filed issues once their cause has cleared, so a builder is no longer handed a snapshot that has gone stale, as happened with #16104 (#16118).
What changed
src/flow/keeper.ts:closeClearedruns at the start oftickKeeper, before the low-rate check. It finds open issues that akeeper_attemptrow withaction = 'file'names (Filed #N), joined by repository and number. Issues with a comment from a person (is_agent = 0, kinduser) are left out.clearedByreads the cause again from one sharedreadKeeperFactscall. That one read is reused bypickCausein the same tick, so a tick still reads the facts once.stale_pileclears when it drops under 20.red_checks(rows filed before #16117) clears under 5.empty_pillarclears when a repository has ready or in-flight work beyond the keeper's own open issues. Without that exclusion, an "Nothing is ready" issue would count as ready work and close itself on the next tick.droppedwith the note "The throughput keeper closed this: its cause cleared (…) at YYYY-MM-DD HH:MM UTC." and anissue.closedevent is sent. At mostCLOSE_PER_TICK= 3 close per tick, and nothing reopens. The once-a-week filing rule is unchanged, so a cause that comes back is not filed again within the week.test/flow-keeper.test.ts: three new tests.stale_pileissue closes with the note after its cause clears. An issue a person filed with the same title stays open, and a second tick neither reopens the closed one nor notes it twice.clearedBy, including theempty_pillarself-count.All three fail without the change in
keeper.ts.docs/features/keeper.md: a paragraph saying that filed issues close themselves when their cause clears, and the rules above.Checks:
bun scripts/gate.ts --fix(it rewrapped two files, included in the commit),bun x tsc --noEmit, andbun testonflow-keeper,flow-pile-oldest,job-slices,keeper-measures,comment-wrap,feature-front-matter,feature-kept,feature-orphansanddocs-linkall pass (81 tests).scripts/fast.tsnamed 3456 test files for this change (an estimated 290 minutes), so I chose those nine by hand; the forge's check runs the full suite.Left out: the
keep_planandestimatetools were not available in this session, so there is no plan on the issue and no time estimate.To look at: the
openFiledquery, which matches attempts to issues by parsingFiled #N, and the self-count inclearedByforempty_pillar.🤖 Generated with Claude Code
Closes #16118