Skip to content

Issue-240: Put the per-ticket pipeline in the repo: red/blue reviews and board status - #243

Merged
JoottunAtish merged 3 commits into
devfrom
feat/240-ticket-pipeline
Dec 1, 2026
Merged

JoottunAtish merged 3 commits into
devfrom
feat/240-ticket-pipeline

Conversation

@JoottunAtish

@JoottunAtish JoottunAtish commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #240

After merge: run /sx-ticket-run 240 or gh issue close 240. PRs into dev do not close issues.

Summary

Moves the per-ticket pipeline, which lived only in one person's private Claude memory, into the repo, so every session follows it and the project board stays correct.

  • New /sx-ticket-run <n> [--no-merge] (.claude/skills/sx-ticket-run/SKILL.md). It takes an issue that is in Ready through these steps: plan → independent red and blue reviews of the plan → plan v2 → implement in a worktree on a branch linked to the issue → independent red and blue code review → PR into dev → second review → merge (only when GitHub allows) → close.
    • Board: it sets In progress at pick-up and In review when the PR opens. Closing the issue moves it to Done through the project's "Item closed" workflow. It reads the status back after every set. It stops if a person moved the ticket, if the ticket isn't on the board, or if the token lacks the project scope. It never uses item-add.
    • Linking: the branch is created with gh issue develop --base dev. The skill records the raw closingIssuesReferences output, and says "not linked: link by hand" when it is empty.
    • Merge gate, from GitHub's own fields: APPROVED, CLEAN or HAS_HOOKS, no unresolved threads, and the latest approval is on headRefOid. It then runs gh pr merge --match-head-commit, with no strategy flag and never --admin. If the merge queue holds the PR, the skill stops at In review, and a rerun closes the ticket.
    • Safety: disable-model-invocation: true, so the skill runs only when a person types the command. It never creates issues, never assigns, never touches main, works only in the worktree using literal absolute paths, runs heavy agents one at a time, and stops when checks still fail after one fix round.
    • Resume: it works from durable state only (PR, branch, worktree), and reuses an existing branch or PR.
  • sx-implement: adds one pointer line ("For a GitHub issue, use /sx-ticket-run <n>"). It still never pushes.
  • sx-ticket: adds the full Status option ids and a "Next" note (the lead moves a ticket to Ready; /sx-ticket-run takes it from there).
  • CLAUDE.md: adds one row in "Agents and skills".
  • CONTRIBUTING.md:3: now says main is the default branch (frozen, D-42), all work goes through dev, and closing keywords in PRs into dev don't close issues. Lines 26 and 30 are left for the follow-up.

Why the skill sets status itself

The board has no automation for In progress. PRs into dev stopped linking around 30 Nov: #233 and #235 linked, and #233 closed #202, but #237 onwards don't. That fits dev no longer being the default branch, and closing keywords act only on PRs into the default branch. So Closes #n neither links nor closes, and the "Pull request linked to issue" workflow never fires.

Spec-gap choices

  • Code-stage blue (qa-expert) checks the diff on its own against plan v2 and each Done-when line. It does not verify red's findings, which keeps the two independent. The private memory had blue verifying red.
  • In progress is set at pick-up, not at implement. Planning is work, and a ticket left in Ready invites a second session to take it.
  • The branch prefix comes from the issue Kind (chore → chore/). This PR's own branch, feat/240-…, predates that rule.
  • The Review record is added to this body only after the second review, so the second reviewer doesn't anchor on earlier verdicts.

Test evidence (local)

This change is a skill (instructions), so there is no code to unit-test. Static checks:

  • The five Status option ids, the field id and the project id are identical in sx-ticket-run and sx-ticket.
  • The frontmatter parses as YAML.
  • git diff --stat origin/dev lists only the 4 files (+242/−1).
  • There are no personal names or session ids in the new text.
  • Every read-only command in the skill was run against the live repo and works in Git Bash: the board GraphQL query, blocked_by, gh issue develop --list, git ls-remote, the PR search, the reviews/commit jq, the thread count and closedByPullRequestsReferences.

Done-when evidence (split, for the lead to accept or change):

  1. This PR is the first test of a gh issue develop branch. Result: not linked. gh pr view 243 --json closingIssuesReferences gives [], and Put the per-ticket pipeline in the repo: red/blue reviews and board status #240's closedByPullRequestsReferences gives []. A branch created from the issue does not link a PR into dev either. Not linked: link by hand in the issue sidebar → Development. The board is still correct, because this skill sets In review itself (read back: In review) and closes the issue explicitly after merge.
  2. Before merge: a fresh session started in this worktree, following only the repo skill, runs /sx-ticket-run 240 --no-merge on the resume path. Its status read-backs will be added here.
  3. The full Ready → In progress → In review → Done run happens on the next ticket the lead moves to Ready, and its read-backs go in a comment on Put the per-ticket pipeline in the repo: red/blue reviews and board status #240. If the lead wants a throwaway test ticket instead, it goes through /sx-ticket.

