Skip to content

Drain outage trackers the bot closed, and mark the drain's own close - #1700

Merged
max-sixty merged 2 commits into
mainfrom
outage-drain-marker
Nov 18, 2026
Merged

max-sixty merged 2 commits into
mainfrom
outage-drain-marker

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

review-runs' outage drain reads each tend-outage tracker's run rows to find what a failed run missed, then closes the tracker. Its listing skipped any closed tracker the bot itself had closed, on the premise that only the drain closes trackers as the bot. That premise fails wherever the bot closes issues for other reasons: in a repository whose overlay lets the bot close its own issues, a nightly or triage session closing a tracker hid its rows from the drain, and the failed runs those rows name were never diagnosed.

The drain now closes trackers with tend runtime review-runs close-outage-trackers, which posts a <!-- tend-outage-drained --> comment, and the listing skips only closed trackers whose latest row is that marker, so a tracker reopened after a drain and closed again with new rows still gets read. Before closing, the command re-reads each tracker and leaves open any that gained a row since the report, so a run that failed mid-sweep stays owed. Nightly keeps its tend-outage exception, restated as "review-runs closes these once it has read their rows": a nightly close would still skip the tracker's enrichment, and where review-runs is off nothing would drain it.

The reviews of #1688 found this; it's split out of that PR unchanged. Both PRs edit review-runs' outage paragraph, so whichever lands second needs a small merge. Tests: uv run pytest passes, including the two outage tests in test_evidence_scripts.py.

This was written by Claude Code on behalf of max-sixty

review-runs' outage drain listed a closed tracker only when someone other
than the bot had closed it, on the premise that only the drain closes a
tracker as the bot. A repository whose overlay lets the bot close its own
issues breaks that premise: a nightly or triage session closing a tracker as
the bot hid its rows from the drain, and the failed runs they name were never
diagnosed.

The drain now closes trackers with `tend runtime review-runs
close-outage-trackers`, which posts a marker comment, and the listing skips
only closed trackers that carry it. The close re-reads each tracker first and
leaves open any that gained a row since the report, so a run that failed
mid-sweep isn't marked read.

Nightly keeps its tend-outage exception with the reason the marker leaves:
review-runs closes these trackers once it has read them. A nightly close would
still skip the tracker's enrichment, and where review-runs is off nothing
would drain it.

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A drain marker anywhere on the tracker now exempts it, even when rows came after that marker. A maintainer can reopen a tracker the drain closed. report_failure writes to whatever tracker is open, so the next failures add rows below the marker. When anyone closes it again, outage_trackers skips it, and those rows are never read. The old closed_by check still caught this when a maintainer did the second close, so this is narrower than before, though rare. One fix is to count only a marker that is the tracker's latest entry. A comment left on a drained tracker that stays closed doesn't change its old closedAt, so the window filter above still skips it.

A tracker reopened after a drain can gain rows below the earlier marker; if someone closes it again before the next sweep, a marker anywhere in its rows hid those runs from the drain.
@max-sixty
max-sixty merged commit 3ef49e5 into main Nov 18, 2026
14 checks passed
@max-sixty
max-sixty deleted the outage-drain-marker branch November 18, 2026 02:41
max-sixty added a commit that referenced this pull request Nov 18, 2026
…and check other idle issues weekly (#1688)

The bot gets no GitHub event for its own writes, so an issue whose
triage session ended with a diagnosis, a next step or a blocker, and no
fix, sits until someone comments. On Leaf on 14 Nov, 19 of 31 open CI
cause issues were parked that way. This PR moves review-runs' "Reconcile
live work" checks into nightly's Step 5, since review-runs reviews how
runs went, and adds a stall check in two parts:

- **Nightly restarts causes, without judgement.** An open
`tend-ci-cause` issue with no assignee other than the bot, no queued or
running Tend run and no open PR that will close it has stalled, so
nightly passes each one to **Recover issue work**, whoever wrote last.
- **Weekly checks the rest, with judgement.** For other issues nothing
on GitHub tells a stalled issue from one waiting to be prioritised, so
weekly's new Step 3 reads each open issue the bot had the last word on,
leaving out CI reports and Tend's bookkeeping trackers, and sends to
triage only those where the bot owes the next step.

`tend runtime idle-issues` builds both lists (`causes`, `others`) from
one GraphQL read.

**To weigh:**

- The cause rule assumes a cause waiting on a person is assigned to
them. Leaf's overlay does that, but the bundled guidance didn't, so
**Retain engineering ownership** in `fix-a-bug` now says to keep an
issue assigned to the person a request waits on, including an earlier
session's request, and to unassign them once they act. That also keeps
such issues off weekly's list.
- A cause blocked outside the repository, such as on an upstream
release, has nobody here to assign, so it stays on nightly's list.
**Recover issue work** rechecks the blocker in the nightly session and
sends a worker only once it changes (the `repair-completion` eval's
externally blocked cause got no worker in 6 of 6 runs), so the cost is
one recheck per such cause per night. Avoiding it would take judgement
in nightly or a marker that `idle-issues` excludes.

The outage-tracker drain fix the earlier reviews found is now #1700.
Both PRs edit review-runs' outage paragraph, so whichever lands second
needs a small merge.

Max decided this design. Tests: `uv run pytest` passes, and the
idle-issues test fails under each of 16 single-rule mutations. Evals on
the current arm (Codex): `issue-recovery` 3/3 and `repair-completion`
3/3 on the final head; `parallel-maintenance` 4/6 over two batches on
the head before the last two skill-text commits (main's text: 3/3). Both
misses are on the weekly dependency-delegation criterion: the outputs
planned five parallel dependency reviews without saying they would use
subagents. One earlier `repair-completion` miss left a verified-resolved
cause open under Resolved issues' "leave it open for a maintainer"
default, so nightly's Resolved issues listing now leaves out causes and
reports, which close under their own rules. `issue-recovery` now splits
the same way, with nightly snapshots of causes and a weekly snapshot
that adds a cleared blocker and a maintainer decision.

> _This was written by Claude Code on behalf of max-sixty_
@max-sixty max-sixty mentioned this pull request Nov 18, 2026
max-sixty added a commit that referenced this pull request Nov 18, 2026
Bumps generator version to 0.3.27 and syncs lockfile.

8 commits since 0.3.26: nightly restarts stalled CI causes and weekly restarts other unfinished issues (#1688), review-runs drains outage trackers the bot closed (#1700), nightly files unfixed reachable defects as issues (#1699), the sandbox gets its own XDG_RUNTIME_DIR (#1697), comment and test fixes (#1701, #1702, #1703), and the 0.3.26 regeneration (#1695).
max-sixty added a commit to max-sixty/leaf that referenced this pull request Nov 18, 2026
Regenerates Leaf's Tend workflows with [tend
0.3.27](https://github.com/max-sixty/tend/releases/tag/0.3.27). Only the
action refs and the header versions change.

What changes for Leaf is where stalled work restarts
([max-sixty/tend#1688](max-sixty/tend#1688)).
Until now nothing restarted a `tend-ci-cause` issue whose triage session
ended without a fix, so its tests kept failing on `main`. Tend's nightly
run now sends to triage every open cause with no assignee but the bot,
no queued or running Tend run and no open PR that will close it. A cause
waiting on Max stays off that list because it is assigned to him. The
weekly run reads the other open issues the bot last wrote on, and
restarts those where the bot owes the next step. The daily `review-runs`
sweep keeps reviewing how runs went, and now also drains outage trackers
the bot closed
([max-sixty/tend#1700](max-sixty/tend#1700)).

> _This was written by Claude Code on behalf of max-sixty_
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Nov 18, 2026
Updates the generated Tend workflows from 0.3.26 to 0.3.27. The workflow
diff only bumps the version pins on `max-sixty/tend/claude` and
`setup-runtime`; the changes below ship in those actions and their
bundled skills
([compare](max-sixty/tend@0.3.26...0.3.27)).

What changes for this repo:

- **Stalled issues get picked up again.** Nightly now runs the open-work
checks that used to live in review-runs. It restarts any open
`tend-ci-cause` issue with no other assignee, no queued or running Tend
run, and no open PR that would close it. Weekly reads the other open
issues where the bot commented last and decides which ones need
follow-up (max-sixty/tend#1688).
- **Nightly files the bugs it doesn't fix.** A reachable defect the
sweep finds but can't fix becomes an issue, or a comment on an existing
one, instead of a line in the step summary (max-sixty/tend#1699).
- **Outage trackers closed by other sessions still get drained.**
Review-runs now marks the trackers it drains, so it still reads the run
rows of a `tend-outage` tracker that a nightly or triage session closed
(max-sixty/tend#1700).
- **The sandbox gets its own `XDG_RUNTIME_DIR`.** It used to inherit the
runner's directory, which the sandbox user can't open
(max-sixty/tend#1697).

Co-authored-by: worktrunk-bot <[email protected]>
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.

2 participants