Closeout

<!-- Synced from glaude. Do not edit in project repos. --

rbriski updated 4mo ago
Claude CodeGeneric
View source ↗
<!-- Synced from glaude. Do not edit in project repos. -->
# /closeout — Complete Ticket

Finalize work on a ticket: validate, create PR, close beads, and make compounding updates.

## Usage

/closeout


**Iterative:** Run `/closeout` multiple times as needed. Each push may trigger new CodeRabbit comments. The workflow is:

/closeout -> push -> read comments immediately -> fix -> push -> /closeout again


Continue until PR is approved or all remaining comments are documented as false positives.

**Non-blocking:** After each push, start reading CodeRabbit comments right away — don't wait for CI. Check CI status with a lightweight `gh run list` when needed. Never use `gh run watch` (it blocks and dumps huge output into context).

## What It Does

### 1. Final Validation

Run the project's full validation suite (discover commands per `/validate`).

If validation fails, do not proceed — fix issues first.

### 2. Verify All Beads Complete

Check for remaining open tasks:

```bash
bd show <epic-id>

All child tasks should be closed except Testing & Compounding.

3. Push and Create PR

git push -u origin HEAD

Create PR with:

## Summary
- Brief description of changes
- Link to ticket: <TICKET-ID>

## Changes
- List of key changes

## Testing
- How it was tested
- Any manual verification steps

## Compounding Update
- What documentation/rules were updated

4. CI and CodeRabbit Review (Non-Blocking)

After pushing, do NOT block-wait on CI. Avoid gh run watch — it wastes context and time.

Instead, work in parallel:

  1. Start reading CodeRabbit comments immediately — don't wait for CI to finish
  2. Check CI later with a lightweight command when you need the result:
    gh run list --branch <branch> --limit 1 --json status,conclusion
    
  3. If CI fails, fix it. If CodeRabbit has comments, address them. Push once with both fixes if possible.

5. Address PR Review Comments

NEVER SILENTLY DEFER ANYTHING. Every review comment is either fixed inline or documented as a false positive. There is no "Known/Deferred" category. There is no "will fix later." If a comment identifies a real issue, fix it now — even if it wasn't part of the original ticket scope. If the fix is truly massive (large architectural change), discuss with the user explicitly before proceeding. Do not unilaterally decide to defer.

Recommended: Use the pr-reviewer agent if available:

Task tool: subagent_type=pr-reviewer
prompt: "Review PR #<number> comments. Fix all real issues, document false positives, resolve all threads."

Manual process (if not using agent):

Step 1: Categorize Each Comment

Category Action
Fix Fix now, commit, resolve thread
False Positive Document why it's wrong, resolve thread

There are exactly two categories. Every comment is either fixed or documented as a false positive. No deferrals, no "known issues", no "nice to have", no follow-up tickets.

Step 2: Fix All Issues

For each comment that isn't a false positive:

  1. Make the fix (including nitpicks, refactors, and style issues)
  2. Add tests if the fix is non-trivial
  3. Commit: git commit -m "<TICKET-ID>: Address PR review feedback"
  4. Push: git push

Step 3: Document False Positives

For each false positive, add a brief reply explaining why the code is correct.

Update .claude/rules/ with the pattern if the false positive reveals a non-obvious convention.

Step 4: Post Summary Comment (REQUIRED)

## PR Review Summary

### Fixed (X items)
| File | Line | Issue | Commit |
|------|------|-------|--------|
| `file.py` | 123 | Description | abc1234 |

### False Positives (X items)
| File | Line | Issue | Reason |
|------|------|-------|--------|
| `file.py` | 456 | Description | Why it's correct |

Use gh pr comment <PR_NUMBER> --body "..." to post the comment.

Step 5: Resolve All PR Review Threads (REQUIRED)

After posting the summary comment, resolve ALL review threads using GitHub GraphQL API:

# Get all unresolved thread IDs
gh api graphql -f query='
{
  repository(owner: "<OWNER>", name: "<REPO>") {
    pullRequest(number: <PR_NUMBER>) {
      reviewThreads(first: 100) {
        nodes {
          id
          isResolved
          path
          line
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | .id'
# Resolve each thread
for thread_id in PRRT_xxx PRRT_yyy PRRT_zzz; do
  gh api graphql -f query="mutation {
    resolveReviewThread(input: {threadId: \"$thread_id\"}) {
      thread { isResolved }
    }
  }"
done

Every thread must be resolved — even false positives.

6. Compounding Update (Required)

Every ticket must include at least one compounding update:

Type Location
New pattern discovered .claude/rules/
Common mistake found Add to relevant rules file
Useful convention CLAUDE.md
Architecture decision docs/
Migration gotcha Project-specific docs

7. Update Plan Status

Mark the plan as complete:

## Status: Complete

**PR:** #123
**Merged:** YYYY-MM-DD

8. Close Beads Epic

# Close remaining tasks
bd close <testing-id>
bd close <compounding-id>

# Close the epic
bd close <epic-id>

# Sync
bd sync

9. Branch Cleanup (if applicable)

If using worktrees:

git worktree remove <worktree-path>
git branch -d <feature-branch>

Or if using bark:

bark cleanup feature/<TICKET-ID>-<short-name>

10. Update Issue Tracker

Add final comment to the ticket:

  • Summary of what was done
  • Link to plan (if applicable)
  • Link to PR

Definition of Done Checklist

Before closeout is complete, verify:

  • Code works and is minimal
  • Project validation passes
  • Bug fix -> regression test added
  • At least one compounding update made
  • [

Maintain Closeout?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

[Closeout on getagentictools](https://getagentictools.com/loops/rbriski-closeout-complete-ticket?ref=badge)