🐛 fix: reviews-due reads only REST, so it works where GraphQL is refused
Slice: #60
Fixes State #140 of P-25: process-rules reviews-due stopped in a Claude cloud session with "cannot read who edited the decisions (HTTP 403)", since it asked GraphQL for each decision's last editor and the cloud proxy refuses GraphQL.
GitHub's REST API has no last body editor: the issue object names only its author, and a body edit leaves no event in the issue's events or timeline (checked on the sandbox: an agent's body edit shows only commented and labeled). So the weekly job, whose token reads GraphQL, vets the text, and reviews-due checks the vetting over REST.
src/reviews.ts,watchReviews(the weekly job's review part): for each open decision with a validReview:date that an owner or an agent wrote and last edited, keeps onegithub-actions[bot]comment ending<!-- process-rules vetted sha256:<hex> -->, posted once and edited (PATCH) when the hash changes. It hashes the body GraphQL returns alongside the editor, so an edit between the REST listing and that read is not vetted under the earlier editor. The overdue watch now shares that editor read and each issue's comments.reviewsDue: reads only REST. It still checks the author; then lists a decision only when the workflow's latest vetting comment names the SHA-256 of the body it reads. A pasted mark from anyone but the workflow counts for nothing; an edit by anyone changes the hash, so the decision waits for the job's next run, and stderr names it.src/decisions.ts,lastEditors: returns each body with its editor; only the weekly job calls it.- A label trusted while
updated_atis not later was weighed and dropped: every comment and label movesupdated_at, the routine's own included, and it cannot tell a body edit from a comment. - README,
routines/review.md,docs/decisions.md: say so. REST and GraphQL return the same bytes for a body (checked on the sandbox). - Tests:
reviews-duemakes no GraphQL request; leaves out a decision edited after its vetting, one never vetted, one whose mark someone else pasted, and one whose latest mark is another text; the job posts a vetting comment, edits a stale one, skips one already current, vets nothing for someone else's text or edit or a node GitHub did not return, hashes GraphQL's body, and throws on each failed write.
pnpm check passes (883 tests, reviews.ts and decisions.ts 100% lines).
🤖 Generated with Claude Code
Summary by cubic
Fixes process-rules reviews-due in Claude cloud sessions by avoiding GraphQL, which the GitHub proxy refuses.
reviews-dueuses REST and lists a decision only while its body matches the weekly job’s latest SHA-256 vetting comment.- The weekly job vets eligible decisions using the body and editor returned together by GraphQL, and reads overdue dates from that same body.
- Edits invalidate the vetting until the next weekly run;
reviews-duenames unvetted decisions on stderr.