Skip to content

AIGS-25 Keep the review bot from approving one-way-door PRs - #2317

Merged
wjames111 merged 13 commits into
mainfrom
AIGS-25-human-approval
Nov 30, 2026
Merged

wjames111 merged 13 commits into
mainfrom
AIGS-25-human-approval

Conversation

@wjames111

@wjames111 wjames111 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Links

Description

Stops the agent-review bot from approving PRs that touch the few places where a person's approval adds something the bot and CI can't. Those PRs wait for a person; everything else can merge on the bot's approval and green CI.

  • .claude/review/config.yml: adds a human_approval list with four groups: the review's own rules (.github, .husky, .claude except the review's outcome logs, the root CLAUDE.md and AGENTS.md, lint, test and TypeScript config), sign-in, page access and clearing one user's data before the next (the saved Apollo cache, the sign-out wipe and the service worker's cache rules), the code that puts the user's API token on outgoing calls, and build and deploy config where secrets are in reach.
  • .github/CODEOWNERS: narrowed to the same paths, owned by @jbirdjavi, @jeff-clay and @EJTison. HR tools, the HCM reports, the REST proxy schema, the Apollo clients, Datadog and the safety nets are no longer owned.
  • CLAUDE.md: the one-way-door section matches the shorter list.

Added on top of jbirdjavi's proposed list: src/lib/clearSessionData.ts, src/sw/**, src/lib/serviceWorker/** and serwist.config.mjs. They wipe the last user's data on sign-out and decide what the service worker caches, keeping token-bearing and donor responses out of the browser cache, so they guard the same thing as CacheRestoreGate and apollo/persistence: one person's data reaching the next user. Review flagged the gap.

main needs one approval and the bot's approval usually counts as that one, so with this list a one-way-door PR can only merge after a person approves, even before "Require review from Code Owners" is turned on.

Testing

The bot reads this list from main, so it only takes effect after merge. Before merge I ran agent-review human-check against the new config:

  • Needs a person: root CLAUDE.md, .claude/review/rules/*, CacheRestoreGate, apollo/persistence, apollo/link.ts, next.config.ts, .yarn/releases/*
  • No person needed: HrTools files and pages, src/components/HrTools/CLAUDE.md, dataDog.ts, apollo/client.ts, pages/api/Schema/*, ordinary app files, and the review's learnings/feedback/*.jsonl logs

After merge: a small PR touching next.config.ts or pages/api/auth/ should get a passing report but no bot approval, while a small HrTools PR should be approved by the bot.

AI review

Findings I did not fix, and why:

Checklist:

  • My PR title is the work item key, then a summary of 80 characters or less (example: MPDX-1234 Add sortable columns)
  • I have applied the appropriate labels (Add the label "Preview Environment" to automatically create a preview environment)
  • I have run the Claude Code /agent-review:review command locally and fixed each finding or listed it above
  • The github-actions bot has approved the PR (it approves once /agent-review:review leaves no open blockers)
  • I have asked a person to review, if this is a one-way door (it touches a path .github/CODEOWNERS gives an owner)
  • I have tested my changes in preview or in staging
  • I have cleaned up my commit history

🤖 Generated with Claude Code

@wjames111
wjames111 requested a review from a team as a code owner November 20, 2026 21:52
@wjames111 wjames111 self-assigned this Nov 20, 2026
@wjames111 wjames111 added On Staging Will be merged to the staging branch by Github Actions Preview Environment Add this label to create an Amplify Preview labels Nov 20, 2026
@wjames111
wjames111 requested a review from dr-bizz November 20, 2026 21:53
@github-actions

Copy link
Copy Markdown
Contributor

Preview branch generated at https://AIGS-25-human-approval.d3dytjb8adxkk5.amplifyapp.com

@github-actions

Copy link
Copy Markdown
Contributor

Bundle sizes [mpdx-react]

Compared against c97c18c

No significant changes found

@wjames111

wjames111 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 agent-review · ✅ no blockers · risk HIGH
Rollout: advisory · 4 agents run (Code Review (/code-review xhigh), Security Review Agent, Testing & Quality Review Agent, Standards Compliance Review Agent) · incremental since 3260b6e

BLOCKERS: fix or dismiss to pass

✅ No blockers.

OTHER FINDINGS (36)

  • #27 · 6/10 · .claude/review/config.yml:508 · serwist.config.mjs, which controls what the service worker precaches (including the precachePrerendered: false guard on page HTML), is not in human_approval or CODEOWNERS. The service worker cache rules this pass sets out to gate can still change through a bot-approved PR. · ✅ fixed in 4e0f4db
  • #1 · 5/10 · .claude/review/config.yml:475 · Bot approvals already on open one-way-door PRs stay in place after this merges. The new list only blocks future approvals, not past ones. (code-review)
  • #2 · 5/10 · .claude/review/config.yml:475 · If the approve job reads config from each PR's base.sha, open PRs on an older base keep getting bot approvals until they rebase. The rollout gap is real but temporary. (code-review)
  • #3 · 5/10 · .claude/review/config.yml:520 · package.json holds the lint, test and prettier commands CI runs, but it is not gated, so a PR can turn off a CI guardrail and still get bot approval. CODEOWNERS has the same gap. (code-review)
  • #15 · 5/10 · .claude/review/config.yml:502 · The list now owns the saved Apollo cache (persistence/, CacheRestoreGate/) to stop one person's data reaching the next user, but the code that wipes that data on sign-out (src/lib/clearSessionData.ts) and the service worker rules that keep token-bearing and donor responses out of the browser cache (src/sw/, src/lib/serviceWorker/) are outside both lists, so the bot can approve a change that leaves the last user's data behind. · ✅ fixed in 921e934
  • #16 · 5/10 · .claude/review/config.yml:509 · The token section drops src/lib/apollo/client.ts and ssrClient.ts, but both wire makeAuthLink(apiToken) into the outgoing link chain. That is the exact kind of code the section says it gates, so the list does not match its own stated rule. (code-review)
  • #32 · 5/10 · .claude/review/config.yml:509 · The new gate covers only serwist.config.mjs, but package.json build:serwist picks which config file serwist build reads and is not gated. A PR could add a new config and repoint the script without needing human approval. (code-review)
  • #4 · 4/10 · .claude/review/config.yml:474 · human_approval is a second hand-kept copy of CODEOWNERS with nothing checking they match, and they already differ for .claude paths. This is the same data kept in two places. (code-review)
  • #5 · 4/10 · .claude/review/config.yml:475 · Because main has no human_approval block yet, this guardrail PR itself is not held for a person by the bot. It relies on CODEOWNERS and branch protection instead. (code-review)
  • #6 · 4/10 · .claude/review/config.yml:477 · UserTypeAccess and the developer-bypass hooks gate every HR tools page but are on neither list. This gap already exists in CODEOWNERS, which this PR mirrors. (code-review)
  • #7 · 4/10 · .claude/review/config.yml:479 · Shared HCM helpers that feed the gated MPGA and Staff Expense reports are not on either list. This mirrors an existing CODEOWNERS gap. (code-review)
  • #8 · 4/10 · .claude/review/config.yml:498 · Non-jsonl files under .claude/review/learnings/feedback/ are neither reviewed nor gated, while CODEOWNERS still owns them. · ✅ fixed in 507a569
  • #9 · 4/10 · .claude/review/config.yml:498 · The hand-picked .claude patterns do not cover everything CODEOWNERS owns under /.claude/, so new .claude files (for example .claude/statusline.sh or .claude/review/metrics/**) can be bot-approved. The comment saying every .claude path is covered is not true. · ✅ fixed in 507a569
  • #10 · 4/10 · .github/CODEOWNERS:2 · CODEOWNERS header still says "This file is the one list", and CLAUDE.md line 196 still says "add or remove paths there, not here". Both now conflict with the new mirrored list and the "change both together" rule. · ✅ fixed in 507a569
  • #11 · 4/10 · CLAUDE.md:198 · The edited paragraph still says CODEOWNERS is the one list and to change paths only there, then says to change both. It also says human_approval mirrors CODEOWNERS, which is not exactly true. · ✅ fixed in 507a569
  • #17 · 4/10 · .claude/review/config.yml:480 · The review-rules section leaves out package.json lint/test scripts, lint-staged, prettier config and jest globalSetup, which also decide what CI checks. None of these were gated before this change either. (code-review)
  • #18 · 4/10 · .claude/review/config.yml:509 · Many client files read apiToken and send it in fetch calls, so a path list can never fully cover 'code that puts the token on outgoing calls'. A single gated helper or lint rule would hold the rule better. (code-review)
  • #28 · 4/10 · .claude/review/config.yml:506 · Only clearSessionData.ts is gated; the sign-out callers are unowned and nothing bans calling next-auth signOut directly, so a bot-approved PR could bypass the wipe. (code-review)
  • #33 · 4/10 · .github/CODEOWNERS:28 · Service worker registration in pages/_app.page.tsx and any worker file under public/ sit outside the gates. A PR could register a different worker without touching any gated path. (code-review)
  • #34 · 4/10 · serwist.config.mjs:15 · The config precaches offline.html, but the page that produces it (pages/offline.page.tsx and its layout) is not gated. A bot-approved change could put user data into that precached HTML. (code-review)
  • #12 · 3/10 · .claude/review/config.yml:474 · ~~The new header comment is a single ~115 char line, while the surrounding comments wrap near 90 chars across lines.~~ · ✅ fixed in 507a569
  • #13 · 3/10 · .github/PULL_REQUEST_TEMPLATE.md:34 · The PR template still asks that the bot has approved, which can never happen on a one-way-door PR now. The next line does ask for a person on one-way doors, so the impact is small. · ✅ fixed in 507a569
  • #19 · 3/10 · .claude/review/config.yml:495 · The feedback carve-out skips .jsonl files at any depth under learnings/feedback/, but CODEOWNERS only skips direct children (feedback/*.jsonl). A .jsonl in a subfolder is owned by CODEOWNERS yet not gated here. (standards)
  • #20 · 3/10 · .github/CODEOWNERS:5 · Owners moved from a team to three named people, an intended owner decision. If those accounts lose write access GitHub drops them while pr-guard still sees owner text. (code-review)
  • #21 · 3/10 · .github/CODEOWNERS:8 · Narrowing to the root CLAUDE.md leaves src/components/HrTools/CLAUDE.md ungated. This matches the owners' stated choice of root files only, so it is a note, not a defect. (code-review)
  • #22 · 3/10 · .github/CODEOWNERS:39 · Outcome logs are unowned and unreviewed yet feed agent-review learn. The learn step only proposes changes for a person to accept, and this carve-out predates the change. (code-review)
  • #23 · 3/10 · .github/CODEOWNERS:39 · The feedback/*.jsonl carve-out could also match a folder named something.jsonl and its contents. human_approval still blocks the bot there, so the gap is narrow and contrived. (code-review)
  • #24 · 3/10 · CLAUDE.md:198 · "Add or remove a path in both files together, not here. It covers:" now ends on "here", so "It" reads as CLAUDE.md instead of the CODEOWNERS list. · ✅ fixed in 921e934
  • #25 · 3/10 · CLAUDE.md:205 · HR math is now covered by tests, AI review and a staging check, but nothing forces the staging check before merge. The owners chose this narrowing on purpose. (code-review)
  • #29 · 3/10 · .claude/review/config.yml:507 · src/lib/clearSessionData.test.ts is not matched by the new clearSessionData.ts entry, so a PR that only weakens the sign-out wipe tests can still get bot approval. (testing)
  • #30 · 3/10 · .github/CODEOWNERS:25 · clearSessionData.ts is owned as a single file, so its test and the caller tests stay bot-approvable and could be weakened without a person. (code-review)
  • #31 · 3/10 · CLAUDE.md:200 · The new CLAUDE.md bullet says the list covers the service worker's cache rules, but serwist.config.mjs is not listed, so the doc claims more than the gates enforce. · ✅ fixed in 4e0f4db
  • #35 · 3/10 · .claude/review/config.yml:509 · What gets precached also depends on serwist package defaults, and dependency bumps are not gated. A minor version change could alter precache behavior without touching the gated config. (code-review)
  • #36 · 3/10 · .github/CODEOWNERS:28 · CODEOWNERS and human_approval are two hand-kept lists with nothing checking that they match. Future edits to one can drift from the other silently. (code-review)
  • #14 · 2/10 · CLAUDE.md:198 · The edit may conflict with a personal rule about not committing CLAUDE.md changes unless asked. The change is the stated point of the PR, so this is likely not an issue. (code-review)
  • #26 · 2/10 · .claude/review/config.yml:474 · The new header comment runs 4 lines and the .claude carve-out comment runs 3, longer than the one-to-two-line comment rule. · ✅ fixed in 921e934
🔧 Fix suggestions (0)

No automated fixes for this review.

📦 Dependency impact

Blast radius: 0 files. Review config only.

📊 Review detail & stats

Generated: 2026-11-24T15:36:40.131Z · Day: Tuesday · Files changed this pass: 3 (+4 -0 lines)
Risk score: 7 (full PR) · HIGH · Required reviewer: experienced · delta risk 4 (MEDIUM)

Risk factors detected: .claude/ review config, .github/CODEOWNERS

Deterministic evidence:

  • AST/static rules: none
  • CI snapshot: unavailable (local review)
  • Cross-repo context: none

Agent summary (new findings this pass; bands: Critical 9-10 · High 7-8 · Important 5-6 · Suggestions 3-4):

Agent Critical High Important Suggestions Confidence
Code Review (/code-review xhigh) 0 0 1 4 H
Security Review Agent 0 0 0 0 H
Testing & Quality Review Agent 0 0 0 0 H
Standards Compliance Review Agent 0 0 0 0 H
Total 0 0 1 4 -

Per-agent perspectives on blockers: none (no blockers).

Engine: code-review (from config) · effort xhigh (from config) · model opus (from config)
/code-review findings: found 5 · scored 5 · dropped 0

Review quality:

  • Average agent confidence: High · Consensus rate: 0% (5 raw findings, no merges)
  • Findings suppressed by approved learnings: 0
  • Ledger matching: 0 of 8 candidate pairs judged the same as earlier findings
💬 How to act on this review

Every finding above is numbered. Severity ≥ 7 findings carry a checkbox and must each be fixed or dismissed before this review counts as passed; lower severities are advisory. This repo runs reviews locally only, so work this ledger with /agent-review:address in a Claude Code session. It fixes or dismisses findings (a reason code and explanation are required for a dismissal) and keeps this comment in sync. Valid codes: false-positive, intentional, pre-existing, deferred, duplicate, insufficient-evidence, other.

github-actions[bot]
github-actions Bot previously approved these changes Nov 20, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: the agent-review report for this head passes with no open blockers, and no repo rule or recorded check needs a person.

@github-actions
github-actions Bot dismissed their stale review November 20, 2026 22:03

agent-review: the bot took back its approval of c95a7c7 because the PR changed beyond merging in the default branch. Run /agent-review:re-review (or /agent-review:review) and post the report. The bot approves again when the report passes for the new head.

@wjames111

wjames111 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

How to test

Config and docs only, no app code. Updated for the narrower list.

Before merge (done): agent-review config validate passes, GitHub reads the new CODEOWNERS with no errors, and agent-review human-check --config .claude/review/config.yml gives:

  • needs a person: root CLAUDE.md, .claude/review/rules/*, pages/api/auth/*, CacheRestoreGate, apollo/persistence, apollo/link.ts, next.config.ts, .yarn/releases/*
  • no person: HR tools and their pages, src/components/HrTools/CLAUDE.md, dataDog.ts, apollo/client.ts, pages/api/Schema/*, ordinary app files, and the review's learnings/feedback/*.jsonl logs

After merge (the bot reads this list from main):

  1. Open a small PR that only touches next.config.ts (or pages/api/auth/) and run /agent-review:review. The report should pass and show "needs a person", the bot should not approve, pr-guard should label it one-way-door, and the three code owners should be asked to review.
  2. Open a small PR in src/components/HrTools/ and run /agent-review:review. pr-guard should label it two-way-door, the bot should approve, and with auto-merge on it should merge once CI is green.
  3. Close both test PRs if you don't want to keep them.

@JasonBuckner

Copy link
Copy Markdown

I checked the human_approval list against CODEOWNERS with the engine's own matcher (minimatch with dot: true, plus the /** folder fallback) over all 5,004 tracked files at d032ef25, and they match. The !( ) lines also hold up on new paths CODEOWNERS owns (.claude/statusline.sh, .claude/review/metrics/a.json, learnings/feedback/a.yml), and the two feedback *.jsonl carve-outs stay open.

On #1 and #2 in the ledger: six open PRs touch these paths and have only the bot's approval right now.

All six have a base.sha from before this PR, so a new review run on them would still read the config with no human_approval. A push that only merges main in keeps the approval too. Could you dismiss the bot approvals on those six once this merges?

Also, the "Findings I did not fix, and why" section is empty, while #1 through #7 and #14 are still open in the ledger.

drafted by claude code opus 5.5 xhigh

@jbirdjavi

Copy link
Copy Markdown
Contributor

Will, thanks for this. Jeff, Ethan and I own mpdx-react now, and none of us are front-end developers. We rely on the AI review for the code itself. So for most of this list, one of us approving a PR adds a wait but not a real check. I'd like to narrow it to the places where a person's approval adds something the bot can't.

What the list costs. I ran agent-review human-check with this PR's config over the 465 changes that landed on main since May 23. 350 of them (75%) would have needed a person, and 317 of those touched HR tools or the HCM reports. Five of the six open PRs Jason listed are Jeff's HR tools PRs.

What I'd keep:

  1. The review's own rules, so the bot never approves a change to what it or CI checks: .claude/** (with the same feedback-log carve-outs you have now), .github/**, the root CLAUDE.md and AGENTS.md, .husky/**, .gitleaksignore, and the lint and test config (.eslintrc*, .eslintignore, jest.config.js, __tests__/util/setup.ts, scripts/jest-shards/*.js, tsconfig.json). A two-way-door PR merges on the bot's approval plus green CI, so these files are the gate itself.
  2. Sign-in and page access: pages/api/auth/**, pages/api/stop-impersonating.page.ts, pages/api/utils/cookies.ts, pages/api/utils/pagePropsHelpers.ts. I'd also add two that aren't on the list yet: src/components/CacheRestoreGate/** and src/lib/apollo/persistence/**. They save the Apollo cache in the browser and clear it when a different user signs in.
  3. The code that puts the user's API token on outgoing calls: src/lib/apollo/link.ts, pages/api/graphql-rest.page.ts, pages/api/uploads/**, pages/api/csv-update.page.ts.
  4. Build and deploy config, where secrets are in reach: next.config.ts (its env block lists the app's secrets), amplify.yml, .yarnrc.yml and .yarn/releases/**.

A mistake in groups 2 to 4 could show one person's data to someone else or leak a token or secret, and we can't take that back. They changed in only 12 of those 465, so gating them costs little.

What I'd drop: HR tools, the HCM reports and their pages, folder CLAUDE.md and AGENTS.md files like src/components/HrTools/CLAUDE.md (they'd follow their folder), pages/api/Schema/**, src/lib/apollo/client.ts and ssrClient.ts, src/lib/dataDog.ts and scripts/safety-nets/**. A math mistake in HR tools matters too, but one of us clicking approve won't catch it. That's the job of the tests, the AI review and a check on staging.

With the shorter list, the same check gives 44 of the 465 (about 9%). Five of the six open PRs Jason listed would no longer need a person. #2154 still would, since it touches next.config.ts.

CODEOWNERS: same paths, with @jbirdjavi @jeff-clay @EJTison as the owners in place of @CruGlobal/mpdx-developers, so review requests go to the people who own the repo now. The one-way-door section in CLAUDE.md would shrink to match. If you want HR and HCM work to keep the one-way-door label and the stricter /implement setup without a person's approval, pr-guard's tier-paths-file input can read the longer list from its own CODEOWNERS-format file, and /spec's "Risky" line would read that file too.

Could you make this change in this PR before it merges? If you'd rather merge this one first, a follow-up PR works for me too.

Proposed human_approval list
human_approval:
  paths:
    # The review's own rules: what the bot and CI check
    - '.github/**'
    - '.husky/**'
    - '.gitleaksignore'
    - 'CLAUDE.md'
    - 'AGENTS.md'
    - '.claude/!(review)'
    - '.claude/!(review)/**'
    - '.claude/review/!(learnings)'
    - '.claude/review/!(learnings)/**'
    - '.claude/review/learnings/!(feedback|feedback.jsonl)'
    - '.claude/review/learnings/!(feedback)/**'
    - '.claude/review/learnings/feedback/**/!(*.jsonl)'
    - '.eslintrc*'
    - '.eslintignore'
    - 'jest.config.js'
    - '__tests__/util/setup.ts'
    - 'scripts/jest-shards/*.js'
    - 'tsconfig.json'
    # Sign-in, page access, and the saved Apollo cache
    - 'pages/api/auth/**'
    - 'pages/api/stop-impersonating.page.ts'
    - 'pages/api/utils/cookies.ts'
    - 'pages/api/utils/pagePropsHelpers.ts'
    - 'src/components/CacheRestoreGate/**'
    - 'src/lib/apollo/persistence/**'
    # Code that puts the user's API token on outgoing calls
    - 'src/lib/apollo/link.ts'
    - 'pages/api/graphql-rest.page.ts'
    - 'pages/api/uploads/**'
    - 'pages/api/csv-update.page.ts'
    # Build and deploy config, where secrets are in reach
    - 'next.config.ts'
    - 'amplify.yml'
    - '.yarnrc.yml'
    - '.yarn/releases/**'

github-actions[bot]
github-actions Bot previously approved these changes Nov 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: the agent-review report for this head passes with no open blockers, and no repo rule or recorded check needs a person.

@github-actions
github-actions Bot dismissed their stale review November 24, 2026 15:22

agent-review: the bot took back its approval of fb8495f because the PR changed beyond merging in the default branch. Run /agent-review:re-review (or /agent-review:review) and post the report. The bot approves again when the report passes for the new head.

github-actions[bot]
github-actions Bot previously approved these changes Nov 24, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: the agent-review report for this head passes with no open blockers, and no repo rule or recorded check needs a person.

@github-actions
github-actions Bot dismissed their stale review November 24, 2026 15:29

agent-review: the bot took back its approval of 3260b6e because the PR changed beyond merging in the default branch. Run /agent-review:re-review (or /agent-review:review) and post the report. The bot approves again when the report passes for the new head.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approved: the agent-review report for this head passes with no open blockers, and no repo rule or recorded check needs a person.

@wjames111

Copy link
Copy Markdown
Contributor Author

@jbirdjavi does this look alright now, or should I hold off on merging?

@jbirdjavi jbirdjavi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Will, this looks good to me. The list is what I proposed plus src/lib/clearSessionData.ts, src/sw/**, src/lib/serviceWorker/** and serwist.config.mjs. They cover the sign-out wipe and the service worker's cache rules, the same kind of reason as the Apollo cache files. CODEOWNERS and the CLAUDE.md section match. Go ahead and merge.

@wjames111
wjames111 merged commit aadea9a into main Nov 30, 2026
30 checks passed
@wjames111
wjames111 deleted the AIGS-25-human-approval branch November 30, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

On Staging Will be merged to the staging branch by Github Actions one-way-door Preview Environment Add this label to create an Amplify Preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants