Skip to content

ci: work a red-main incident through one claimed issue that every orchestrator can add evidence to #2944

Closed

Description

@schlessera

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 with main 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-status reports green.
  • Update the work-issue skill, its references and any orchestration guidance in the repository accordingly.

Out of scope

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

  1. added
    type: choreTooling, CI, release plumbing, dependencies.
    area: ciCI workflows, the gates they run, release scripts, packaging.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Oct 25, 2026
  2. added this to the 0.45.0 milestone on Oct 25, 2026
  3. self-assigned this
    on Nov 2, 2026
  4. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    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.

  5. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Implementation is complete on feat/2944-red-main-incident-workflow (head bd936e693dea504566950b26769cebaba61154e8), based on the #2942 branch at b75fc0986b653ed08958dc43e18184c2db3b2f2a. No PR is open yet: it targets main only once #3279 merges, so this stays blocked / Blocked by #2942.

    What changed

    • scripts/red-main.ts: an optional, strictly validated open.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, and decision --choice fix|revert|uncertain with a required rationale. It never files an issue. --dry-run works, and so does --record <fixture> with no GitHub or Git access. integrate.ts is untouched, which keeps it out of ci: restore one recorded merge path and refuse merges with uncovered local skips #2940's areas.
    • The coordinator's incident body now says "fix or targeted revert PR", and names the claim, decision and evidence commands.
    • Skill: work-issue gets a "Main is red" section, a new references/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 in ci-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.
    • Carried in: cherry-picked 32384ccd1 from docs/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" in docs/decisions/ci-utility.md. It applied cleanly, and lint, decision-citations and check:pr still pass.

    Receipts (bun run test tests/red-main-incident.test.ts, 6 pass)

    • Real concurrent push on a shared bare remote: [true, false]. Only the winner mirrors, and the loser gets Fix claimed by worker wi-1. Mutation: --force in place of --force-with-lease fails EXACTLY_ONE_CLAIM_SUCCEEDS. Restored: green.
    • Expired claim taken over, with the takeover comment on the fake issue API. Mutation: dropping the takeover line fails TAKEOVER_ON_ISSUE. Restored: green.
    • Evidence opens nothing. Mutation: an extra POST /issues fails NO_SECOND_INCIDENT and the CLI dry-run test. Restored: green.
    • Backward compatibility. Mutation: always validating claim fails the legacy-record test with Invalid red-main fix claim. A fixed-term mutation fails CLAIM_TERM_IS_FIXED. A decision-choice mutation fails DECISION_RECORDS_CHOICE. All restored green.
    • Fixture dry run (tests/fixtures/red-main-incident/record.json, claimed by wi-20260712-penelope): the non-claimant wi-20260712-telemachus posts one DRY_RUN POST repos/odysseus/brain-kit/issues/500/comments as (contributor), with no record write and no issue creation. claim exits 1 with Fix claimed by worker wi-20260712-penelope (orchestrator orch-ithaca) until 2026-07-12T01:01:00.000Z; add evidence to incident #500 instead. After expiry, claim records takeover and mirrors assignee and takeover-comment.
    • bun run check:pr --base origin/feat/2942-red-main-controller passed (1132 tests). tsc --noEmit and bun run lint are clean. proof-system classify returns proofSystem: false.

    To resume after #3279 merges: rebase onto origin/main (also onto #2940 if it lands first), rerun check:pr --base origin/main, open the PR with Closes #2944 and milestone 0.45.0, run bun scripts/collisions.ts --json --pr <pr>, remove blocked, then bun scripts/integrate.ts confirm <pr> --issues schlessera/brain-kit#2944.

  6. removed
    blockedWaiting on another issue or an upstream dependency. Say which in the body.
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ciCI workflows, the gates they run, release scripts, packaging.priority: p1Scheduled into the current or next milestone.type: choreTooling, CI, release plumbing, dependencies.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions