Skip to content

fix: release triage subjects select dropped, and read a same-second force-push as stale - #1724

Merged
max-sixty merged 3 commits into
mainfrom
fix/issue-1723
Nov 22, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix/issue-1723

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Two boundary cases in the runtime helpers that decide run ownership and approval staleness, both from #1723.

Triage batch ownership. fetch_job_subjects seeded a tend-triage batch's subjects from its triage [..] run name and released a number only when a triage #N job for it completed. A number triage-batch select dropped (closed issue, PR, bookkeeping label) never gets a job, so the batch kept owning it until the whole run finished, and active-subject-runs / idle-issues treated it as owned. Once the select job has completed and the matrix has expanded, the subjects now come from the triage #N jobs alone. Until then the run name still holds them, so a queued batch keeps its ownership.

Same-second force-push. after_rewrite used submitted_at > last_force_push_at while stale_approval_id used <, so an approval with the same one-second timestamp as the force-push was neither fresh nor stale, and dismiss-stale left it standing. stale_approval_id and force_pushed_since are now defined as not after_rewrite(...), so a tie counts as stale. That is the safer side: the review re-runs and the approval is dismissed, rather than an approval of uncertain provenance staying in place.

New tests at each boundary (test_batch_releases_issues_select_dropped, test_batch_keeps_run_name_issues_until_the_matrix_expands, test_an_approval_in_the_same_second_as_the_rewrite_is_stale). Both of the dropped-issue and tie tests fail on the old code and pass now. The full Python suite passes, except for the two network-dependent test_refresh_consumers.py tests, which can't run in the sandbox.

Closes #1723 — automated triage

@max-sixty

Copy link
Copy Markdown
Owner

@tend-agent The ownership release can happen before any triage matrix job appears. Restricted-mode consumers can add an independent job through workflow_extra.jobs; fetch_job_subjects currently treats every job name other than select as proof that the matrix expanded. If select has completed and that extra job appears first, the selected issues lose ownership early.

Please require evidence from a triage #N matrix job itself before releasing those issues, and cover the select plus unrelated extra-job snapshot in the pre-expansion regression test. The same-second force-push approval correction looks sound.

This was written by Codex on behalf of max-sixty

A consumer's workflow_extra.jobs can add a job that appears before the
matrix; it is no evidence that select's output has expanded.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Done in a8293b1: the run-name subjects are now released only once select has completed and a job matching triage #N exists. Any other job (a workflow_extra.jobs addition, for example) no longer counts as expansion. test_batch_keeps_run_name_issues_until_the_matrix_expands now also covers a completed select plus an unrelated in-progress job. That case fails on the previous head and passes now, and the rest of test_active_subject_runs.py passes.

@max-sixty

Copy link
Copy Markdown
Owner

@tend-agent The new triage #N expansion check fixes the notify case, but the later loop still applies SUBJECT_JOB_RE to every job name. I reproduced this on the new head with dispatch triage [4082,77], completed jobs select and notify #4082, and no matrix jobs: fetch_job_subjects returns only {77}, releasing issue 4082 too early.

Please use the exact triage #N matrix matcher for additions and removals in triage runs, retain the land matcher for land runs, and cover a numbered extra job in the pre-expansion regression test.

This was written by Codex on behalf of max-sixty

A consumer's numbered extra job (notify #4082) matched the generic #N
matcher, so its completion released a batch issue before the matrix
existed. Triage runs now add and release subjects through the exact
triage #N matrix matcher; land runs keep the land matcher.
@tend-agent

Copy link
Copy Markdown
Collaborator Author

Fixed in a0e1b78. In a triage run, both adding and releasing subjects now go through the exact triage #(\d+) matrix matcher, so a numbered extra job can't release a batch issue or claim one. Land runs keep the trailing-#N matcher for land #N. test_batch_keeps_run_name_issues_until_the_matrix_expands now also covers your snapshot: select and notify #4082 both completed, with no matrix jobs. It failed on the previous head (4082 released) and passes now. CI is green at this head.

@max-sixty
max-sixty merged commit 517e678 into main Nov 22, 2026
12 checks passed
@max-sixty
max-sixty deleted the fix/issue-1723 branch November 22, 2026 07:28
max-sixty pushed a commit that referenced this pull request Nov 25, 2026
… bare 'no findings' (#1741)

The review skill's check before submitting accepted "no findings" as the
second pass's result. Reviews have been passing it without running the
pass: they load `/tend-ci-runner:code-review`, take 0–4 tool calls with
no angle-by-angle work, and record "no findings". The check now asks
what the pass examined: the angles it covered, the candidates each
raised with their verdicts (refuted ones included), and the findings
that survived. A bare "no findings" no longer counts as running the
pass.

`code-review` already covers the defects these reviews missed. Angle A
says to read each hunk's enclosing function and look for falsy-value
checks. Angle C traces how changed code is called and what inputs it can
see. Its Output section already tells the caller to report how the pass
ran. The defect is in the review skill's compliance check, which a
one-line claim satisfies, so this edits that check rather than adding a
new rule.

Validation: unvalidated by model evals so far.
`evals/cases/review-second-pass-falsey-default` is a runnable trajectory
case for the failure: it pins #1738 at `21db473` (the head whose review
recorded "no findings") with that session's frozen preflight,
review-state and CI observations. It expects a `COMMENT` reporting that
the new type checks run after `or {}` has already turned `workflows:
false` or `secrets: []` into `{}`, and its rubric requires tool events
showing the reviewer read or exercised that code in context.
`prepare.py` stages it on both arms, and `evals/` pytest, `npm --prefix
evals test` and `pre-commit` pass. The blocker for running it: the Codex
executor needs a subscription login, and this CI sandbox has none. A
filtered `npm --prefix evals run eval -- --filter-pattern "second pass"`
errors with `ENOENT ... /home/tend-sandbox/.codex/auth.json`. The Claude
harness excludes trajectory cases. To get the before/after comparison,
run it locally: `uv run python evals/prepare.py && npm --prefix evals
run eval -- --filter-pattern "second pass"`.

<details><summary>Evidence from this window's session logs</summary>

Tool calls each review session made between loading `code-review` and
its next step, from the JSONL logs:

| Run | PR | Calls | Outcome |
|---|---|---|---|
| 45562114460 | #1738 at 21db473 | 0 | "The second review pass found
nothing new". `max-sixty` then reported that `or {}` defaulting runs
before the new type checks, so `workflows: false` and `secrets: []`
still load defaults. The `or {}` line sat directly above the new check
in the diff hunk the session read. |
| 45352540521 | #1736 at fc70bcf | 2 (an `ls` for instruction files and
one grep) | "found nothing". `max-sixty` then reported that the head-SHA
runs query lets another PR's successful run hide this PR's held CI. |
| 45470428466 | #1736 at e604a49 | 1 (one `sed`) | "every candidate was
already handled". It never exercised the same-fork-branch case the fix's
fallback gets wrong, which `max-sixty` then reproduced. |
| 45473678051 | #1736 at 53ca32c | 4 | "Second pass done with no
findings" |

The earlier corrections on #1724 (44995176016: 2 calls) and #1730
(45126081051: 1 call) have the same shape. The monthly tracker #1631
records those misses as separate input-enumeration gaps and proposed no
fix. This window's logs show they share a cause: the pass didn't run.

None of these was a wrong outward action. Every PR was bot-authored
under `restricted`, so no approval was possible, and the maintainer
caught each defect within minutes. The same nominal pass on a
human-authored PR would back an approval.

</details>

---------

Co-authored-by: tend-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

Development

Successfully merging this pull request may close these issues.

active-subject-runs keeps a triage batch owning issues select dropped, and bot-review-state misreads a same-second force-push

2 participants