Review record

Plan: red 14 findings, blue 26 items. Plan v1 → v2: 21 rows accepted, 1 partly, 0 rejected
id finding verdict change v1 → v2
R1/B14 dev has a merge queue, so gh pr merge only queues accept no strategy flag; stop at In review if the PR is not MERGED; a rerun closes it
R2/B15 the ruleset doesn't dismiss stale reviews or require last-push approval; it does require resolved threads accept gate built from GitHub fields; approved commit == headRefOid; --match-head-commit
R3 #241 will touch the pipeline skill accept briefs hold only ticket, plan or diff, fragments, worktree path and role
R4 sx-pr-review would check out the branch a second time accept review the existing worktree or gh pr diff
R5 resume relied on the session scratchpad accept resume from durable state only
R6 unlinked PR or branch, human status changes accept search for existing PRs and branches and reuse them; re-read status before each set
R7/B24 Done-when proof too weak partly split proof (see Test evidence); the lead decides
R8/B19 the skill is found only from a checkout that contains it accept start from dev or the ticket worktree
R9 heavy agents ran in parallel accept agents that run tests or a browser run one at a time
R10 the sx-implement pointer would make it push accept pointer only
R11/B12 the Plan agent can't write accept the main session saves outputs; experiment folders per side
R12 branch prefix accept prefix from Kind
R13/B21 ticket not on the board accept read-only item lookup; stop; never item-add
R14/B13 relative worktree paths accept absolute root from git-common-dir
B16, B17, B20, B22, B23, B25, B26 after-merge line, local commit before review, blocked_by check, stale "no Actions minutes", body size, link evidence, record contents accept applied
Code, red/blue (3815c9d): red 13 findings (1 blocking), blue 4 fixes; all accepted, fixed in b586142
  • Blocking: shell variables don't carry over between Bash calls, and git -C "" runs in the current directory. Fixed: literal absolute paths everywhere.
  • disable-model-invocation: true added; reuse of an existing PR or branch; the record is added only after the second review; red never runs tests; stop when checks fail after one fix round; project scope check, with a GraphQL errors field treated as a stop; exact merge gate (CLEAN or HAS_HOOKS, the approved-commit jq); experiments kept outside the record; check-ignore with -C; null item id → stop; status must match the one each step expects.
Second review (pr-reviewer, b586142): request changes, 2 blocking, 6 should, 5 nits; all accepted, fixed in 1efe742
  • Blocking: the stop rule for a closed issue not in Done blocked setting Done in step 9 (now applies only in step 0). The merged-PR shortcut could close a reopened ticket (now only when the issue is OPEN and In review and the newest PR on the ticket's branch is merged).
  • Should:
  • Nits: -R on every gh call; exclude line before worktree add; stricter-than-ruleset note.

Follow-up drafts (not created)

  • Docs disagree with the ruleset (should-fix, before the next contributor onboarding). CONTRIBUTING.md:26,30 and CLAUDE.md:38 say approvals need someone other than the last pusher and that new pushes dismiss approvals. The dev ruleset has require_last_push_approval: false and dismiss_stale_reviews_on_push: false.
  • Local memory for implementer agents #241 (agent memory) adds its reviewer-independence rule and worktree note to this skill. It is built on this branch.

🤖 Generated with Claude Code

JoottunAtish and others added 2 commits December 1, 2026 14:36
New skill .claude/skills/sx-ticket-run takes an issue from Ready to Done:
plan, independent red/blue reviews of plan and code, implement in a
worktree on a branch linked with gh issue develop, PR into dev, second
review, merge only when GitHub allows (--match-head-commit, never
--admin), close. It sets In progress and In review itself and checks the
PR-issue link, because closing keywords do not act on PRs into dev.

sx-implement points tickets to it; sx-ticket lists all Status option ids
and a "Next" note; CLAUDE.md gets a row in "Agents and skills".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Literal absolute paths instead of shell variables across calls; user-only
invocation; resume and reuse of existing branch, PR or merged PR; Review
record added to the PR only after the second review; red never runs
tests; stop on failing checks; project-scope and GraphQL error checks;
exact merge gate; experiments outside the record; expected-status check
before each board set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Step 0 resolves the root, checks the assignee and the branch author,
resumes only an open PR (more than one: stop), takes the merged-PR
shortcut only for the ticket's newest PR, and never closes a reopened
ticket because of an old PR. A resume table replaces "first missing
output". The CLOSED-not-Done stop applies only in step 0; step 9.6 sets
Done after the close. pr-body.md has a literal scratchpad path, every
gh pr/issue command takes -R, the exclude line runs before worktree add,
and the approval-commit check is marked as stricter than the ruleset.

CONTRIBUTING.md: main is the default branch; closing keywords in PRs
into dev do not close issues.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoottunAtish
JoottunAtish merged commit e84813c into dev Dec 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant