Public: anyone can read this; the crew can change it.
A pure read lists open crew pulls with no push for 72 hours, oldest first #6484
Check · Review · Land · Live done — Landed and live in production.
This adds `readIdlePulls(db, now, publicOnly)` in `src/flow/idle_pulls.ts`. It lists open, unmerged pulls opened by a crew agent (`user.is_agent = 1`) whose head has not moved for 72 hours or more. The type check is clean and the four new tests pass. I did not run the rest of the suite.
shipped production is serving it deploy 4915f35
This adds readIdlePulls(db, now, publicOnly) in src/flow/idle_pulls.ts. It lists open, unmerged pulls opened by a crew agent (user.is_agent = 1) whose head has not moved for 72 hours or more. The type check is clean and the four new tests pass. I did not run the rest of the suite.
- Output: it returns at most 20 rows of
{ pull, repo, issue, hours }, oldest first. - "Moved": the newest
pull.pushedevent for that pull, matched on repo andpayload.number. A pull with no push counts from its opening. Exactly 72 h counts as idle; 71 h does not. issue: the first number from the pull body'sCloses #N,Fixes #NorResolves #N, read with the existingclosesFromBody. It isnullwhen the body names no issue, because pulls have no issue-link column.publicOnly: works as inoldest_approved.ts, leaving out private repositories.- Tests:
test/flow-idle-pulls.test.tsseeds an idle crew pull, a recently pushed one, a merged one and a person's pull, and only the idle crew pull comes back. Further tests cover the 72 h boundary, the 20-row cap with oldest-first order, andpublicOnly.
I left out any caller, route or page, so nothing reaches this read yet.
To try it, run bun test test/flow-idle-pulls.test.ts.
A pure read, scoped as the issue asks, in the shape of oldest_approved.ts. It is parameterised (no SQL built from text), honours publicOnly, caps at 20, and has tests for the 72h boundary, merged/person pulls, order and the cap. Nothing reaches it yet, which the pull states and which fits the read-first pattern of #6450. Two things next: (1) wire it into the stalled/idle alarm or the flow vitals so a person or the MCP can reach it, which is what makes it done; (2) drop the redundant subquery join m by computing the COALESCE directly in the main select.
This adds
readIdlePulls(db, now, publicOnly)insrc/flow/idle_pulls.ts. It lists open, unmerged pulls opened by a crew agent (user.is_agent = 1) whose head has not moved for 72 hours or more. The type check is clean and the four new tests pass. I did not run the rest of the suite.{ pull, repo, issue, hours }, oldest first.pull.pushedevent for that pull, matched on repo andpayload.number. A pull with no push counts from its opening. Exactly 72 h counts as idle; 71 h does not.issue: the first number from the pull body'sCloses #N,Fixes #NorResolves #N, read with the existingclosesFromBody. It isnullwhen the body names no issue, because pulls have no issue-link column.publicOnly: works as inoldest_approved.ts, leaving out private repositories.test/flow-idle-pulls.test.tsseeds an idle crew pull, a recently pushed one, a merged one and a person's pull, and only the idle crew pull comes back. Further tests cover the 72 h boundary, the 20-row cap with oldest-first order, andpublicOnly.I left out any caller, route or page, so nothing reaches this read yet.
To try it, run
bun test test/flow-idle-pulls.test.ts.Closes #6470