Skip to content

fix(loop): a review comment is feedback, whatever its association - #113

Merged
Ardnived merged 5 commits into
mainfrom
claude/fix-109-review-comment-reason
Sep 18, 2026
Merged

Ardnived merged 5 commits into
mainfrom
claude/fix-109-review-comment-reason

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A review comment now resolves to its own reason and re-derives the PR, as a review already did.
  • That clears the hasAccess gate GitHub's CONTRIBUTOR stamp was tripping on every inline comment.
  • Cancelling a sibling event is safe again, which is the precondition dispatcher.yml states for itself.

Changes

  • dispatcher/resolve.mjs — pull_request_review_comment.created → reason review_comment, and association drops out of the facts with it.
  • dispatcher/decide.mjs — a review_comment row above case 'review': a bot guard, then delegation. hasAccess at decide.mjs:275 is untouched.
  • dispatcher/test/ — four cases, committed red before the fix.
  • docs/why.md — the incident, and what the fix does and does not restore.

One commit per behaviour: 3c5bc42 the red tests, 0a9edd9 the fix, 22dd968 the simplify pass, 6a67449 a prose correction the review pass earned, bfe449d a second the critic earned.

Contract impact

dispatcher.yml is unchanged, but it is the reusable workflow all five repos call, and it checks out main on every event. This reaches SahajCloud, SahajAtlasWeb, WeMeditateWeb and SahajAtlasWordpress on their next event after merge, with no merge in any of them. Nothing outside this repo's files changes.

