Skip to content

feat(dispatcher): resolve a conflict once the base has settled - #317

Merged
Ardnived merged 4 commits into
mainfrom
claude/conflict-quiet
Nov 25, 2026
Merged

Ardnived merged 4 commits into
mainfrom
claude/conflict-quiet

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A conflicted PR waits until its base tip has been still for dispatch.conflictQuietMinutes (60) before resolve-conflicts fires.
  • The wait never outlasts dispatch.pendingDueMinutes, counted from the deferral the guard records in the status comment as conflictWait, keyed by head. An overdue conflict, a base time that can't be read, or a clock left by another head is resolved at once, as before.
  • gather reads the base tip's committer date, and only for a conflicted PR, so this adds one REST call where a conflict already exists. Its two commit reads — that one and the head's author — are now one commitFacts helper.

The failure this prevents

Each merge to main fires conflict-scan across the other open PRs, and every conflicted one got a session at once. A burst of merges therefore resolved the same branch once per merge. Each resolution after the first redid work that the next merge undid.

From the journals for 2026-11-22 to 25: resolve-conflicts ran 61 of 214 sessions, about 19% of session time. sydevs/SahajAtlasWeb#466 took five; the WeMeditateWeb reorganisation took 35 in one afternoon. We keep hitting the Routines account's usage limits, and this is the cheapest cut that leaves review and implementation untouched.

