Skip to content

Latest commit

 

History

History
168 lines (136 loc) · 7.74 KB

WORKFLOW.md

File metadata and controls

168 lines (136 loc) · 7.74 KB

How work moves in obs-rust

One process for every repo in the org. The code is in workflow/, tested in simulation (uv run -m unittest discover -s tests -t .). The board is the obs-rust Multiview project.

The lifecycle

Triage ──/investigate──▶ Investigating ──/ready──▶ Ready ──Claiming:──▶ In progress
   │                                                 ▲                      │
   └──────────────────────/ready─────────────────────┘                PR opened
                                                                           ▼
            Done ◀──merged── In merge queue ◀──queued── Ready to merge ◀── In review
                                   │                                       ▲
                                   └──ejected──▶ Needs fix ──fixed─────────┘

Side states: Blocked (an open "blocked by" issue, or the claimant's Blocked:), Needs decision (decision-needed, human-review-needed), Stalled (a PR with no activity for 72 hours), Tracker (an issue whose work is in its sub-issues).

The board sync sets every Status from labels, assignees, dependencies and PR state every 30 minutes; nobody edits Status by hand. Priority comes from P0..P3 labels, Size from size:S..size:XL. Created, Updated and Closed are GitHub's built-in dates, for charts.

Definition of Ready

An issue is Ready when it has:

  1. a reproduction or a failing-test sketch (a bug), or a concrete scope (a task);
  2. acceptance criteria: what must be true when it is done;
  3. its dependencies linked as "blocked by", and all of them closed;
  4. no open Decision needed:;
  5. a P0..P3 label and a size: label. An XL issue is split into sub-issues first.

The coordinator checks new issues against this every tick (triage) and comments /ready or /investigate. P0 issues (a red master, a broken release) are always Ready.

Claims

A claim is the issue's assignee. Comment on the issue (first line):

Command Who Effect
Claiming: <plan> anyone, on a Ready issue; a maintainer on any issue not under investigation assigns you (a maintainer's claim also labels it ready)
Claiming: investigation anyone, on any issue assigns you, labels needs-investigation
/ready the claimant or a maintainer labels ready (the claim continues)
/investigate the claimant or a maintainer back to needs-investigation
Releasing <item> the claimant unassigns
Handing <item> over to @x, /handoff @x, It's yours, @x the claimant reassigns to x
Taking over stale claim from @x anyone takes a stale claim
/reassign @x maintainers moves any claim
Blocked: <reason> the claimant claim-blocked, 7-day timer
Decision needed: <question> (any line) anyone decision-needed
Decided: <answer> maintainers clears the decision, resumes a blocked claim

A claim goes stale after 24 hours without progress (8 hours on P0): no comment from the claimant and no commit, comment or review on their open PR that references the issue. The hourly sweep unassigns it. Refused commands get one reply that mentions only the person refused.

Every coordinator tick also runs uv run -m workflow.claim_bot sweep --org obs-rust. It handles claims in repos that have no caller workflow, within one tick, and covers for scheduled runs that GitHub skips or delays: in one case obs-studio's hourly sweep went 4 hours without running. A repo with a caller sees only no-op replays.

A repo turns claims on with this workflow (.github/workflows/claim-bot.yaml):

name: Claim bot
on:
  issue_comment:
    types: [created]
  pull_request:
    types: [opened, edited, synchronize, ready_for_review, reopened]
  schedule:
    - cron: "23 * * * *"
  workflow_dispatch:
permissions:
  issues: write
  pull-requests: read
jobs:
  claim:
    uses: obs-rust/.github/.github/workflows/claim-bot.yml@master

Roles

Before opening a PR and again before enabling auto-merge, workers re-read all issues the PR promises to close, including their latest claim comments. Each must be open, Ready (or P0), and actively claimed by the PR author, with an accepted Claiming: comment on that exact issue. An assignee alone is insufficient when multiple sessions share an account. Use Refs for partial work and resolve duplicate/closed-issue references before continuing.

The reusable claim bot handles PR opened/edited/synchronize/ready-for-review and reopened events. A closing reference to a closed, unready, unclaimed or conflicting issue fails that job, adds claim-conflict, and posts one comment. Correct the body or issue state and synchronize/reopen the PR to recheck; a successful recheck clears the label. Documentation-only and CI/test-only path changes are exempt. Refs does not promise closure and is not checked. GitHub links issues only from closing keywords in the PR body, never the title. When the title has Fixes #N and the body names neither Fixes #N nor Refs #N, the bot posts one comment (and a check warning) asking for the body line, removes it once the body is fixed, and checks the claim on #N as if the body closed it (#38). The coordinator also rechecks live issue state before recommending enqueue, so a closure or reassignment after the PR event cannot silently pass. Callers must subscribe to the PR events above; a caller that only subscribes to issue comments still gets issue claims, but no PR event check.

Workers take a Ready issue, claim it, open a PR (a draft as soon as RED exists), get it green and into the merge queue, then stop and move on. Ejections, rebases and CI repairs after that are the coordinator's.

The coordinator runs uv run -m workflow.coordinator at the start of every tick and clears the list top to bottom. Each kind comes with its instructions:

fix-master → rerun-master → requeue → fix-ci → enqueue → rebase → review → decide → triage → stalled → investigating → escalated

Several coordinators can run at once. Before acting on a task:

uv run -m workflow.coordinator take review obs-studio 2272 --owner "$COORDINATOR_ID"
# exit 0: yours. exit 1: another coordinator has it; skip it.
uv run -m workflow.coordinator done review obs-studio 2272 --owner "$COORDINATOR_ID"

A lease is a git ref in this repo; GitHub creates a ref atomically, so only one taker wins. It lapses after 2 hours. The list hides tasks others hold.

Decisions are posted

When the maintainer asks an agent (worker or coordinator) to make a decision, settle a question or "come up with the best answer", that request includes posting it. A decision kept in the chat unblocks nothing. In the same turn:

  1. Post it as a Decided: <answer> comment on the issue it settles, with the reasons and any measurements. The claim bot then clears decision-needed and resumes a blocked claim.
  2. Comment on every open PR and issue in flight that the decision changes, saying what each one now has to do and linking the Decided: comment.

Ask before posting only when the maintainer explicitly said not to post, or when the decision would publish something private (see SECURITY.md).

Simulation

Every rule runs against a SQLite stand-in for GitHub and its Actions (workflow/sim.py): comments trigger the claim bot, a fake clock fires the hourly sweep and the 30-minute board sync. The same entry points run in production and in simulation:

uv run -m workflow.claim_bot sweep --sim world.db
uv run -m workflow.board_sync --sim world.db
uv run -m workflow.coordinator --sim world.db