workflows: pr-review.flow.ts — this repo's own PR reviewer (Cloud pull_request listener)
Replaces the throwaway proof-pr-review-2018 deployment with a committed, repo-specific reviewer at workflows/pr-review.flow.ts.
- Lenses for this codebase: kernel (journal/machine invariants, leases, parks, resume/replay divergence), sdk (preflight refusal shapes, executor lowering, CLI parsing, Cloud HTTP contracts, shell quoting, tests), docs (SURFACE.md/CLOUD.md/examples claims vs what the diff does). Each gated on
.relayflow/review/<lens>.mdviaartifact_exists. - Consensus reconciles opposite verdicts (or lists them under Unresolved) and writes
.relayflow/review/consensus.md, then posts it as one PR comment withgh pr commentthrough the GitHub mount — so the review shows up on the PR. - Cloud input:
input.pullRequest→git fetch origin <baseRef>(shallow, deepened to the merge base) →FETCH_HEAD...<headSha>; local:diffRange. Drafts →f.done("declined").docs/evidence/**,evidence/**, lockfiles excluded from the diff. Budget$4/run. workflows/README.mdrow with the deploy command.
Deploy after merge (from main): flows deploy workflows/pr-review.flow.ts --repo AgentWorkforce/flows --on github:events=pull_request --approver khaliqgant --name flows-pr-review. Firing depends on cloud #3795 (the pull_request dispatch prefilter fix) being deployed; PR #474 stays open as the trigger to verify with.
Typechecks against @relayflows/surface (examples tsconfig). Not run end to end yet — that is the verification step after deploy.
🤖 Generated with Claude Code
[!NOTE]
Medium Risk
Introduces automated GitHub PR comments and shell/git steps on every eligible wake; misconfiguration or stale-head races could post wrong or duplicate feedback until Cloud dispatch fixes land.
Overview
Adds a committed v2 relayflow at workflows/pr-review.flow.ts that replaces ad-hoc Cloud proof deployments with this repo’s own PR reviewer.
On pull_request wakes, it validates input.pullRequest, declines draft PRs and wakes caused by a submitted review, builds a three-dot diff into review/diff.patch (with bounded shallow fetch/deepen on Cloud, evidence and lockfile exclusions), and runs four parallel lens agents (kernel, sdk, docs, repo) gated on review/<lens>.md. A consensus step merges disagreements into review/consensus.md and, when the PR head hasn’t moved, posts one GitHub PR comment via f.github.comment (with front-truncation for long bodies). Local runs use diffRange and skip commenting.
workflows/README.md documents deploy (flows deploy … --on github:events=pull_request) and behavior; examples/tsconfig.json includes ../workflows/*.flow.ts so the flow typechecks with @relayflows/surface.
Reviewed by Cursor Bugbot for commit 94a688515e091da80430bfc660934f131401db1a. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Replaces the throwaway proof-pr-review-2018 deployment with a committed workflows/pr-review.flow.ts reviewer for this repository. It reviews pull requests through kernel, SDK, docs, and repo lenses, reconciles findings, and posts one consensus comment; drafts, review-submitted wakes, and empty diffs are declined, and a moved head suppresses the comment.
Operation
- Cloud derives the PR diff by fetching the base branch, while local runs accept
diffRange; evidence files and lockfiles are excluded, and a PR filtered to nothing is declined. - Four lens agents write gated findings, and consensus preserves unresolved disagreements instead of silently choosing one verdict; the comment is skipped when the PR head moved while agents ran.
- Deploy from
mainwithflows deploy workflows/pr-review.flow.ts --repo AgentWorkforce/flows --on github:events=pull_request --approver <you> --name flows-pr-reviewafter the Cloudpull_requestdispatch fix is available. - Run locally with
flows run workflows/pr-review.flow.ts --local-agent --input '{"diffRange":"origin/main...HEAD"}'; local runs skip the GitHub comment.