Tests

  • node --test dispatcher/test/*.test.mjs: 446 pass. Six cases cover the window: a recent base waits and starts its clock, conflict-scan waits too, a still base fires, an overdue conflict fires, no window or an unreadable base time fires, the clock bounds the wait where pendingSince is null, and the clock is written once per head.
  • Lean gate is green.

The real gate is a supervised dispatch. After merge, watch the next merge burst: conflicted PRs should log the base moved at …, show conflict held since … in the status comment, and fire once on the following sweep.

Notes for reviewer

The adversarial review's blocker was real: overdue reads pendingSince, which syncStatus nulls on every pass whose derived Status is not pending-with-due, and prStatus returns Awaiting for threadsWaiting before it reaches CONFLICTING. The bound the first bullet promised did not hold there. The guard now keeps its own clock, and overdue stays as the Pending path's shortcut so a deferred conflict never reaches reconcile's dueStep as "the PR has not moved".

🤖 Generated with Claude Code

Every merge re-derives the repo's other open PRs, and each conflicted one got
a resolve-conflicts session at once, so a burst of merges resolved the same
branch once per merge. SahajAtlasWeb#466 took five sessions in four days, and
the 2026-11-22 WeMeditateWeb reorganisation set off 35 in an afternoon:
resolve-conflicts was 61 of 214 sessions (about 19% of session time) from
2026-11-22 to 2026-11-25.

A conflicted PR now waits until the base tip has been still for
dispatch.conflictQuietMinutes (60). The wait never outlasts
pendingDueMinutes, and an unreadable base time resolves at once, so a base
that never settles costs no more than before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🤖 no session running

recent dispatches
  • 22:14Z resolve-conflicts · attempt 1 · session · done
  • 22:14Z resolve-conflicts · attempt 1 · session
  • 20:32Z address-review · attempt 1 · session · done
  • 20:32Z address-review · attempt 1 · session
  • 20:24Z review-pr · attempt 1 · session · done

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

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

Holistic assessment. The harm is counted, not guessed — 61 of 214 sessions, two named bursts — so this guard earns its place, and conflicts really are the one handler whose work a later base move invalidates, which is why a conflict-specific window beats a general fire debounce. Value, rule and story sit in their three homes, and the diff is four lines of logic plus its tests. But the bound the body promises does not hold: overdue reads pendingSince, which the board nulls the moment a conflicted PR derives Awaiting, and that is where a bot PR sits once the critic's threads are answered. A direct push whose committer date predates it reads as settled and resolves at once — today's behaviour, so no regression.

Findings

  • blocker — the wait has no bound on an Awaiting PR (dispatcher/decide.mjs:351).
  • consider — a second committer-date read beside the first (dispatcher/gather.mjs:383).

What was checked. Read whole: decide.mjs (conflictPlan, overdue, quietSweep, evaluateOpenPr), gather.mjs, status.mjs prStatus, apply.mjs syncStatus, predicates.mjs threadsWaiting, plus sweep.mjs, reconcile.mjs and the 7,37 * * * * cron — a conflicted PR is re-derived every half hour, so a 60-minute window does gate. new-pieces.mjs → NONE, so no streamliner ran; the ladder walked the one new read and the repo already has it (gather.mjs:396), which is the consider. node --test dispatcher/test/*.test.mjs on main: 440 pass, so the body's 444 is the four new cases. No dependency added. docs/why.md checked against docs/documentation.md: it names both constants and copies neither value. No question threads, no preview links, no contract surface touched.

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


Generated by Claude Code

Comment thread dispatcher/decide.mjs Resolved
Comment thread dispatcher/gather.mjs Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026
The quiet window deferred `resolve-conflicts` while `!overdue(s, config)`,
which reads `record.pendingSince`. `syncStatus` nulls that field on every
pass whose derived Status is not pending-with-due, and `prStatus` returns
Awaiting for `threadsWaiting` before it reaches CONFLICTING — the normal
state of a bot PR while a thread waits on the reviewer. `overdue` was then
always false there, so a base moving more often than the window deferred the
resolution for good, and `quietSweep` hid the note on each `sweep-pr`.

The guard now records `conflictWait: { sha, since }` on its first deferral
and bounds the wait at `dispatch.pendingDueMinutes` from it. The key is the
head, so a push restarts the window; a clock that cannot be read, or one
left by another head, resolves at once. `overdue` stays as the Pending
path's shortcut: it fires before `reconcile`'s `dueStep` can hand a deferred
conflict back as "the PR has not moved". The record renders a line for the
wait, which is otherwise invisible while `quietSweep` is silencing the note.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZ37KBTSFa8KBNf76f
`gather` read `repos.getCommit` twice, fifteen lines apart, digging the same
`commit.committer.date` out behind the same try/catch: the head's, for the
author at the repair cap, and the base tip's, for the conflict window.
`commitFacts` returns both fields, or nulls when the read fails, and each
caller keeps the comment that says what its null means.

No behaviour change: the same condition gates each read, the author keeps
its committer fallback, and a throw still leaves nulls.

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

Copy link
Copy Markdown
Contributor

Both findings from the adversarial review are built, on be247ba. The branch already held main's tip, so there was no merge.

Adopted — the wait has no bound on an Awaiting PR (418240a). Confirmed by reading it. The guard now keeps its own clock, conflictWait: { sha, since } in the record, bounded at dispatch.pendingDueMinutes and keyed by the head. The reasoning is in the thread and the body's new Notes.

Adopted — a second committer-date read beside the first (be247ba). One commitFacts(gh, { owner, repo }, ref) serves both, returning { author, committedAt }: the head read wants the author too.

Body refreshed — its bound bullet promised what the code did not do. 446 tests pass, two new. Lean gate green. Security review, triggered by dispatcher/: no findings. docs/why.md carries the failure the bound prevents.

🤖 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 Nov 25, 2026

@sydevs-dispatcher sydevs-dispatcher Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is

@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
@Ardnived
Ardnived added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 25, 2026
@Ardnived
Ardnived enabled auto-merge November 25, 2026 22:16
Three conflicts, all from #320 landing on main:

- dispatcher/gather.mjs: #320 widened the head-commit read to a stood-down
  repair; this branch folded that read into `commitFacts`. Kept both — the
  helper, called under the widened condition.
- dispatcher/test/decide.test.mjs: both sides appended a suite at the end of
  the file. Kept both suites.
- loop-config.json: #320 cut the dispatch `$comment` to one line, which is
  what it set out to do, and the three-homes rule wants. Took main's line;
  `conflictQuietMinutes` keeps its story in docs/why.md.

dispatcher/test: 453 pass. Lean gate green.

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

Copy link
Copy Markdown
Contributor

Merged main in at 5755466. Three conflicts, all from #320.

node --test dispatcher/test/*.test.mjs: 453 pass. Lean gate green.

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


Generated by Claude Code

@Ardnived
Ardnived added this pull request to the merge queue Nov 25, 2026
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
Merged via the queue into main with commit f83263f Nov 25, 2026
15 checks passed
@Ardnived
Ardnived deleted the claude/conflict-quiet branch November 25, 2026 22:18
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 25, 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.

3 participants