Skip to content

skills(review-runs): add the run census as a second stranded-trigger drain input - #1073

Merged
max-sixty merged 7 commits into
mainfrom
fix/issue-1066-census-drain-input
Aug 28, 2026
Merged

max-sixty merged 7 commits into
mainfrom
fix/issue-1066-census-drain-input

Conversation

@tend-agent

@tend-agent tend-agent commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

A run that dies before the failure handler can strand its trigger without filing an outage row or uploading a session log. The existing drain treats an empty outage issue as proof that nothing was stranded.

The run census now supplies a second signal. For a failed census row absent from the outage issue, the skill confirms that the work is missing and reports the stranded trigger as a finding; a census-only failure is not a row on the outage issue and so does not hold its close. It does not re-run the row, which has no failure record showing which jobs are safe to replay. The existing recovery path for recorded outage rows is unchanged, --failed included — an outage row exists only because a job ran and failed, so it always has a failed job to select.

Scope against the two issues: both suggested re-running the census-only rows as well, and this lands the detection half only. The invisibility each issue reports — a stranded trigger that nothing on the record ever names — is what the sweep can fix by itself, and once the row is a finding a human can replay it. An automatic re-run of a run that recorded no jobs is the part with no evidence behind it. Closing both on that basis; the recovery half is worth its own change if it is wanted.

Verification: pre-commit on the changed skill file. This is a report-only documentation change that retains the existing census with tee, filters it with jq, and adds no recovery commands.

Closes #1066
Closes #1067

…drain input

A run that dies before the action's failure handler files no outage row and
uploads no session log, so the drain never sees it though the trigger is
stranded. Filter Step 1's census for a second input, and say that a re-run
exiting 0 is not evidence the row is drained.

Report-only follow-up to #1069.

Closes #1066
Closes #1067

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed at df46ea9, which rewrote the paragraph I'd drafted against. Detection is the right half to keep: Report failure is a step inside the composite action (claude/action.yaml, codex/action.yaml, both gated on failure() && steps.security.outcome != 'failure'), so a job that never reaches it files nothing, and status=completed in Step 1's census does return those runs. Restoring --failed is consistent now that census-only rows are explicitly not re-run — an outage row only exists because a job ran and failed, so it always has a failed job to select.

One finding, inline: the new paragraph and the section's closing line give conflicting terminal instructions for the outage issue.

Also, the description is now stale against this head — it still describes the re-run paragraph ("states the one thing a session must not conclude from a re-run: that exit 0 means the row is drained", "report the row on the outage issue and leave it open"), the dropped --failed, and a gh run view <id> --json status,conclusion,attempt recipe that no longer appears in the diff. Worth rewriting to the report-only shape that actually landed, including that the census-only path now detects but deliberately doesn't recover — #1066's own suggested fix asked for the re-run, so Closes #1066 is claiming a narrower fix than the issue requested.

@max-sixty
max-sixty merged commit 6353dd2 into main Aug 28, 2026
7 checks passed
@max-sixty
max-sixty deleted the fix/issue-1066-census-drain-input branch August 28, 2026 02:36
max-sixty added a commit that referenced this pull request Aug 28, 2026
Failed event workflows already leave their triggering notification
unread, but that only provides recovery when the bot was subscribed
before the event. The notification poll also read just the first page
and acknowledged individual threads before deciding whether their work
had a real outcome.

This makes the recovery model explicit and small:

- installation and every notification poll idempotently enable
repository watching;
- the pre-check captures every unread page before a ten-minute cutoff
and does not acknowledge anything;
- polls are serialized, process each thread from current repository
state, and advance the repository acknowledgement only through the
completed prefix before the first unresolved item;
- exact in-flight and issue cross-reference checks prevent duplicate bot
work;
- the daily review-runs workflow scans current open issues, live PR
heads and bot-directed replies, and failing default-branch CI as a slow
backstop for delayed or missed notifications.

Historical workflow runs and the `tend-outage` issue remain diagnostic
evidence. They are no longer replayed for recovery, so Tend always uses
its current workflow and the subject's current state. After its
exhaustive live scan, the daily sweep reads every row from the canonical
outage tracker and closes it only after the applicable live work is
handled.

