Skip to content

fix(pr-management-code-review): verify a review posted instead of retrying - #1300

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:fix-code-review-verify-review-posted
Sep 20, 2026
Merged

potiuk merged 1 commit into
apache:mainfrom
potiuk:fix-code-review-verify-review-posted

Conversation

@potiuk

@potiuk potiuk commented Sep 20, 2026

Copy link
Copy Markdown
Member

Summary

  • gh pr review prints nothing on success. posting.md gives the recipes with no post-condition, so empty output reads as a failed call and invites a re-run — which submits the review a second time.
  • The duplicate cannot be withdrawn. GitHub deletes only pending reviews: DELETE /repos/{owner}/{repo}/pulls/{n}/reviews/{id} answers 422 Can not delete a non-pending pull request review once submitted. The only repair is to PUT the body down to a pointer at the real review, which leaves a visibly confused thread on a contributor's PR.
  • Documents that a zero exit means the review posted whatever it printed, and gives the reviews-API query to confirm the post-condition before any retry. Extends the same rule to gh pr comment and the addPullRequestReview mutation.

Hit while reviewing a queue of provider PRs: an empty result was read as a failure, the command was re-run, and the PR ended up carrying two identical reviews that could not be removed.

Type of change

  • Skill change (plugins/magpie-pr-management/skills/code-review/)

Test plan

  • prek run --files <changed> passes

No eval fixture. The existing suites test model decisions from PR state; this change documents a shell post-condition after the posting command runs. review-handoff is the nearest suite, but its action enum (post / dry-run-skip / re-draft / skip / quit) has no slot for a post-condition check, and inventing a suite for a two-paragraph procedural note would add a fixture that tests nothing real. Happy to add one if a maintainer would rather extend that enum.

RFC-AI-0004 compliance

Prose authored with AI assistance; Generated-by: trailer on the commit, no Co-Authored-By:.

…rying

`gh pr review` prints nothing on success. posting.md gives the recipes
with no post-condition, so empty output reads as a failure and invites a
re-run — which submits the review a second time.

The duplicate cannot be withdrawn. GitHub deletes only pending reviews:
DELETE /repos/{owner}/{repo}/pulls/{n}/reviews/{id} answers `422 Can not
delete a non-pending pull request review` once it is submitted. The only
repair is to PUT the body down to a pointer at the real review, leaving a
confused thread on a contributor's PR.

Hit while reviewing a queue of provider PRs against a large adopting
project: an empty result was read as a failed call, the command was
re-run, and the PR ended up carrying two identical reviews.

Documents that a zero exit means the review posted whatever it printed,
and gives the reviews-API query to confirm the post-condition before any
retry. Extends the same rule to `gh pr comment` and the
addPullRequestReview mutation.

Generated-by: Claude Opus 5
@potiuk potiuk added family:pr-management pr-management-* skills capability:fix Implement code change to resolve an issue labels Sep 20, 2026
@potiuk
potiuk merged commit c02220e into apache:main Sep 20, 2026
9 checks passed
potiuk added a commit that referenced this pull request Sep 21, 2026
Three defects, found while doctoring a sandbox where `podman` worked by
hand but not through the gateway.

Backend discovery trusted `podman machine inspect` for the socket path.
That command renders the path from the *caller's* TMPDIR, not the
machine's, so a hook, agent, or launchd service whose TMPDIR differs is
told a path that does not exist and discovery reports no backend at all.
Only the basename is stable, so the finders now return candidate lists
and `discover` takes the first that exists, with the per-user temp
directory from `getconf DARWIN_USER_TEMP_DIR` as the second podman
candidate. `_docker_socket` gets the same shape: the context result and
the `~/.docker` fallback are now both candidates rather than either/or.

`CONTAINER_HOST` / `DOCKER_HOST` were committed in the baseline with a
project-relative `unix://./…` value. That can never have worked: a
`unix://` URL's authority is parsed as a host component, so `unix://./x`
dials `/.//x`, `unix://x` dials `/x/`, and `unix:x` dials `//`. Only
`unix:///abs/path` connects, and an absolute path is per-machine, so
both variables move out of the committed baseline and join the
`allowUnixSockets` pair in the gitignored `.claude/settings.local.json`.
The spec had recorded this as a resolved open question in favour of the
relative form, concluded from URL parsing rather than a connection; it
now records what actually happens.

The TMPDIR troubleshooting entry prescribed `env.TMPDIR` in project
settings to get a per-project scratch directory. Claude Code sets TMPDIR
itself when it builds the sandbox and that assignment wins, so the
setting is accepted and silently does nothing. The entry now says so,
and the doctor's probe 4 reports a shared session root as a pass instead
of sending the operator after a fix that cannot work. Probe 3 gains an
explicit check for a non-absolute value, because stripping `unix://`
leaves a relative path that stats fine and hides the real cause.

Also fixes an unrelated blocker found on the way: the touch overlay
polled `lsof -U -n` before the O(1) `signing_in_flight` check, and on a
loaded host that enumeration outlasts the signature it is meant to
observe, so the overlay never appeared and its test failed one run in
three. Asking the cheap question first keeps `lsof` out of the hot loop
on the wrapped path entirely.

Specs are synced to main: the two pr-management-code-review fixes
(#1299, #1300) are recorded in the family contract, the GitHub Copilot
harness from #1287 gets copilot-runtime.md, and .last-sync moves to the
current tip.

Generated-by: Claude Opus 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:fix Implement code change to resolve an issue family:pr-management pr-management-* skills

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant