Repository navigation
feat(loop): the dispatcher, dark (4/4) - #69
Merged
Merged
Conversation
This was referenced Sep 8, 2026
Ardnived
force-pushed
the
claude/loop-config
branch
from
September 8, 2026 16:57
042b567 to
fcb78ca
Compare
Ardnived
force-pushed
the
claude/loop-dispatcher
branch
2 times, most recently
from
September 8, 2026 17:26
ca5b8f3 to
083ce18
Compare
Ardnived
force-pushed
the
claude/loop-config
branch
from
September 8, 2026 17:28
01e15c1 to
1087dc3
Compare
Ardnived
force-pushed
the
claude/loop-dispatcher
branch
from
September 8, 2026 17:28
083ce18 to
ffdc5fe
Compare
Ardnived
force-pushed
the
claude/loop-config
branch
from
September 8, 2026 18:35
1087dc3 to
237d3a9
Compare
… the mechanical work A reusable GitHub Actions workflow plus the `dispatcher/` modules it runs from a checkout of this repo's main. Every event in the five repos reaches it through a thin caller. It does, with no tokens, everything an event determines: - classify: verbs (`@sydevs-bot implement|revise|split|answer` on issues, `address|review` on PRs, case-insensitive), the respondTo allowlist plus write access for humans, the bot-actor filter with its one exception (the adversarial review), stale-SHA CI events; - lock and fire: apply `bot:working`, write the status comment, POST the dispatch record (a pointer only) to the handler's routine; on 429/400/5xx release the lock, mark `stuck`, record the retry window; - mechanical writes: board Status (Proposed/Revising/Approved/Done), `awaiting` as the single writer, `blocked` from native relationships and `Blocked by:`/`Re-check:` markers, mark-ready after the critic (or under the size threshold), reviewer request at ready, squash-merge on the merge gate, Sentry resolve on merge, dependents on close, the conflict scan, fix-ci counting, WIP-capped implement queued at Approved and drained oldest-verb-first; - the sweeper: per-repo every 30 minutes — retries whose window passed, locks past their deadline (re-fire, then hand over to awaiting after maxAttempts), missed rechecks, orphaned drafts, awaiting drift; and the journal day and title in the journal repo. `decide.mjs` is pure and tested; `act.test.mjs` runs the whole path over a fake Octokit, dry-run and live, including a 429. `merge-gate.mjs` is imported unchanged as the one definition of green and mergeable; the dispatcher's own check runs are excluded from it (`ci.ignoreCheckNames`), which would otherwise deadlock a draft. Nothing runs until a caller selects it: BOT_DISPATCH is `off`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… BOT_DISPATCH `off` runs the state machine as before; `dry` runs the dispatcher logging what it would do and writing nothing; `on` runs it for real; `migrating` runs neither. The gate is in the caller because a repo can always read its own variables. Events widened to what the dispatcher needs: edited and unlabeled issues, review comments and threads, workflow_run for our CI, check_suite for app checks, status for Railway, a 30-minute sweep, and this repo's two journal-day crons at 00:05 America/Vancouver. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
fire.mjs keys ROUTINE_TOKEN_<REPO> and ROUTINE_ID_<REPO> (fallback dispatch.routines[repo]); dispatcher.yml carries five secrets and five ids instead of twelve. The record's handler field selects the skill. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…SYDEVS_BOT_PAT The implement verb fires at once — the human who types it is the throttle (why: docs/why.md#there-is-no-wip-cap). The drain path and the queued comment are gone. The sweeper now keeps a tally block in the day issue's body (per handler, per repo, busiest items) for the weekly reflect to report usage. The dispatcher's token secret is renamed from ADD_TO_PROJECT_PAT. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Ardnived
force-pushed
the
claude/loop-dispatcher
branch
from
September 8, 2026 18:35
996eca9 to
6cec14b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fourth of four, stacked on #68. The GitHub Actions dispatcher and this repo's caller. Dark: the org variable
BOT_DISPATCHisoff, so the caller still runsstate-machine.ymland the dispatcher never executes. Setting it todryruns the dispatcher logging its plan and writing nothing;onruns it for real.Design:
~/.claude/plans/let-s-consider-and-create-starry-church.md(rev. 3), Part A.Shape
dispatcher.yml(reusable) → jobresolve(event → items) → jobact(one matrix leg per item,concurrency: dispatch-<repo>-<number>, re-derives the decision from live GitHub state) → jobjournal(journal repo's schedule only). Code indispatcher/, a sibling ofworkflow/so the plugin validator ignores it and "nothing underworkflow/fetches" stays true.resolve.mjsgather.mjsmerge-gate.mjsunchangeddecide.mjsevaluatePrand every event row; 24 testsapply.mjsfire.mjs/fireclient and the dispatch record (a pointer;lockincluded)record.mjsprojects.mjsjournal.mjssweep.mjsverbs.mjs,markers.mjsRules worth checking against the plan
evaluatePrstep 5) unless the PR is underreview.skipWhen.resolve-conflictsfirst, merge on the next green (step 3 precedes step 6).stuck; the sweeper retries; aftermaxAttempts→awaiting+ comment.ci.ignoreCheckNamesexcludes the dispatcher's own check run (L11) — theact.testproves anin_progress"dispatch / act" run does not block a draft.Verification
node --test dispatcher/test/*.test.mjs— 34 pass (verbs 5, markers 3, decide 21, end-to-end over a fake Octokit 5: resolve, dry-run, live implement, 429, critic/threshold).claude plugin validate ./workflow --strict— passed (dispatcher is outside the plugin).run:step interpolatesgithub.event.*.Not in this PR
The four product-repo callers (one PR each, to open after this merges — they reference
dispatcher.yml@main), the five routine tokens (ROUTINE_TOKEN_<REPO>org secrets), the board setup (UI),SENTRY_CLAUDE_WORKFLOW_TOKENas an org secret.2026-09-08 revision.
fire.mjskeys the token and routine id by repo only (ROUTINE_TOKEN_<REPO>,ROUTINE_ID_<REPO>, fallbackdispatch.routines[repo]);dispatcher.ymldeclares five secrets and five ids instead of twelve. 34 tests pass.2026-09-08, later. No WIP cap: the implement verb fires at once; the drain path and the queued comment are gone. The sweeper keeps a
<!-- tally -->block in the day issue's body (per handler, per repo, busiest items) for reflect's usage report. The token secret isSYDEVS_BOT_PAT;PUT …/mergeneeds its Contents:write. 35 tests pass.