8000 feat: run the first turn of a review in a throwaway worktree by dominikwozniak · Pull Request #29 · dominikwozniak/dw-mc · GitHub
[go: up one dir, main page]

Skip to content

feat: run the first turn of a review in a throwaway worktree - #29

Merged
dominikwozniak merged 2 commits into
mainfrom
feat/6-review-run-first-turn
Sep 16, 2026
Merged

dominikwozniak merged 2 commits into
mainfrom
feat/6-review-run-first-turn

Conversation

@dominikwozniak
Copy link
Copy Markdown
Owner

dw-mc review <pr> is where a model runs, and the only place one does. The run is started by hand, stays in the foreground, and says what it is doing while it does it.

It happens in a worktree cut detached from the tool's own bare clone under the state directory, so what is read is the pull request's head rather than whatever I have open, and the worktree goes away however the run ended. --comment is never passed (ADR 0002).

sequenceDiagram
    participant C as dw-mc review
    participant G as gh
    participant R as state directory
    participant A as claude
    C->>G: pr view
    C->>R: fetch the pull ref and the branch heads, cut the worktree
    C->>A: /code-review <effort> in the worktree
    A-->>C: tools as they run, then the report and the session
    C->>R: the run against the head, the report beside it
    C->>R: take the worktree down
Loading

The run is recorded against the head it covers, with the report as Markdown beside it and the session the follow-up turn resumes. A head with a run of its own is what takes a pull request out of Needs review run, which a sweep now reads from the run rather than carrying forward from the sweep before it.

<pr> is 28 where one repository is registered, or owner/name#28. --effort overrides what the repository configured. A repository configured for a runner that is not built yet is told so rather than quietly reviewed on the other one.

Verified by running it

The CLI was built and run against a real pull request, with the state and configuration directories pointed at a scratch path. Two defects it found are fixed here, and both are now in docs/v1-design.md:

what why it mattered
result is the runner's last word a repository whose own review command fans out to subagents ends on a remark about the notification that came back, and the report is the turn before it. A run keeps every assistant turn's text.
a bare clone carries no refspec neither git clone --bare nor gh repo clone -- --bare writes remote.origin.fetch, so the base branch stood where it was the day of the clone and the review would read every commit since as the pull request's. The fetch brings the branch heads with the pull ref.

Also verified: --output-format stream-json refuses without --verbose in print mode, and a detached worktree of the bare clone is enough for the built-in review — git merge-base HEAD main resolves there.

Left to its own ticket

  • Structured findings, the re-run rule and path_instructions are the second turn (Review run, second turn: structured findings #7); blockingFindings stays 0 until then.
  • The report's file name is percent-encoded by the key/value store. Its content is Markdown, and the command prints the report as well as keeping it.
  • On this repository /code-review <effort> reaches the repository's own review skill, which wants a fixed point rather than an effort. That is what review.skill and the prompt runner settle (The prompt runner on both agent CLIs #11).

Closes #6

🤖 Generated with Claude Code

dominikwozniak and others added 2 commits September 16, 2026 16:43
`dw-mc review <pr>` is where a model runs, and the only place it does. The run
happens in a worktree cut detached from the tool's own bare clone under the
state directory, so what is reviewed is the pull request's head rather than
whatever I have open, and the worktree goes away however the run ended.

The report is kept as Markdown against the head it covers, beside the run that
carries the session the follow-up turn resumes. A head with a run of its own is
what takes a pull request out of Needs review run, which the sweep now reads
from the run rather than carrying forward from the sweep before it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Two defects a live run found. A bare clone is made with no refspec at all, so
the base branch in the tool's own clone stood where it was the day the clone
was made, and a review diffing against it would read every commit since as the
pull request's. The fetch now brings the branch heads along with the pull
request's own ref, which it names rather than reading back out of FETCH_HEAD.

The report was taken from the runner's `result`, which is its last word. A
repository whose own review command fans out to subagents ends on a remark
about the notification that came back, and the report is the turn before that,
so a run keeps every assistant turn's text and falls back to the last word only
where there was nothing before it.

The bell and the desktop notification ring on a run that gave up too, which is
the run I most need to hear about, and the choice of runner sits in the domain
rather than in the command.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@dominikwozniak
dominikwozniak merged commit a56e1f0 into main Sep 16, 2026
1 check passed
@dominikwozniak
dominikwozniak deleted the feat/6-review-run-first-turn branch September 16, 2026 15:44
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.

Review run, first turn: worktree and Markdown report

1 participant

0