Test results

  • Lean gate: ✓ claude plugin validate ./workflow --strict
  • Targeted specs: 80 passed, 0 failed — node --test dispatcher/test/*.test.mjs
  • Red-first check: ✓ with dispatcher/decide.mjs and dispatcher/resolve.mjs restored to origin/main, exactly the four new cases fail and the other 76 pass
  • Build: N/A — no package manager in this repo

Manual verification

The suite cannot post a live review, so the combination that caused the outage is only reachable by hand. Both steps want a scratch bot PR.

  1. Set BOT_DISPATCH=dry, submit a review with two inline comments, and read each dispatch / act job log. Every review-comment leg should print review_comment: plan = label, note, fire:address-review, and none should print without write access.
  2. Set BOT_DISPATCH=on, repeat, and confirm address-review fires once even with the pull_request_review.submitted run cancelled — one fired session in the PR's status comment, not four.

Notes for reviewer

Your two open questions are still yours. The ticket asked to leave hasAccess alone, so I did, and the existing association: 'NONE' case stays green. Flagging that docs/why.md argues the gate "can only ever subtract" while this PR keeps it — that is prose about the general case, not licence for a later reader to delete the remaining gate on its strength alone. Deciding that is a separate change.

The invariant is restored for a human's review, not the loop's own. A human PR takes case 'review''s verb tail, which reads the one body its event carried — so a verb left in a review body is still lost when that leg is the cancelled one. And on the loop's own critic review every review-comment leg stops at the bot guard, so only pull_request_review.submitted re-derives; the unlock fired when the critic releases its lock is what covers that, by a different mechanism. Both gaps are pre-existing, unchanged by this PR, and now written down — 6a67449 and bfe449d.

Detail — review findings, kept and dismissed

Reuse and efficiency lenses: clean. Both noted the recursive delegation matches case 'sweep-recheck' → reason: 'unlock' at decide.mjs:398, so it is the file's existing idiom rather than a new one.

Applied from the adversarial review. Its one consider finding — why.md:1184 claimed whichever of the five legs survives re-derives on a bot PR, which the bot guard makes false for the critic's own review. Checked against decide.mjs:317 and case 'unlock' before adopting: the claim is wrong and the work is not lost. bfe449d narrows the claim and names the unlock. No behaviour change.

Applied from the simplify pass. Three comment blocks re-narrated the docs/why.md section they each link — the CONTRIBUTOR stamp stated in full in three files, the SahajAtlasWeb#212 incident in two. Each keeps its imperative half and its breadcrumb.

Applied, reworked. The pass called the ignore test's fixture dead, and it was right for the wrong reason: a body of finding fails the critic-header test, so case 'review' would have noted a bot comment either way and the guard bought nothing the assert could see. The comment now opens with the critic header on a bot PR with an unanswered own-rooted thread — the case the guard exists for. Deleting the guard and re-running turns that test red on address-review firing against the bot's own words. Checked, not assumed.

Dismissed. Collapsing case 'review_comment' into a fallthrough label: it saves four lines and gives up the distinct note text plus that bot-critic behaviour, which the test above now pins. Dropping the third test as redundant: it is the ticket's fifth acceptance criterion, and it is the only coverage case 'review''s human-PR verb tail has ever had. Dropping the inert association: 'CONTRIBUTOR' from that test's fixture: it is the stamp GitHub really sends on that payload, and a fixture should look like the world it claims to model.

Raised, not acted on — a design question for you. The altitude lens argues the fix should be structural rather than per-row: either key the concurrency group so a no-op survivor cannot cancel an actionable sibling, or make every PR-surface reason fall through to evaluatePr and never return a bare note, with a test enumerating them. Today the invariant dispatcher.yml rests on is maintained by hand, one case at a time. Filing that as its own ticket is your call — it needs the decision before the code, and this PR is not the place to take it.

Noticed, outside the diff, not touched. gather.mjs:14 writes association into every snapshot comment and nothing reads it — that is your second open question, so it stays there rather than becoming a second ticket. gather.mjs also builds inlineCounts and then hard-codes inline_count: 0 in reviewsShaped, which makes the r.inline_count > 0 clause at decide.mjs:102 dead. Harmless today, because the thread loop above it catches the same case — but it sits in exactly the failure domain this PR is about.

Not run. securityReview.triggerPattern matches no changed path, so the security sweep was skipped. comment-lint.mjs skipped itself — no TypeScript in this repo.

Closes #109

🤖 Written by the sydevs autonomous loop — see what this is

🤖 Generated with Claude Code

https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w


Generated by Claude Code

Four cases the suite never had. All 76 existing tests pass with and without
the fix that follows, because nothing covered the mapping at all: a review
comment resolved to reason `issue_comment` and no test asserted otherwise.

Committed red on purpose, so the evidence the fix is load-bearing is in the
history rather than in a claim. Against this commit's parent:

    not ok 2  - resolve gives a review comment its own reason
    not ok 20 - a review comment on a bot PR re-derives the PR
    not ok 21 - a review comment from the bot, or from outside the allowlist
    not ok 22 - a review comment carrying a verb on a human PR

Two of them pin note text, not just action types. `types()` renders every
note as the bare string `note`, and an unhandled reason returns exactly one
note, so the bot and stranger cases would both stay green on shape alone.

Refs #109

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>
A CHANGES_REQUESTED review with four inline comments landed on
`sydevs/SahajAtlasWeb#212` and dispatched nothing. The PR sat untouched until
the reviewer asked why, eleven minutes later.

`resolve.mjs` mapped every review comment to reason `issue_comment`, whose row
gates on `hasAccess(association)` — OWNER | MEMBER | COLLABORATOR. GitHub sends
`CONTRIBUTOR` for a review comment by the same login it sends `MEMBER` for on
every issue comment, so both surviving runs logged `comment by Ardnived without
write access — not feedback` and returned a note. The gate is redundant where
it fired: the line above already requires `respondTo(author)`, an explicit
allowlist of three logins, and a payload-derived check over an allowlist can
only subtract.

The review's own event is the one path with no such gate, and it was cancelled.
Submitting a review with inline comments emits five events in one second, all
resolving to the same target and so to one concurrency group; three of the five
were cancelled, `pull_request_review.submitted` among them.

Cancelling is safe only because the decision is re-derived, which `dispatcher.yml`
says itself. The association gate is what broke that: the survivors returned
before reaching `evaluatePr`, so nothing re-derived anything.

So the reason, not the gate. A review comment resolves to `review_comment` and
delegates to `case 'review'`, which re-derives the PR through `evaluatePr` —
the invariant the concurrency block assumes, restored rather than replaced.
Whichever of the five survives now sees the thread the cancelled comment
created, since `gather.mjs` fetches review threads for any open PR.

Only the bot guard differs from `case 'review'`: that case's bot branch carries
the critic-header exception, which belongs to reviews alone. Everything after
it — the allowlist, bot PR to `evaluatePr`, human PR to `parseVerb` — is shared
rather than copied.

`association` leaves the review-comment facts with the reason; nothing on the
new path reads it. `triggerType` is untouched and still reaches the record, so
a handler still finds the comment it was woken for. The gate at `decide.mjs`
still guards `issue_comment` proper, where the author is not otherwise bounded,
and its test stays green. `dispatcher.yml` is unchanged.

Closes #109

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>
Comment volume, and one fixture that was not earning its place.

Three comment blocks restated the narrative that `docs/why.md` already carries
under the anchor each of them links — the `CONTRIBUTOR` stamp said in full in
three files, and the SahajAtlasWeb#212 incident twice. Each keeps its imperative
half and its breadcrumb; the story stays in one place, where it cannot drift.

The bot half of the ignore test is what this row's own guard buys, and its
fixture did not punish removing it: a body of `finding` fails the critic-header
test, so `case 'review'` would have noted it either way. The comment now opens
with the critic header on a bot PR with an unanswered own-rooted thread, which
is the case the guard exists for. Delete the guard and the test goes red on
address-review firing against the bot's own words. Checked by deleting it.

Kept, against the pass: the verb-on-a-human-PR test, which reaches
`case 'review'`'s verb tail that nothing covered before, and the inert
`association: 'CONTRIBUTOR'` in its fixture, because that is the stamp GitHub
really sends on that payload.

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>
The review pass caught the comment and `why.md` claiming more than the code
does. Both said a surviving leg re-derives the PR's whole state, full stop.
That is true through `evaluatePr`, which only bot PRs reach. A human PR takes
`case 'review'`'s verb tail, which reads the body the event carried — so a verb
left in the review body is still lost when that leg is the cancelled one.

The gap predates this change and survives it. Closing it means widening what
`gather.mjs` collects, since the snapshot carries issue comments and not
review-comment bodies. Named rather than fixed, because it is nobody's surprise
the next time it fires.

Claude-Session: https://claude.ai/code/session_01MZsMPSJuc6xW1xwMZpKu5w

Co-authored-by: Claude <[email protected]>
@sydevs-bot

sydevs-bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running

recent dispatches
  • 05:38Z address-review · attempt 1 · session · done
  • 05:38Z address-review · attempt 1 · session
  • 05:30Z adversarial-review · attempt 1 · session · done
  • 05:30Z adversarial-review · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 18, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The diff is the ticket and nothing more — one mapping, one row, four tests, one why.md section. Nothing here should not exist. The contract holds: dispatcher.yml is unchanged and the fire record still carries triggerType: 'review_comment', so no handler in the other four repos sees a new shape. The structural question — every PR-surface row reaches evaluatePr by hand — is left to you rather than built.

Findings — one, consider.

  • decide.mjs:317 — the loop's own critic review is the one storm where a surviving leg still does not re-derive, and why.md:1184 claims otherwise.

What was checked

  • node --test dispatcher/test/*.test.mjs → 80 pass. Both sources at main → exactly those 4 fail, 76 pass.
  • Deleted the bot guard, re-ran, test 21 went red. Checked, not trusted.
  • association is read only at decide.mjs:275. Dropping it here breaks nothing.
  • Nothing downstream branches on the reason name — fire, apply, gather, sweep, every SKILL.md.
  • git merge-tree against main is clean.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread dispatcher/decide.mjs Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Sep 18, 2026
The restored invariant was stated too broadly. On the loop's own critic
review every review-comment leg stops at the bot guard, so only the
`pull_request_review.submitted` leg re-derives, and cancelling it leaves
nothing behind it. The `unlock` the critic's own lock release fires is
what covers that case, not this row.

why.md now says which legs the claim holds for and names the mechanism
that covers the remaining one. The comment above `case 'review_comment'`
carried the same overclaim in one clause; it now reads "from a human on
a bot PR", which is what the guard two lines below already enforces.

Prose only. No behaviour changes: 80/80 specs unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Qcz8KMA9UAMtFUnkJkTAJy
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

One thread, adopted. The critic's finding — why.md:1184 claimed whichever of the five legs survives re-derives on a bot PR. That is false for the loop's own critic review: every review-comment leg stops at the bot guard.

Checked before adopting. The claim is wrong, and the work is not lost either way — the unlock fired when the critic releases its lock re-derives the PR, by a different mechanism than this row.

bfe449d narrows the claim in why.md and drops the same clause from the comment above case 'review_comment'. Prose only. Lean gate ✓, 80/80 specs unchanged.

Nothing rebutted, nothing asked. Your two open questions and the structural design question stay in the PR body, untouched.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Sep 18, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review September 18, 2026 05:43
@sydevs-bot
sydevs-bot requested a review from Ardnived September 18, 2026 05:43
@sydevs-bot sydevs-bot moved this from Revising to Approved in SYDevelopers Technical Roadmap Sep 18, 2026
@Ardnived
Ardnived merged commit 12c213a into main Sep 18, 2026
21 checks passed
@Ardnived
Ardnived deleted the claude/fix-109-review-comment-reason branch September 18, 2026 16:38
@sydevs-bot sydevs-bot moved this from Approved to Done in SYDevelopers Technical Roadmap Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

fix(loop): a review comment is feedback, whatever its association

3 participants