fix(agents): port pr-review robustness learnings from facets (2026-06-22)#816
Draft
0xbulma wants to merge 3 commits into
Draft
fix(agents): port pr-review robustness learnings from facets (2026-06-22)#8160xbulma wants to merge 3 commits into
0xbulma wants to merge 3 commits into
Conversation
…-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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
This repo's
.agents/PR-review system is a markdown-only port of the0xbulma/facetsplugin's PR-review skills (dispatcherlib/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
mktemppaths/tmpliterals inpr-review-gh(Step 7 payload + watcher cycle file) andpr-review-ci(REVIEW_FILE) withmktemp "${TMPDIR:-/tmp}/…XXXXXX"(BSD+GNU portable). Also fixes a latent unassigned$REVIEW_FILEinpr-review-ghStep 7 (prose named a literal path; submit/cleanup referenced an unset var).pr-review-baseStep 6 already normalizedfinding.filefor the scope compare but discarded it; callers passed the raw path into the GitHub reviewcomments[].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.--watchcache-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. (--goalhalf of #53 is N/A — feature absent here.)pr-review-baseStep 5 now mandates reading all persona files first, then issuing everyAgentcall in one message, with a caution that splitting serializes the panel.Not ported (upstream-only machinery absent in this port)
findings-ledger.ts/review-scope.ts; no TS scripts here..agents/(allgh/gitvar usages are quoted single-token);feedbackskill isn't ported.Notes
.agents/**is repo tooling, not published package source (CLAUDE.md §7)..agents/in this repo (upstream'sbatsguard lives against the plugin layout). Verified via grep guards: zero fixed/tmpliterals remain, threemktempper-run paths,REVIEW_FILE/CYCLE_FILEassigned 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