Review comments are not a task list yet. They are raw text from a busy reviewer. Your first job is to convert them into small, checkable commits.
This loop does that in one sitting. You write a ledger, sort each comment, push fixups, then prove the diff.
Step 1: Write the comment ledger before you edit
Create review-ledger.md on your branch. Do not change code until every comment has a row.
Paste each comment verbatim. Keep the reviewer's typos and the file path.
Then add five empty columns. They force a decision instead of a reflex.
| # | Comment (verbatim) | Kind | Action | Commit | Status | |---|--------------------|------|--------|--------|--------| | 1 | "this breaks the retry path" | blocker | fix | | open | | 2 | "why not reuse parse()?" | question | reply | | open | | 3 | "typo in the comment above" | nit | batch | | open | Keep the ledger in the repo for the review. Delete it in the squash commit.
Step 2: Sort every comment into one kind
Sorting is the whole skill. Most first PRs stall because nits and blockers get equal weight.
Use this table. If a row fits two kinds, pick the heavier one.
| Kind | Signal | What you do |
|---|---|---|
| Blocker | "breaks", "wrong", "will fail" | Fix it now, in code, in a fixup commit |
| Question | Ends with ?, asks for reasoning | Answer in the thread first, code only if needed |
| Nit | Formatting, naming, typos | Batch all nits into one fixup commit |
| Out of scope | "we should also…" | Open a follow-up issue, link it, do not code it here |
| Disagreement | "I'd do it differently" | Ask for one concrete failing case, then agree on a test |
Never argue about taste in a comment thread. Ask for a test instead. A test ends the debate in one round.
Step 3: Check your branch state first
Run this small script before you touch anything. It shows what the reviewer actually sees.
#!/usr/bin/env bash # review-loop.sh — run from the repo root, on your PR branch set -euo pipefail BASE="${1:-origin/main}" git fetch origin --quiet printf 'branch: %s\n' "$(git rev-parse --abbrev-ref HEAD)" printf 'base: %s\n\n' "$BASE" echo "== commits ahead of base ==" git log --oneline "$BASE..HEAD" echo echo "== files touched ==" git diff --stat "$BASE...HEAD" echo echo "== untracked files (should be empty) ==" git status --porcelain | grep '^??' || echo "none" If the file list surprises you, stop. Fix the branch before answering review comments.
Step 4: Land each blocker as a fixup commit
Do not add a commit called "fix review". That buries the change history.
Use --fixup pointed at the commit that owns the lines. The history stays readable after the squash.
# stage only the blocker fix, hunk by hunk git add -p src/retry.ts # attach it to the commit that introduced the bug git commit --fixup=3f2a9c1 Repeat for each blocker. One blocker, one fixup, one ledger row.
Then fold them in without opening an editor.
GIT_SEQUENCE_EDITOR=: git rebase --autosquash -i origin/main GIT_SEQUENCE_EDITOR=: accepts the reordered todo list as-is. Check the log before you trust it.
Step 5: Prove the rebase changed only what you meant
Rewriting history on a PR branch is safe only if you verify it. Use git range-diff.
Capture the old head first, then compare after the rebase.
OLD=$(git rev-parse HEAD) # ... rebase, fixups applied ... git range-diff origin/main "$OLD" HEAD Read the markers carefully. = means the commit is unchanged. ! means the content moved. < and > mean a commit disappeared or appeared.
If an ! shows up in a commit you never touched, stop and read the patch. That is how accidental rewrites reach production.
Then push with the safe flag. Never plain force-push a shared branch.
git push --force-with-lease Step 6: Reply with commit hashes, not promises
Update each ledger row with the fixup hash. Then post one short reply per thread.
Good reply shape: what changed, where, and how the reviewer can check.
Fixed in
3f2a9c1. The retry path now readsattempt < maxAttempts. Covered byretry.spec.tscase 4.
That reply takes twenty seconds. It saves the reviewer a diff hunt.
For questions, answer before you code. A wrong assumption in code costs more than a sentence in a thread.
Step 7: Use a disposable machine for the repro
Sometimes a reviewer reports a failure you cannot reproduce locally. Your laptop has stale caches and local env files.
A throwaway environment settles it. MonkeyCode offers free model access and a free server option, as described by its maintainers.
Disclosure: This article was prepared as part of MonkeyCode's product outreach.
Run the reviewer's exact steps on a clean box. Do not copy your .env or any real tokens onto it.
# on the disposable server, fresh clone only git clone <your-fork-url> pr-repro && cd pr-repro git switch review/fix-loop # run only the failing test first ./scripts/test.sh --filter RetryPath If it fails there and passes on your laptop, the bug is environmental. Say that in the thread. Do not guess.
Free model access helps in one narrow place here. Paste the long review thread and ask for a draft ledger.
Then check every row against the real comment. Models invent plausible comments that were never written. Treat the output as a first draft, never as the record.
Limitations and who should skip this
This loop assumes a branch you own and a reviewer who will re-read it. Several cases break it.
- Heavy monorepos. If a clean build takes thirty minutes, a disposable box per repro is a tax, not a shortcut.
- Strict data policies. If review threads or code cannot leave your network, keep the ledger local and skip any hosted assistance.
- Shared release branches. Do not rebase and force-push a branch other people build on. Use merge commits there.
- Reviewers who read email only. Force-push notifies nobody useful. Post the commit hash in the thread too.
Also skip the fixup flow during an active release freeze. Rebasing behind a cut branch creates more confusion than it removes.
What you should have after one loop
You end with three artifacts: a ledger with no open rows, a branch whose diff you can explain commit by commit, and a short evidence trail in the thread.
That is a repeatable habit, not a one-off. Your second PR review will take half the time.
If you want to try the free model access and the free server option, start from the project's own documentation and check current limits there.


