Skip to content

audit: the idle line names waiters by role and PR, for open PRs only, with no state file names (#108) - #154

Merged
deanbot merged 2 commits into
mainfrom
108-audit-idle-summary
Nov 2, 2026
Merged

deanbot merged 2 commits into
mainfrom
108-audit-idle-summary

Conversation

@deanbot

@deanbot deanbot commented Nov 2, 2026

Copy link
Copy Markdown
Owner

What changed and why

The auditor's "Measured, no finding" section listed every waiter state file in the state folder on the machine it ran on, by file name, ending in -wait.json. That had three problems:

  • the report is posted as an issue, so it put local file names on GitHub;
  • most of the files were leftovers from PRs merged long ago;
  • the numbers looked like counts over the period, though they are streaks at the time of the run.

scripts/audit.mjs now reads each state file only to learn its waiter's kind and PR, and names no file:

  • <slug>-pr-poll-<n>-wait.json: the executor's waiter on PR #n, counted only while that PR is open. The open PRs come from one gh pr list --state open read, inside the same gather step as every other read, so a failure exits 2 like they do.
  • <slug>-pr-state[-<clone>]-wait.json: the reviewer's waiter. The clone name, a local name, is dropped.
  • <slug>-pr-qa-state-wait.json: QA's waiter.
  • Any other name is skipped: another repository whose slug starts the same way, or an old state format.

The markdown line now reads, for example: Wake-ups that found nothing: 4 waiters on this machine, for open PRs and the roles, with their idle streaks at the time of the run (not counts over the period): the executor's on PR #3 2, the executor's on PR #12 4, the reviewer's 1, QA's 5. What a wake-up catches isn't recorded, so there is no finding.

--format json gives idle: [{ "waiter": "pr-poll", "pr": 3, "idle": 2 }, …, { "waiter": "pr-state", "idle": 1 }, { "waiter": "pr-qa", "idle": 5 }]. It no longer has a file key: the JSON named files too.

SPEC's Auditor section describes the new form. The test fake gh gains an openPrs key, used only for pr list --state open. Other callers are unchanged.

Done, and the checks that show it

All tests below are in scripts/test/run.mjs, in the audit section, named audit idle (#108): ….

  • The markdown names no state file and no local path. A seeded state folder gives a report with no -wait.json, no .agent-loop, no home path and no clone name ("the markdown names no state file, folder or clone").
  • Waiters for closed PRs are left out. With PRs Kiro adapter #3 and Remove spec-path config field from all adapters #12 open, feat(start-reviewer): sentinel file stop mechanism #11 merged, a lookalike slug and an old-format name in the folder, only Kiro adapter #3 and Remove spec-path config field from all adapters #12 count, plus the role waiters. The test checks the exact line. With no PR open, only the role waiters count.
  • The line says the numbers are current streaks, not period counts. The exact-line test includes "(not counts over the period)".
  • A missing state folder and an empty one both still give "no waiter state for this repository on this machine".
  • SPEC's Auditor section describes the summary form.
  • JSON: the exact idle array is checked, and the JSON text contains no file or clone name.

Mutation-checked:

  • Dropping the open-PR filter fails the exact-line, JSON and no-open-PR tests.
  • Dropping the "(not counts over the period)" wording fails the exact-line test.

Calls a reviewer might push back on

  • The line lists every counted waiter by role and PR, rather than a count with only the highest streak named. PR numbers are public, and a project has few open PRs, so each streak stays readable.
  • Several reviewer clones each appear as "the reviewer's". The clone name is local, so it isn't shown.
  • If the folder holds only leftovers or unknown names, the line is the same "no waiter state for this repository on this machine": nothing left counts.
  • An executor waiter is identified by the PR number in its file name. A waiter for a PR that was reopened counts again.

Known limits

  • The streaks are still those of the machine the audit runs on. A waiter on another machine isn't seen, as before.

Restart note

None: no loop text changed, and audit.mjs is read when it runs. Setup doesn't need re-running.

Closes #108

@deanbot
deanbot marked this pull request as ready for review November 2, 2026 02:03
@deanbot
deanbot merged commit 2d4d249 into main Nov 2, 2026
4 checks passed
@deanbot
deanbot deleted the 108-audit-idle-summary branch November 2, 2026 02:10
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.

Audit report lists local waiter state files by name

1 participant