Repository navigation
Description
Summary
dispatcher/decide.mjs asks "does an open PR close this issue?" at several sites, in several shapes. One fact, several statements, and the next arm that needs it picks a new shape. This is a refactor with no behaviour change.
⚠ The four-site duplication this ticket was written against does not exist on main. The fourth site arrives with #107, which is open, draft, and unmerged. main today carries three sites in two shapes. See below, and the Blocked by: line in Notes.
What is duplicated
Every site reads s.openPrsClosingIt, set by gather.mjs:117 on the issue arm alone.
On main today (82b1559) — three sites, two shapes:
| Line | Arm | Shape |
|---|---|---|
| 288 | issue_comment, implement verb — the in-flight guard |
s.openPrsClosingIt.length, then s.openPrsClosingIt[0] twice for the comment |
| 372 | session-end, issue — answered |
s.openPrsClosingIt.length > 0 |
| 374 | session-end, issue — Status done, drop awaiting |
s.openPrsClosingIt.length |
Once #107 merges — a fourth site, in a third shape:
| Line | Arm | Shape |
|---|---|---|
| 399 | sweep-awaiting |
s.openPrsClosingIt?.length |
That guard is the reason this ticket exists — #107's review thread noted the fourth copy and that nothing owned the duplication. Line 399 is confirmed against #107's diff: the hunk adds a ?. rationale comment and the guard directly after decide.mjs:397.
Why the shapes differ, and why that is the whole decision
Only the sweep-awaiting site can see a PR snapshot. sweep.mjs:112 pushes sweep-awaiting for PRs as well as issues (push(i.pull_request ? 'pr' : 'issue', …)), and gather.mjs sets the key on the issue arm only, so a bare .length throws there. The other three sit after an if (s.kind === 'pr') block whose every branch returns (decide.mjs:276-282, decide.mjs:355-365), so they only ever hold issue snapshots — where a missing key is a gather.mjs bug, and the bare .length is what surfaces it.
So a single ?. predicate is not a free win: it silences that signal at three sites to serve one. Pick deliberately.
Without #107 the decision does not arise. Three bare sites in two shapes are still worth one predicate, but there is no ?. to place and no signal to weigh against it.
Approach
Add one predicate beside isBot / respondTo (decide.mjs:35-41) and call it from every site. Line 288 also needs the PR number for its comment text, so either the predicate returns the list and each caller tests it, or a second value-returning helper covers 288.
// an issue whose PR is open is the PR's turn, not the human's
// (why: docs/why.md#a-pr-is-the-answer-to-an-implement-verb)
const inFlight = (s) => s.openPrsClosingIt?.length ? s.openPrsClosingIt : nullReturning the list rather than a boolean lets 288 read inFlight(s)[0] and keeps one read of the field. Whether the ?. belongs inside the predicate is the open question below.
Acceptance criteria
-
grep -n "openPrsClosingIt" dispatcher/decide.mjsshows the field named once, inside the predicate - Every site in the tables above calls it, and the plan each arm produces is byte-identical to today's
-
sweep-awaitingon a PR snapshot still does not throw, and its plan is unchanged - The chosen shape is stated where the reader meets it — a comment on the predicate, not only in a PR body
Verification checklist
-
node --test dispatcher/test/*.test.mjs→ 0 fail, and the pass count matches the base branch it started from.mainat82b1559runs 75; fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 adds one case, so the base is 76 once that merges. No test is added or changed — an unchanged suite is the evidence -
node --test dispatcher/test/decide.test.mjswith the predicate's?.narrowed to.→the awaiting sweep leaves a ticket whose PR is open, and does not throw on a PRfails with aTypeErroron its PR-snapshot case. That is what proves the guard survived the extraction. Needs fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 merged — that test does not exist onmain -
git diff main -- dispatcher/decide.mjstouches only the sites above and the predicate -
claude plugin validate ./workflow --strictpasses
Open questions
- Does the
?.live inside the predicate, or doessweep-awaitingkeep the only guarded read while the three issue-only sites stay bare? The first is one call shape everywhere and hides agather.mjsbug at three sites. The second keeps two shapes and the reason for each. Live only once fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 merges. - Should fix(dispatch):
sweep-awaitingre-labels an issue whose PR is already open #106's deferred question — shouldsweep-awaitingreach PRs at all? — be settled first? No. fix(dispatch):sweep-awaitingre-labels an issue whose PR is already open #106 already disposed of it:sweep-prre-derives every open, unlocked bot PR (sweep.mjs:88-101), so the answer was "out of scope, file it separately if a wrongawaitingon a PR is ever seen." None has been seen. It stays out of scope here. The observation still holds, though: if the sweep ever stops taking PR snapshots, no site needs?.and the question above disappears. - Priority is unset. It stays the reviewer's to set.
Notes
Blocked by: #106 — the fourth site and the test that pins it arrive with #107, which closes that ticket
- fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 is open and draft at
3b2464e. This repo isloopMayNotMerge, so a human merges it. There is no date to wait on, which is why this is a blocker and not aHold Until. - The blocker names fix(dispatch):
sweep-awaitingre-labels an issue whose PR is already open #106, not fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107, because the marker reader takes an issue URL and ignores a PR URL (dispatcher/markers.mjs:38). fix(dispatch):sweep-awaitingre-labels an issue whose PR is already open #106 closes when fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 merges, so the unblock fires then. - Branch from
mainafter fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 merges. Never from fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107's branch. This rewrites three arms fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 does not own, and a combined change cannot be attributed after the fact here. - If fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 is closed rather than merged, this ticket stays valid but shrinks to three sites in two shapes, with no
?.decision. Re-read Why the shapes differ before starting. - Raised by the adversarial review on fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107: fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 (comment). The rebuttal in that PR's body declined the change as widening a one-behaviour PR in a repo where a merge is the deploy, and promised this ticket.
- No skill or
loop-config.jsonchange, so noversionbump inworkflow/.claude-plugin/plugin.json.
🤖 Written by the sydevs autonomous loop — see what this is
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
sydevs-bot commentedon Sep 17, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Sep 17, 2026
Revised. The four-site duplication this ticket describes is not on
main— the fourth site arrives with #107, which is open and unmerged.Blocked by: #106, the ticket fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 closes. The marker reader ignores a PR URL (markers.mjs:38), so the blocker names the issue.mainat82b1559has three sites in two shapes (288, 372, 374); a fourth at 399 arrives with fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107. Line 399 checked against that PR's diff.mainruns 75, not 76, and3b2464eis fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107's head, notmain. It becomes 76 once fix(dispatch): the awaiting sweep leaves a ticket whose PR is open #107 merges.sweep-awaitingre-labels an issue whose PR is already open #106 already ruledsweep-awaitingreaching PRs out of scope until a wrongawaitingon a PR is seen. None has been.?.decision.Effort stays
Easy. Priority is yours.@sydevs-bot implementstarts work. This comment does not.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
sweep-awaitingre-labels an issue whose PR is already open #106sydevs-bot commentedon Sep 18, 2026
@Ardnived unblocked: every blocker is closed. Say
@sydevs-bot implementto start.🤖 sydevs dispatcher
Ardnived commentedon Sep 18, 2026
@sydevs-bot implement
fix(loop): preflight's command, the journal's cut order, and the Prio…