fix(pr-reviewer): read PR state from GitHub VFS instead of gh CLI
Problem
Every pr-reviewer run was failing with spawn gh ENOENT. The sandbox snapshot ships no gh binary, but two code paths shelled out to gh pr view:
verifyReadyForHumanReview(controls the Slack "ready" ping) — added ine981031(READY-sentinel CI guard)readMergeOnGreenState(controls auto-merge) — added in #57 (merge-on-green)
Before those commits pr-reviewer never used gh. The harness commits via the cloud writeback and is explicitly "no git/gh" — these calls violated that.
Fix
Rebuild the same PullRequestReadyState the gate evaluators consume from the GitHub adapter's VFS projection instead of gh:
| Need | VFS source |
|---|---|
| state, draft, labels, head.sha | pulls/{n}/meta.json |
| CI check rollup | pulls/{n}/checks/_summary.json ({total,passed,failed,pending}) |
| latest review per author | pulls/{n}/reviews/*.json |
- The adapter does not project mergeability, so conflict detection is delegated to the merge API —
mergePullRequest()returnsmerged:falseon a dirty PR andmergePrthrows, so a conflicting PR can never auto-merge. - Every read fails closed: a missing/empty projection yields a state the gates treat as not-ready / pending, never a green light.
- The tested pure evaluators (
evaluateMergeOnGreenState,prReadyStateAllowsHumanReview) are unchanged; only the data source moved.
Behavior note
The merge-on-green gate now drops the "wait for a requested bot reviewer to approve" check (the VFS doesn't project reviewRequests). It still blocks on any bot's explicit CHANGES_REQUESTED, the merge-on-green label, and all-checks-green.
Test
npm run typecheckclean- 37/37 review tests pass (added coverage for the VFS→gate mapping:
rollupFromCheckSummary,deriveReviewDecision) - Deploy bundle verified to contain
checks/_summary.json/listReviewsand zeroghreferences
🤖 Generated with Claude Code
Summary by cubic
Read PR state from the GitHub adapter VFS instead of gh to fix sandbox failures and restore ready pings and merge-on-green. Also hardens review/check parsing so malformed VFS entries never make a PR appear green.
- Bug Fixes
- Build
PullRequestReadyStatefrom VFS:pulls/{n}/meta.json(state/draft/labels/head SHA),pulls/{n}/checks/_summary.json→statusCheckRollup, andpulls/{n}/reviews/*.json→ latest review per author. - Harden VFS parsing: ignore malformed
reviews/*.jsonentries and derivetotalfromfailed+pending+passedwhen missing so failing/pending checks still block. - Missing/empty projections default to “not ready”; conflicts are handled by the merge API (no auto-merge on conflicts).
- Behavior: removed the “requested bot reviewer must approve” check (no
reviewRequestsin VFS). Still blocks on any botCHANGES_REQUESTED, requires themerge-on-greenlabel, and all checks green.
- Build