π fix: an ask's run leaves needs-owner off where the owner already answered it
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, readsansweredSince: an ownerlabeled/
approvedevent, an ownerDecision: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
answeredSincelogic insrc/asks.ts; new tests insrc/asks.test.tscover #303's event order, Decision/π/approval timing, and non-owner edits. - Updates
README.mdand records the decision and rejected alternatives (concurrency groups, sweep counting theapprovedlabel) indocs/decisions.md.