oh-notes
Address feedback on a PR created by oh-task: work in an isolated worktree, resolve comments, push fixes, and use linked GitHub issues for descendant work.
Invocation
/oh-notes <pr-number>
<pr-number> - the pull request number to address comments on
Prerequisites
- Repo context: Run from the repo root where the PR exists
- GitHub issue PR: The PR should be from an oh-task session (branch
issue/<number>)
Flow
Load project background from AGENTS.md, relevant .oh/ artifacts, and RNA MCP context when available.
Get PR branch info and create worktree:
# Save original directory for cleanup
ORIGINAL_DIR=$(pwd)
# Get the PR branch name and linked issue
BRANCH=$(gh pr view <pr-number> --json headRefName -q .headRefName)
# Extract issue number from branch (issue/<number>)
PARENT_ISSUE=${BRANCH#issue/}
# Fetch and create worktree tracking the remote branch
git fetch origin
git worktree add .worktrees/pr-<pr-number> -B $BRANCH origin/$BRANCH
cd .worktrees/pr-<pr-number>
Note: -B $BRANCH creates/resets the local branch to track origin.
Fetch PR comments (both top-level and inline review comments):
gh pr view <pr-number> --json comments,reviews
gh api repos/{owner}/{repo}/pulls/<pr-number>/comments --paginate --slurp
Identify unresolved comments:
- Focus on actionable feedback requiring code changes
- Ignore resolved/outdated comments
- Skip non-actionable noise (e.g., "Thanks for the PR!")
For each unresolved comment:
a. Understand the feedback
b. Make the fix
c. Stage changes (git add)
d. Run the repo-local /review skill on staged changes
e. Handle review findings:
- P1-P3 trivial (one-liner fix): fix inline, re-stage, re-review
- P1-P3 non-trivial (significant change): create GitHub issue as descendant
- P4: discard (nitpick)
Creating descendant issues:
# Create issue linked to parent
NEW_ISSUE=$(gh issue create \
--title "Fix: <brief description>" \
--body "Spawned from #${PARENT_ISSUE} during PR #<pr-number> review.
## Context
<what repo-local review found>
## Acceptance
- [ ] Fix applied
- [ ] repo-local review passes" \
--assignee @me | grep -oE '[0-9]+$')
echo "Created descendant issue #${NEW_ISSUE}"
Complete ALL descendant issues before commit.
Any GitHub issue created during this session = descendant that blocks push.
Note: If feedback requires significant architectural changes, consider escalating
back to the original task author rather than creating many descendant issues.
While ANY unclosed issues created in this session:
- Work on the fix (same worktree, same branch)
- Stage changes
- Run the repo-local
/review skill (each issue gets its own review!)
- Handle findings (may spawn more descendants)
- Mark the descendant complete in the local session record after its fix is accepted; do not wait for
Fixes to close it before merge
- If repository policy requires GitHub closure now, explicitly close the accepted issue with a comment
- Loop until every locally tracked descendant is accepted and accounted for
Commit all fixes:
# If there are descendant issues to close, include them in commit
git commit -m "address PR #<pr-number> feedback
- <summary of each addressed comment>
Fixes #<descendant-issue-1>
Fixes #<descendant-issue-2>
[outcome:<name>]"
Push changes:
git push
Reply to addressed comments (optional but helpful):
gh api repos/{owner}/{repo}/pulls/{pr}/comments/{comment_id}/replies \
-f body="Fixed in $(git rev-parse --short HEAD)"
Cleanup worktree:
cd $ORIGINAL_DIR
git worktree remove .worktrees/pr-<pr-number>
Exit and report:
- List addressed comments
- Note any unresolved items that need human decision
- Provide PR URL
Comment Handling
Actionable Comments (address)
- "This should handle null case"
- "Missing error handling"
- "Variable name is confusing"
- "Add test for edge case"
Non-Actionable (skip, report)
- Questions without clear ask: "Why did you do it this way?" (can address with code comment if helpful)
- Design debates: "Have you considered X approach?"
- Requests requiring human decision: "Should we use A or B?"
When in doubt, address it. Better to over-fix than under-fix.
Review Handling
- P1-P3 findings: Create as GitHub issues, work them in this session
- P4 findings: Discard as nitpicks (don't create issues)
Exit Conditions
- Success: All actionable comments addressed, changes pushed
- Blocked: Comment requires human decision - report and stop
- Safety: Max 10 issue iterations (prevent runaway)
Completion Signaling (MANDATORY)
CRITICAL: You MUST signal completion when done. Call the signal_completion tool as your FINAL action.
Signal based on outcome:
| Outcome |
Call |
| All comments addressed |
signal_completion(status: "success", pr: "<pr-url>") |
| Needs human decision |
signal_completion(status: "blocked", blocker: "<reason>") |
| Unrecoverable failure |
signal_completion(status: "error", error: "<reason>") |
| If you do not signal, the orchestrator will not know you are done and the session becomes orphaned. |
|
Fallback: If the signal_completion tool is not available, output your completion status as your final message in the format: COMPLETION: status=<status> pr=<url> or COMPLETION: status=<status> error=<reason>.
Example
$ /oh-notes 42
Getting PR #42 info...
Branch: issue/123
Parent issue: #123
Creating worktree .worktrees/pr-42 on branch issue/123
Loading repo-local review guidance...
Fetching comments...
Found 4 comments:
1. "Add null check before accessing user.email" (line 45)
2. "This error message could be clearer" (line 72)
3. [coderabbit] "Consider using optional chaining" (line 45)
4. "Why not use the existing validate() function?" -> needs decision
Addressing comment 1: Add null check...
Staging changes...
Running repo-local `/review`...
No issues found.
Addressing comment 2: Improve error message...
Staging changes...
Running repo-local `/review`...
No issues found.
Addressing comment 3: Use optional chaining...
Staging changes...
Running repo-local `/review`...
No issues found.
Skipping comment 4: Requires human decision
(Unsure whether to refactor to use validate() or keep current approach)
Committing fixes...
[issue/123 a1b2c3d] address PR #42 feedback
- Add null check before accessing user.email
- Improve error message clarity
- Use optional chaining per CodeRabbit suggestion
Pushing...
To github.com:org/repo.git
f1e2d3c..a1b2c3d issue/123 -> issue/123
Cleaning up worktree...
signal_completion(status: "blocked", blocker: "Comment about validate() function needs decision")
Done.
Addressed: 3 comments
Blocked: 1 (comment about validate() function)
PR: https://github.com/org/repo/pull/42
With Descendant Issue
$ /oh-notes 43
Getting PR #43 info...
Branch: issue/456
Parent issue: #456
Creating worktree .worktrees/pr-43 on branch issue/456
Loading repo-local review guidance...
Fetching comments...
Found 1 comment:
1. "Add input validation" (line 12)
Addressing comment 1: Add input validation...
Staging changes...
Running repo-local `/review`...
repo-local review found P2 issue:
"Validation should also handle edge case X"
Creating descendant issue...
Created issue #457: "Fix: Handle validation edge case X"
Working on #457...
Making fix...
Staging...
Running repo-local `/review`...
No issues found.
Committing all fixes...
[issue/456 b2c3d4e] address PR #43 feedback
- Add input validation per review
- Handle validation edge case X
Fixes #457
Pushing...
Cleaning up worktree...
signal_completion(status: "success", pr: "https://github.com/org/repo/pull/43")
Done.
Addressed: 1 comment
Descendant issues closed: #457
PR: https://github.com/org/repo/pull/43
1---2name: oh-notes3description: Address PR comments for GitHub issue PRs, resolve feedback, push fixes4---56# oh-notes78Address feedback on a PR created by `oh-task`: work in an isolated worktree, resolve comments, push fixes, and use linked GitHub issues for descendant work.910## Invocation1112`/oh-notes <pr-number>`1314- `<pr-number>` - the pull request number to address comments on1516## Prerequisites1718- **Repo context**: Run from the repo root where the PR exists19- **GitHub issue PR**: The PR should be from an oh-task session (branch `issue/<number>`)2021## Flow22231. Load project background from `AGENTS.md`, relevant `.oh/` artifacts, and RNA MCP context when available.24252. Get PR branch info and create worktree:2627 ```bash28 # Save original directory for cleanup29 ORIGINAL_DIR=$(pwd)3031 # Get the PR branch name and linked issue32 BRANCH=$(gh pr view <pr-number> --json headRefName -q .headRefName)3334 # Extract issue number from branch (issue/<number>)35 PARENT_ISSUE=${BRANCH#issue/}3637 # Fetch and create worktree tracking the remote branch38 git fetch origin39 git worktree add .worktrees/pr-<pr-number> -B $BRANCH origin/$BRANCH40 cd .worktrees/pr-<pr-number>41 ```4243 Note: `-B $BRANCH` creates/resets the local branch to track origin.44453. Fetch PR comments (both top-level and inline review comments):4647 ```bash48 gh pr view <pr-number> --json comments,reviews49 gh api repos/{owner}/{repo}/pulls/<pr-number>/comments --paginate --slurp50 ```51524. Identify unresolved comments:53 - Focus on actionable feedback requiring code changes54 - Ignore resolved/outdated comments55 - Skip non-actionable noise (e.g., "Thanks for the PR!")56575. For each unresolved comment:58 a. Understand the feedback59 b. Make the fix60 c. Stage changes (`git add`)61 d. Run the repo-local `/review` skill on staged changes62 e. Handle review findings:63 - P1-P3 trivial (one-liner fix): fix inline, re-stage, re-review64 - P1-P3 non-trivial (significant change): create GitHub issue as descendant65 - P4: discard (nitpick)6667 **Creating descendant issues:**6869 ```bash70 # Create issue linked to parent71 NEW_ISSUE=$(gh issue create \72 --title "Fix: <brief description>" \73 --body "Spawned from #${PARENT_ISSUE} during PR #<pr-number> review.7475 ## Context76 <what repo-local review found>7778 ## Acceptance79 - [ ] Fix applied80 - [ ] repo-local review passes" \81 --assignee @me | grep -oE '[0-9]+$')8283 echo "Created descendant issue #${NEW_ISSUE}"84 ```85866. **Complete ALL descendant issues before commit.**87 Any GitHub issue created during this session = descendant that blocks push.8889 Note: If feedback requires significant architectural changes, consider escalating90 back to the original task author rather than creating many descendant issues.9192 While ANY unclosed issues created in this session:93 - Work on the fix (same worktree, same branch)94 - Stage changes95 - Run the repo-local `/review` skill (each issue gets its own review!)96 - Handle findings (may spawn more descendants)97 - Mark the descendant complete in the local session record after its fix is accepted; do not wait for `Fixes` to close it before merge98 - If repository policy requires GitHub closure now, explicitly close the accepted issue with a comment99 - Loop until every locally tracked descendant is accepted and accounted for1001017. Commit all fixes:102103 ```bash104 # If there are descendant issues to close, include them in commit105 git commit -m "address PR #<pr-number> feedback106107 - <summary of each addressed comment>108109 Fixes #<descendant-issue-1>110 Fixes #<descendant-issue-2>111112 [outcome:<name>]"113 ```1141158. Push changes:116117 ```bash118 git push119 ```1201219. Reply to addressed comments (optional but helpful):122123 ```bash124 gh api repos/{owner}/{repo}/pulls/{pr}/comments/{comment_id}/replies \125 -f body="Fixed in $(git rev-parse --short HEAD)"126 ```12712810. Cleanup worktree:129130 ```bash131 cd $ORIGINAL_DIR132 git worktree remove .worktrees/pr-<pr-number>133 ```13413511. Exit and report:136137- List addressed comments138- Note any unresolved items that need human decision139- Provide PR URL140141## Comment Handling142143### Actionable Comments (address)144145- "This should handle null case"146- "Missing error handling"147- "Variable name is confusing"148- "Add test for edge case"149150### Non-Actionable (skip, report)151152- Questions without clear ask: "Why did you do it this way?" (can address with code comment if helpful)153- Design debates: "Have you considered X approach?"154- Requests requiring human decision: "Should we use A or B?"155156When in doubt, address it. Better to over-fix than under-fix.157158## Review Handling159160- **P1-P3 findings**: Create as GitHub issues, work them in this session161- **P4 findings**: Discard as nitpicks (don't create issues)162163## Exit Conditions164165- **Success**: All actionable comments addressed, changes pushed166- **Blocked**: Comment requires human decision - report and stop167- **Safety**: Max 10 issue iterations (prevent runaway)168169## Completion Signaling (MANDATORY)170171**CRITICAL: You MUST signal completion when done.** Call the `signal_completion` tool as your FINAL action.172**Signal based on outcome:**173174| Outcome | Call |175| --------- | ------ |176| All comments addressed | `signal_completion(status: "success", pr: "<pr-url>")` |177| Needs human decision | `signal_completion(status: "blocked", blocker: "<reason>")` |178| Unrecoverable failure | `signal_completion(status: "error", error: "<reason>")` |179**If you do not signal, the orchestrator will not know you are done and the session becomes orphaned.**180181**Fallback:** If the `signal_completion` tool is not available, output your completion status as your final message in the format: `COMPLETION: status=<status> pr=<url>` or `COMPLETION: status=<status> error=<reason>`.182183## Example184185```text186$ /oh-notes 42187188Getting PR #42 info...189Branch: issue/123190Parent issue: #123191192Creating worktree .worktrees/pr-42 on branch issue/123193Loading repo-local review guidance...194195Fetching comments...196Found 4 comments:197 1. "Add null check before accessing user.email" (line 45)198 2. "This error message could be clearer" (line 72)199 3. [coderabbit] "Consider using optional chaining" (line 45)200 4. "Why not use the existing validate() function?" -> needs decision201202Addressing comment 1: Add null check...203Staging changes...204Running repo-local `/review`...205No issues found.206207Addressing comment 2: Improve error message...208Staging changes...209Running repo-local `/review`...210No issues found.211212Addressing comment 3: Use optional chaining...213Staging changes...214Running repo-local `/review`...215No issues found.216217Skipping comment 4: Requires human decision218 (Unsure whether to refactor to use validate() or keep current approach)219220Committing fixes...221[issue/123 a1b2c3d] address PR #42 feedback222223 - Add null check before accessing user.email224 - Improve error message clarity225 - Use optional chaining per CodeRabbit suggestion226227Pushing...228To github.com:org/repo.git229 f1e2d3c..a1b2c3d issue/123 -> issue/123230231Cleaning up worktree...232signal_completion(status: "blocked", blocker: "Comment about validate() function needs decision")233234Done.235 Addressed: 3 comments236 Blocked: 1 (comment about validate() function)237238PR: https://github.com/org/repo/pull/42239```240241### With Descendant Issue242243```text244$ /oh-notes 43245246Getting PR #43 info...247Branch: issue/456248Parent issue: #456249250Creating worktree .worktrees/pr-43 on branch issue/456251Loading repo-local review guidance...252253Fetching comments...254Found 1 comment:255 1. "Add input validation" (line 12)256257Addressing comment 1: Add input validation...258Staging changes...259Running repo-local `/review`...260261repo-local review found P2 issue:262 "Validation should also handle edge case X"263264Creating descendant issue...265Created issue #457: "Fix: Handle validation edge case X"266267Working on #457...268Making fix...269Staging...270Running repo-local `/review`...271No issues found.272273Committing all fixes...274[issue/456 b2c3d4e] address PR #43 feedback275276 - Add input validation per review277 - Handle validation edge case X278279 Fixes #457280281Pushing...282Cleaning up worktree...283signal_completion(status: "success", pr: "https://github.com/org/repo/pull/43")284285Done.286 Addressed: 1 comment287 Descendant issues closed: #457288289PR: https://github.com/org/repo/pull/43290```