Skip to content

fix(agents): port pr-review robustness learnings from facets (2026-06-22)#816

Draft
0xbulma wants to merge 3 commits into
mainfrom
fix/agents-pr-review-port-facets-learnings
Draft

fix(agents): port pr-review robustness learnings from facets (2026-06-22)#816
0xbulma wants to merge 3 commits into
mainfrom
fix/agents-pr-review-port-facets-learnings

Conversation

@0xbulma

@0xbulma 0xbulma commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Motivation

This repo's .agents/ PR-review system is a markdown-only port of the 0xbulma/facets plugin's PR-review skills (dispatcher lib/pr-review-base.md + commands/pr-review-{ci,gh,local}.md + personas/). Eight PRs merged upstream on 2026-06-22 hardening that system. Most target upstream-only machinery absent here (TS scripts, findings-ledger), but four carry lessons that map onto this port — two are latent correctness bugs already present in our files, two are robustness tightenings. Parallel Conductor workspaces (shared host /tmp) make #57 materially relevant.

Solution

facets PR Ported as Detail
#57 per-run mktemp paths Replace shared /tmp literals in pr-review-gh (Step 7 payload + watcher cycle file) and pr-review-ci (REVIEW_FILE) with mktemp "${TMPDIR:-/tmp}/…XXXXXX" (BSD+GNU portable). Also fixes a latent unassigned $REVIEW_FILE in pr-review-gh Step 7 (prose named a literal path; submit/cleanup referenced an unset var).
#52 persist repo-relative path pr-review-base Step 6 already normalized finding.file for the scope compare but discarded it; callers passed the raw path into the GitHub review comments[].path, which the reviews API rejects (./, a/, b/, or absolute prefix) → atomic review collapses to a PR-level comment. Now the normalized path is written back into the kept finding; contract documented in the output section and both callers.
#53 watcher re-review on incomplete --watch cache-hit on SHA equality treated a prior crashed-agent cycle (review may be incomplete, zero findings) as clean and never retried. Now detect the incomplete warning on the last review (CYCLE_LAST_REVIEW_INCOMPLETE) and re-review (WATCH_RETRY_INCOMPLETE) instead of cache-hitting. (--goal half of #53 is N/A — feature absent here.)
#54 single-message fan-out pr-review-base Step 5 now mandates reading all persona files first, then issuing every Agent call in one message, with a caution that splitting serializes the panel.

Not ported (upstream-only machinery absent in this port)

Notes

  • No changeset.agents/** is repo tooling, not published package source (CLAUDE.md §7).
  • No test harness for .agents/ in this repo (upstream's bats guard lives against the plugin layout). Verified via grep guards: zero fixed /tmp literals remain, three mktemp per-run paths, REVIEW_FILE/CYCLE_FILE assigned before use, normalized path written back. A small CI grep guard banning fixed /tmp/ review-state literals under .agents/ would be the spiritual port of upstream's bats test — left out of scope here.

🤖 Generated with Claude Code

…-22)

Backport the portable fixes from 0xbulma/facets PRs merged 2026-06-22 into
this repo's markdown-only `.agents/` PR-review port. Two are latent
correctness bugs already present in our files; two are robustness tightenings.

- #57 — per-run mktemp temp paths instead of shared /tmp literals. Parallel
  Conductor workspaces share the host /tmp, so a concurrent same-PR review
  could clobber the payload mid-run. Replace the literals in pr-review-gh
  (Step 7 payload + watcher cycle file) and pr-review-ci (REVIEW_FILE) with
  `mktemp "${TMPDIR:-/tmp}/...XXXXXX"` (BSD+GNU portable). Also fixes a latent
  unassigned `$REVIEW_FILE` in pr-review-gh Step 7.
- #52 — persist the repo-relative normalized path. pr-review-base Step 6
  already normalized finding.file for the scope compare but discarded it;
  callers then passed the raw path into the GitHub review `comments[].path`,
  which the reviews API rejects (./, a/, b/, or absolute prefix), collapsing
  the atomic review to a PR-level comment. Now write the normalized path back
  into the kept finding and document the contract in both callers.
- #53 — close the --watch cache hole: a prior watcher cycle that posted
  "review may be incomplete" (a crashed agent, zero findings) was treated as
  clean on the next same-SHA cycle and never retried. Detect the incomplete
  warning on the last review and re-review instead of cache-hitting.
- #54 — tighten pr-review-base Step 5: read all persona files first, then
  issue every Agent call in ONE message; warn that splitting the launches
  serializes the panel.

Not ported (upstream-only machinery absent here): #47/#55 (TS scripts),
#50 (no unquoted multi-token flag var), #51 (findings-ledger feature).

No changeset: `.agents/**` is repo tooling, not published package source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@0xbulma 0xbulma added the bug Something isn't working label Jun 23, 2026
@0xbulma 0xbulma self-assigned this Jun 23, 2026
0xbulma and others added 2 commits June 23, 2026 14:38
Self-review (/facets:pr-review-local --goal) of the facets backport found two
actionable issues in the #53 watcher change:

- HIGH: the watcher incomplete-detector keyed only on "review may be
  incomplete", but the initial Step 7 zero-findings-but-failures body emits
  "REVIEW_INCOMPLETE — ... no findings does NOT mean clean" without that
  phrase. So the exact case #53 targets (zero findings + crashed agent) still
  cache-hit as clean and never retried. Broaden the jq test to match
  "review may be incomplete|REVIEW_INCOMPLETE" so every agent-failure body is
  detected.
- MEDIUM: the new WATCH_RETRY_INCOMPLETE sentinel was missing from the
  Sentinel grammar table. Add the row.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the "Conductor workspaces" reference in the pr-review-gh/ci Step 7 mktemp
rationale — the concern is generic (concurrent reviews on the same host share
/tmp), and the .agents/ system should not name a specific agent runner.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant