Repository navigation
fix(dispatcher): own lock removal is not a session ending; sync-only by file name - #232
Conversation
…nding The lock label comes off with the PAT, so the dispatcher's own removal wakes workflow-state.yml as an `unlock` too. Two of those were read as a session finishing: - A failed fire removes the lock and leaves its handler pending. The unlock then re-targeted the pending verb at once, so while routines are paused it fired again every lap, posting a new comment each time, and maxAttempts never bounded it. - A timeout removes the lock, fires attempt 2 and relocks. The queued unlock then marked attempt 2 done and released its lease, and the sweep later reported exhaustion while it ran. `unlock` now does nothing when the item is locked again, or when a failed fire is pending. A lease refusal's pending is excluded: there the unlock is the holding session ending, and `unlocked` must still clear it and release the lease. `reconcile` routed a leftover recheck into `unlock` before it looked at the pending retry, so with the guard that retry would never run. It now skips that route for the dispatcher's own unlock and reaches the retry. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`isContractSyncOnly` compared the PR's changed-file count with the consumer's copy-path count. A sync PR to SahajAtlasWeb has two copies, so one copied file plus a `fix-ci` edit under src/ still read as sync-only: the critic was skipped and auto-merge armed over unreviewed code. It now requires every changed file, a rename's old name included, to be one of the copy's `paths`. gather fetches the file list only for a bot PR on the sync branch, the one PR the answer can change, so every other PR costs no extra call. Co-Authored-By: Claude Opus 5.5 <[email protected]>
gather built `inlineCounts` and never read it, and shaped every review with `inline_count: 0`, so decide's `r.inline_count > 0` could never be true. The case it was meant for, a review whose only content is inline comments, is already caught: each inline comment is an unresolved thread whose last word is the reviewer's, and the thread loop above returns "a thread waits on a reply". Wiring the per-author count through would have been wrong anyway: it counts every comment that author ever left, so an empty-bodied approval after an old inline note would read as a request for changes. A test pins that an inline-only review still fires address-review. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… sweep emits Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Four commits, five files, each one behaviour with the failure it prevents named. Nothing is smuggled in, and no skill or ceiling moves with it.
Every claim in the body checks out from the head: 352 dispatcher tests and 97 lib tests pass, the new unlock test fails without the guard and separately without the reconcile change, and the contract test fails against the old count rule. Both refactor commits drop genuinely dead code: sweep.mjs emits neither dropped reason, and gather.mjs hard-coded inline_count: 0.
ownUnlock is the right shape. Both arms are reachable only by the dispatcher's own writes (apply.mjs:542, apply.mjs:347), apply.mjs:507 clears a pending the moment a session really starts, and timeout archives its own attempt at apply.mjs:344 — so a live session's end still archives and nothing is lost to the note.
The gap is the one the body names: no supervised BOT_DISPATCH=dry run yet, and that is the dispatcher's only real gate.
Findings
- should-fix —
gather.mjs:311re-implements the listFiles +previous_filenamepaircontracts.mjs:43-44already has. - consider —
contracts.mjs:97fails open on an empty file list, where the count rule failed closed. - consider —
decide.mjs:280the inline-only claim holds on a bot PR, not on a member's.
What was checked
Read whole: route() and needsAddressReview in decide.mjs, the PR path in gather.mjs, contracts.mjs, the fire, timeout and unlocked paths in apply.mjs, and sweep.mjs. Ladder, on the two new pieces: ownUnlock has no equivalent in the file and two callers; the file-list fetch does have one, which is finding 1. Grepped inline_count, sweep- and recheck across dispatcher/. Ran both suites from a detached worktree of 024bbea, then re-ran each with its own fix reverted.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`isContractSyncOnly` returned `files.every(...)`, and `[].every` is true. A bot PR on the sync branch whose file list came back empty — a listFiles page the gather never read, or a PR GitHub reports with no files — therefore read as sync-only: the critic was skipped and auto-merge was armed on a diff nobody had seen. The count rule this PR replaced failed closed there, through `changed_files ?? Infinity`. An empty or absent list now decides nothing, so the PR is reviewed like any other. Two assertions pin both shapes; the first fails without the guard. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVsjvVCH8xpZboAzZn
gather.mjs re-implemented the pair contracts.mjs:43-44 already had: a
paginated `listFiles`, then `flatMap([filename, previous_filename])`.
Two copies of one fetch give the sync rule two places to drift — a
rename handled in one and dropped in the other would make the same PR
sync-only in the plan and reviewable in gather, or the reverse.
`changedPaths(github, { owner, repo, number })` is now exported from
contracts.mjs beside the rule it feeds, and both callers use it. No
behaviour changes: the plan's own test already pinned the rename pair,
and a direct test pins it at the helper.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVsjvVCH8xpZboAzZn
On a member's PR the thread loop skipped every thread a human rooted, not just the author's own. A reviewer whose whole ask lives in inline comments therefore woke nothing: their review body is empty, so the review loop below passed too, and `inline_count` never covered the gap either — it was always 0, which is why dropping it in this PR is no regression. why.md says only the author's notes to themselves are not a request, and the review loop already excludes just the author (`decide.mjs:277`). The thread loop now matches it, so another person's thread on a member's PR is work however they left it. A test pins an inline-only review by a second member, with an empty review body so only the thread can wake it; it fails without the change. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVsjvVCH8xpZboAzZn
|
Three critic threads, three commits, pushed as 435b065. Nothing rebutted, nothing asked.
354 dispatcher tests and 97 lib tests pass. Still open: the supervised 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Dispatcher fixes from a workspace-wide audit, plus three the adversarial review on this PR added. Every commit touches only
dispatcher/*.mjs, its tests anddocs/why.md: no skill, ceiling orloop-config.jsonchange. They ship together because they are small and come from one review. Each commit is one behaviour and can be reverted on its own. The owner approved the first four behaviour changes; the last three answer the critic.⚠ The dispatcher runs on the next event in all five repos once merged.
What changes
fix(dispatcher)the dispatcher's own lock removal is not a session endingunlocktarget. (1) A failed fire removed the lock, the unlock re-targeted the pending verb at once, and it looped while the routines were paused. Each lap posted a comment and spent the shared PAT budget, andmaxAttemptsnever bounded a dying session. (2) A timeout retry removed the lock, fired attempt 2 and relocked; the queued unlock then archived attempt 2 as done. Nowunlockis a note when the item is relocked or a fire waits on its retry (pending, not lease-refused: a refused fire's real unlock must still run).reconcileno longer routes a leftover recheck into that guard ahead of the pending retry.fix(dispatcher)a contract sync is sync-only when every file is a copysrc/skipped the critic and armed auto-merge. gather now lists files for a bot PR on the sync branch only.refactor(dispatcher)drop the inline count no review ever carriedinlineCountswas built and never read, sor.inline_count > 0could never be true. An inline-only review is already caught as an unresolved thread; a new test pins that.refactor(dispatcher)dropsweep-retryandsweep-recheckreconcile.fix(dispatcher)an unreadable file list is not a sync (2ee7199)isContractSyncOnlyreturnedfiles.every(…), and[].everyis true. A bot PR on the sync branch whose file list came back empty therefore read as sync-only: the critic was skipped and auto-merge armed on a diff nobody had seen. The count rule it replaced failed closed there, throughchanged_files ?? Infinity. An empty or absent list now decides nothing.refactor(dispatcher)one changed-paths helper, two callers (668f51e)listFiles+previous_filenamepaircontracts.mjsalready had. Two copies of one fetch give the sync rule two places to drift: a rename handled in one and dropped in the other makes the same PR sync-only in the plan and reviewable in gather.changedPathsis now exported beside the rule it feeds.fix(dispatcher)an inline-only review on a member's PR wakes the loop (435b065)inline_countnever covered it either — it was always 0, which is why dropping it above is no regression. The review loop already excludes only the author (decide.mjs:278); the thread loop now matches it, and why.md says the same.Tests
node --test dispatcher/test/*.test.mjs: 354 pass, 0 fail.node --test workflow/lib/*.test.mjs: 97 pass.claude plugin validate ./workflow --strict: pass.reconcilechange./security-reviewover the branch: no findings. No new sink, command, write or secret, and the one widened filter still requires anassignment.respondTologin to wake a session.Not yet run: a supervised
BOT_DISPATCH=drydispatch.Sibling PRs (same audit)
🤖 Generated with Claude Code
https://claude.ai/code/session_01Mg9rjVsjvVCH8xpZboAzZn