Repository navigation
Description
Part of #2934 (Phase A, task 8).
Blocked by #2942
Context
The red-main controller (#2942) records a red main, files one incident issue and gates doomed proof. What the agents do next is skill logic: several people each run an orchestrator, and all of them will notice the same red main. The maintainer's direction (2026-10-25, on #2934): orchestrators work the incident issue like any other issue. One claims it and owns the fix; all of them collect evidence on it; all of them check for duplicates first.
Today claims are a GitHub assignment plus a claim comment after checking open PRs, and assignment is explicitly not an atomic lock (.agents/skills/work-issue/SKILL.md:80-96). Two orchestrators can claim the same incident within seconds.
Scope
- Detection. Orchestrators read
bun scripts/integrate.ts main-status --json(from ci: record a red main centrally, stop doomed proof and file one incident issue #2942) on a bounded interval and whenever a command exits withmain red at <sha>. - Duplicates. The incident issue is the one named in the record. An orchestrator that finds another open issue for the same failing test links it as a duplicate or related issue on the incident instead of filing a new one.
- Claim. The fix claim is written atomically into the red record (claimant worker and orchestrator ID, renewable term, expiry), then mirrored to the issue's assignment and claim comment. An expired claim can be taken over; the takeover is recorded on the issue.
- Evidence. Every orchestrator may append evidence comments to the incident: reproductions, bisect results, logs, hypotheses ruled out. A fixed comment format lets the owner and the next reader scan them.
- Fix. The claimant opens the fix PR declared with
--fixes-main-run <id>. Other agents may open alternative declared fixes, which ci: record a red main centrally, stop doomed proof and file one incident issue #2942 permits; each names the incident. - Waiting and resuming. Workers whose proof was refused or preempted for red main switch to coding, fast checks or evidence on the incident, and resume proof when
main-statusreports green. - Update the
work-issueskill, its references and any orchestration guidance in the repository accordingly.
Out of scope
- The controller itself (ci: record a red main centrally, stop doomed proof and file one incident issue #2942).
- Local admission and preemption mechanics (Phase A task 5).
- Messaging between agents; all coordination goes through the record and the issue.
Acceptance criteria
- Two simulated orchestrators claiming the same incident concurrently produce exactly one successful claim, using a real concurrent push test on the shared ref.
- An expired claim is taken over and the takeover appears on the issue.
- The skill text tells an agent, step by step, what to do on
main red at <sha>, and how to find, claim, contribute to and resume from an incident. - A dry run against a fixture incident shows a non-claimant posting evidence without opening a second incident.
Verification
Focused tests for the claim, plus a recorded dry run of the skill steps against a fixture record.
Contract impact
None.
Activity
schlessera commentedon Nov 2, 2026
Claimed as part of working epic #2934 end to end (claim token
wi-20261102-fd2d2f21). Order chosen for earliest queue-velocity benefit: #2938+#2939 rulings first (they unlock hosted draft feedback), then the red-main/merge-path chain (#2942, #2940, #2944); #2943, #2941 and #2937 run in parallel since they touch disjoint code. Intended branch:feat/2944-red-main-incident-workflow, after #2942.schlessera commentedon Nov 2, 2026
Implementation is complete on
feat/2944-red-main-incident-workflow(headbd936e693dea504566950b26769cebaba61154e8), based on the #2942 branch atb75fc0986b653ed08958dc43e18184c2db3b2f2a. No PR is open yet: it targetsmainonly once #3279 merges, so this staysblocked/Blocked by #2942.What changed
scripts/red-main.ts: an optional, strictly validatedopen.claim(worker ID, orchestrator ID, claimed/renewed, expiry one hour after renewal,takeover). Records without the field still parse. Transitions:claimFix(refuses a live claim, renews for its owner, takes over an expired one),renewFixClaim,releaseFixClaim.scripts/red-main-incident.ts:claim | renew | release | evidence. It writes the claim through the coordination ref's compare-and-swap, then mirrors it to the assignee and posts one claim or takeover comment, and posts evidence in a fixed format. Evidence kinds: reproduction, bisect, log, ruled-out, related, duplicate, fix-attempt, anddecision --choice fix|revert|uncertainwith a required rationale. It never files an issue.--dry-runworks, and so does--record <fixture>with no GitHub or Git access.integrate.tsis untouched, which keeps it out of ci: restore one recorded merge path and refuse merges with uncovered local skips #2940's areas.work-issuegets a "Main is red" section, a newreferences/red-main.md(15 steps: detect, stop doomed proof, deduplicate, claim or contribute, the claimant's evidence-based fix/revert choice and rationale, declared fix through the normal route, wait and resume), plus a note inci-and-merge.md.docs/decisions/ci-utility.md: "Incident workflow and recovery" under "Red-main record and coordinator", including the 2026-11-02 recovery ruling.32384ccd1fromdocs/2934-conditional-concurrency-ruling. It records the other 2026-11-02 Epic: independent changes land on main concurrently, with only overlapping work serialized #2934 ruling, "Conditional concurrency direction", as the last subsection of "Integration lanes, red-main fixes and hosted draft feedback" indocs/decisions/ci-utility.md. It applied cleanly, and lint,decision-citationsandcheck:prstill pass.Receipts (
bun run test tests/red-main-incident.test.ts, 6 pass)[true, false]. Only the winner mirrors, and the loser getsFix claimed by worker wi-1. Mutation:--forcein place of--force-with-leasefailsEXACTLY_ONE_CLAIM_SUCCEEDS. Restored: green.TAKEOVER_ON_ISSUE. Restored: green.POST /issuesfailsNO_SECOND_INCIDENTand the CLI dry-run test. Restored: green.claimfails the legacy-record test withInvalid red-main fix claim. A fixed-term mutation failsCLAIM_TERM_IS_FIXED. A decision-choice mutation failsDECISION_RECORDS_CHOICE. All restored green.tests/fixtures/red-main-incident/record.json, claimed bywi-20260712-penelope): the non-claimantwi-20260712-telemachusposts oneDRY_RUN POST repos/odysseus/brain-kit/issues/500/commentsas(contributor), with no record write and no issue creation.claimexits 1 withFix claimed by worker wi-20260712-penelope (orchestrator orch-ithaca) until 2026-07-12T01:01:00.000Z; add evidence to incident #500 instead. After expiry,claimrecordstakeoverand mirrorsassigneeandtakeover-comment.bun run check:pr --base origin/feat/2942-red-main-controllerpassed (1132 tests).tsc --noEmitandbun run lintare clean.proof-system classifyreturnsproofSystem: false.To resume after #3279 merges: rebase onto
origin/main(also onto #2940 if it lands first), reruncheck:pr --base origin/main, open the PR withCloses #2944and milestone 0.45.0, runbun scripts/collisions.ts --json --pr <pr>, removeblocked, thenbun scripts/integrate.ts confirm <pr> --issues schlessera/brain-kit#2944.feat(ci): claim the red-main fix atomically and collect incident evid…
fix(ci): narrow the fix-claim liveness check for the typechecker (#2944)
feat(ci): claim the red-main fix atomically and collect incident evid…
fix(ci): narrow the fix-claim liveness check for the typechecker (#2944)
feat(ci): claim the red-main fix atomically and collect incident evid…