The independent test review caught a lossy one-shot reconciliation flag
in the first draft, and hosted review caught overlap, partial-progress,
deduplication, unreadable-subject, and outage-lifecycle gaps. The final
design has no new durable state: watching is enforced every poll, unread
notifications are the recovery queue, and the live-state scan recurs
every day. Contract and integration tests cover pagination, the strict
cutoff boundary, serialized polling, bounded acknowledgement,
permanently unreadable subjects, fragile deduplication queries,
install-time watching, and the current-state outage lifecycle.

Follow-up to #1073; implements the recovery behind #1066 and #1067.

Verification: `wt test` (723 tests plus worker tests and typecheck),
`pre-commit run --all-files`.

> _This was written by Codex on behalf of max-sixty_
This was referenced Aug 28, 2026
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Aug 30, 2026
Automated nightly regeneration of tend's workflow files.

**tend version:** 0.1.20 → 0.1.22

## Notable changes

- **Notifications now run off a recovery queue** (max-sixty/tend#1074).
The pre-check drops the old layered inbox sweep (shadowed-run and
closed-bot-PR marking) in favour of a single paginated snapshot taken
before a 10-minute cutoff, passes that cutoff through to the agent, and
keeps repository watching enabled with an idempotent `PUT
.../subscription` on every cycle. The job also gains a serial
`tend-notifications` concurrency group.
- **`tend-review` re-targets instead of skipping**
(max-sixty/tend#1082). The "skip when the live HEAD is already examined"
gate step and its `if:` guards are gone; a live session now re-targets
when HEAD moves. The concurrency group adds `queue: max` so a push can't
evict a pending `ready_for_review` run.
- **Skills check the default branch for a landed fix before opening a
PR** (max-sixty/tend#1070), and `review-runs` gains the run census as a
second stranded-trigger drain input (max-sixty/tend#1073).
- **Poll/rerun script fixes** (max-sixty/tend#1053,
max-sixty/tend#1055): `tend-review` no longer gates the CI poll, and an
unresolvable commit fails fast rather than passing silently.
- **Generator fixes**: `watched_workflows` and `branches` are validated
as string lists (max-sixty/tend#1076), and block prompts no longer get
padded blank lines (max-sixty/tend#1090).

Full upstream diff:
max-sixty/tend@0.1.20...0.1.22

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty pushed a commit to max-sixty/leaf that referenced this pull request Aug 30, 2026
Automated nightly regeneration of tend's workflow files.

**tend version:** 0.1.20 → 0.1.22

**Notable changes**

- Notifications recover work missed while the unread queue was stale,
and the job now runs under its own `tend-notifications` concurrency
group so overlapping schedules serialize instead of racing
(max-sixty/tend#1074).
- Skills check the default branch for a landed fix before opening a PR,
cutting duplicate PRs for work that already merged
(max-sixty/tend#1070).
- `review-runs` gains the run census as a second stranded-trigger drain
input (max-sixty/tend#1073), and reviews re-target when HEAD moves
rather than being discarded (max-sixty/tend#1082).
- The CI poll no longer lets `tend-review` gate it, and the
commit-resolution script fails fast instead of proceeding on an
unresolved SHA (max-sixty/tend#1053, max-sixty/tend#1055).
- The generator validates `watched_workflows` and `branches` as string
lists, and stops padding blank lines inside block prompts
(max-sixty/tend#1076, max-sixty/tend#1090).

max-sixty/tend@0.1.20...0.1.22


**Beyond the regeneration:** 0.1.22's `tend-review.yaml` sets
`concurrency.queue: max`, which GitHub accepts but the pinned
`actionlint` hook rejects, so this PR also adds a scoped `-ignore` for
that one schema message to `.pre-commit-config.yaml` — otherwise `lint`
is red and the PR can't merge on its own CI. Tracked upstream as
max-sixty/tend#1094.

---------

Co-authored-by: leaf-agent <[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

2 participants