πŸ› fix: an ask's run leaves needs-owner off where the owner already answered it

Merged
AT
17d ago
+148-3

Slice: #99
State: #355

Builds State #355 of P-40, seen on #303 on 2026-11-15. Closes #355.

What was wrong

On #303 the agent posted a Needs you: at 09:59:27Z. The owner took
approved off and put it back at 09:59:36Z and 09:59:38Z. The labeled
run logged "the owner approved #303" but found no needs-owner in its
event, so it took nothing off. The ask's run, still going, labelled the
issue at 09:59:46Z, and the label stayed until it was taken off by hand.

What changes

  • src/asks.ts: the ask's run, for a comment on an issue whose event
    gives its id and time, reads answeredSince: an owner labeled /
    approved event, an owner Decision: that no one but owners edited,
    or an owner πŸ‘ on the ask, each newer than the ask. If it finds one, it
    does not label the issue. It reads again after labelling and takes the
    label off if an answer landed between the read and the label (the
    approval's run, whose event predates the label, cannot).
  • A review comment's ask, an issue already labelled, and an event with no
    id or time label as before, reading nothing.
  • README says so under "The Needs you list keeps itself". A Record in
    docs/decisions.md.

.github/workflows/checks.yml is unchanged, so no guard file moves and
this State needs no **Guards:** line or new approval.

Evidence

New tests in src/asks.test.ts, "an ask whose run ends after the owner
answered it (#355, seen on #303)": #303's own event order (ask at
09:59:27Z, unlabel 09:59:36Z, relabel 09:59:38Z) leaves the issue
unlabelled. Before the fix it failed, labelling the issue. Also: a
Decision:, a πŸ‘, and an approval landing between the read and the label
(labelled, then taken off). A Decision: someone else edited, another label,
someone else's πŸ‘, and answers older than the ask all still label it.

pnpm check passes: 1711 of 1711 tests and 87 of 87 script tests
under the 95/95/90 gate (asks.ts 100% lines, 96.61% branches, 100%
functions), pins, pariksha, build, smoke.

πŸ€– Generated with Claude Code


Summary by cubic

Fixes a race where an ask's run labels an issue with needs-owner even though the owner already answered while the run was still going, as seen on #303.

The ask's run now reads whether the owner answered after the askβ€”via their approved label, a Decision: comment no one but owners edited, or a πŸ‘ on the askβ€”before labelling, and again after, taking the label off if an answer lands between the read and the label. Review comment asks, already-labelled issues, and events without an id or timestamp label as before.

  • Adds answeredSince logic in src/asks.ts; new tests in src/asks.test.ts cover #303's event order, Decision/πŸ‘/approval timing, and non-owner edits.
  • Updates README.md and records the decision and rejected alternatives (concurrency groups, sweep counting the approved label) in docs/decisions.md.