Skip to content

feat(skill/feature): add Phase 0.0 issue claim-on-start#3639

Merged
PierreBrisorgueil merged 2 commits intomasterfrom
feat/feature-skill-claim-on-start
May 10, 2026
Merged

feat(skill/feature): add Phase 0.0 issue claim-on-start#3639
PierreBrisorgueil merged 2 commits intomasterfrom
feat/feature-skill-claim-on-start

Conversation

@PierreBrisorgueil
Copy link
Copy Markdown
Contributor

@PierreBrisorgueil PierreBrisorgueil commented May 10, 2026

Summary

  • Inserts Phase 0.0 — Issue Claim before Phase 0 in the /feature skill, triggered when invoked with a GitHub issue number (/feature #N)
  • Detects cross-session agent collisions via assignee check + WIP comment timestamp (<24h stale rule); STOP-on-collision, resume-silently when already own assignee
  • Gracefully skips for freeform invocations (/feature <spec>) and surfaces errors on closed issues or gh failures

Details

Two gh commands on claim: gh issue edit #N --add-assignee @me + gh issue comment #N --body "WIP — ...". Detection priority: resume-own > claim > block-on-collision.

Refs pierreb-projects/infra#28

Test plan

  • Invoke /feature #N (unassigned issue) → skill runs gh issue view, finds no assignee/WIP, proceeds to claim both commands
  • Invoke /feature #N (issue assigned to someone else) → skill STOPs and asks user before continuing
  • Invoke /feature #N (fresh WIP comment by other user, <24h) → skill STOPs with collision warning
  • Invoke /feature <freeform> → Phase 0.0 block is skipped entirely, no gh calls made
  • Invoke /feature #N (already assigned to @me) → continues silently (resume path)

Summary by CodeRabbit

  • Documentation
    • Enhanced feature workflow to include an issue claiming phase when invoking with a GitHub issue number. The new phase handles assignment detection, collision prevention with user confirmation, and automatic issue assignment with work-in-progress tracking metadata.

Review Change Stack

Detects cross-session agent collisions on GitHub issues by claiming via
assignee + timestamped WIP comment when /feature is invoked with #N.
Stale-detection rule (>24h) lets reclaim with explicit user confirmation.

Refs pierreb-projects/infra#28
Code-quality review feedback applied:
- Reorder detection table: @me self-resume cases short-circuit first
- Add gh issue view failure-mode handling (STOP on error)
- Replace $RANDOM with uuidgen for session ID entropy
- Clarify em-dash WIP marker (canonical, hyphen variants ignored)
- Clarify branch TBD follow-up is best-effort manual
- Drop misleading "cache per session" wording

Refs pierreb-projects/infra#28
Copilot AI review requested due to automatic review settings May 10, 2026 11:11
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The /feature skill document now adds a new Phase 0.0 "Issue Claim" workflow. When invoked with a GitHub issue number (/feature #N``), this phase retrieves issue state, detects assignment collisions, optionally stops for user confirmation, and upon proceeding assigns the issue to the current user and posts a timestamped WIP comment before transitioning to existing scope analysis.

Changes

Issue Claim Phase Documentation

Layer / File(s) Summary
Issue Claim Workflow Definition
.claude/skills/feature/SKILL.md
Adds Phase 0.0 section documenting the issue claim flow: view issue state via gh, detect collision using assignees and canonical WIP — comments, handle assignment/freshness cases with conditional user confirmation, execute claim via issue assignment and WIP comment posting with UTC timestamp and UUID fragment, then transition to Phase 0 scope analysis.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

Feat

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding a new Phase 0.0 issue claim feature to the /feature skill.
Description check ✅ Passed The PR description covers summary, details, and test plan comprehensively, but is missing several required template sections like scope, validation checks, and guardrails assessment.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/feature-skill-claim-on-start

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PierreBrisorgueil PierreBrisorgueil merged commit 3eee971 into master May 10, 2026
3 of 4 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “Issue Claim” pre-phase to the /feature skill so that /feature #N can claim ownership (assignee + WIP comment) and detect potential cross-session collisions before proceeding to normal scope analysis.

Changes:

  • Introduces Phase 0.0 to read issue state via gh, detect collisions using assignees + recent WIP — comment, and STOP for explicit user confirmation on conflicts.
  • Adds a standardized claim procedure (assign to @me + post a timestamped WIP comment) before continuing to Phase 0.
  • Clarifies skip behavior for freeform invocations (/feature <spec>), and STOP behavior for closed issues / gh failures.

Comment on lines +21 to +23
```bash
gh issue view <N> --json number,title,state,assignees,comments
```
Comment on lines +31 to +40
Inspect `assignees[]` and the most recent comment whose body starts with `WIP —` (em dash U+2014, not a hyphen — only the canonical em-dash form is detected; hyphen variants `WIP -` are silently ignored):

| Situation | Action |
|-----------|--------|
| `assignees` contains `@me` (current GitHub user) | Continue silently — resuming own work |
| Most recent `WIP —` comment by `@me` (any age) | Continue silently — resuming own work |
| `assignees` empty AND no `WIP —` comment from anyone | Proceed to claim (step 3) |
| `assignees` contains user ≠ `@me` | **STOP** — surface "Issue #N already assigned to <user>. Take over? (y/N)". Wait for explicit user confirmation. |
| Most recent `WIP —` comment by user ≠ `@me` AND `<24h` old | **STOP** — surface "Issue #N has fresh WIP from <user> (started <ts>). Collision likely. Continue anyway? (y/N)". Wait. |
| Most recent `WIP —` comment by user ≠ `@me` AND `>24h` old | Stale claim — surface "Issue #N has stale WIP from <user> (started <ts>, >24h). Reclaim? (y/N)". Wait. |
Comment on lines +31 to +43
Inspect `assignees[]` and the most recent comment whose body starts with `WIP —` (em dash U+2014, not a hyphen — only the canonical em-dash form is detected; hyphen variants `WIP -` are silently ignored):

| Situation | Action |
|-----------|--------|
| `assignees` contains `@me` (current GitHub user) | Continue silently — resuming own work |
| Most recent `WIP —` comment by `@me` (any age) | Continue silently — resuming own work |
| `assignees` empty AND no `WIP —` comment from anyone | Proceed to claim (step 3) |
| `assignees` contains user ≠ `@me` | **STOP** — surface "Issue #N already assigned to <user>. Take over? (y/N)". Wait for explicit user confirmation. |
| Most recent `WIP —` comment by user ≠ `@me` AND `<24h` old | **STOP** — surface "Issue #N has fresh WIP from <user> (started <ts>). Collision likely. Continue anyway? (y/N)". Wait. |
| Most recent `WIP —` comment by user ≠ `@me` AND `>24h` old | Stale claim — surface "Issue #N has stale WIP from <user> (started <ts>, >24h). Reclaim? (y/N)". Wait. |

"Current GitHub user" = `gh api user --jq .login`. Run inline each time `@me` is compared (the call is fast and read-only).

Comment on lines +46 to +52
If detection passed (or user confirmed override), run **both** commands:

```bash
gh issue edit <N> --add-assignee @me

gh issue comment <N> --body "WIP — session $(date -u +%Y%m%dT%H%M%SZ)-$(uuidgen | head -c 8), branch <branch-name>, started $(date -u +%Y-%m-%dT%H:%M:%SZ)"
```
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.

2 participants