Skip to content

feat(review-remote-pr): detect disabled Code Quality and skip it cleanly - #419

Merged
thewrz merged 10 commits into
mainfrom
feat/issue-403
Aug 23, 2026
Merged

feat(review-remote-pr): detect disabled Code Quality and skip it cleanly#419
thewrz merged 10 commits into
mainfrom
feat/issue-403

Conversation

@thewrz

@thewrz thewrz commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

This was written agentically; verify its assertions:

Stacked PR. Based on feat/issue-395 (PR #418), the tip of the #394#395#403 chain — not on main. Merge order is #416#418 → this. It retargets automatically as its base merges. The diff shown here is this issue's work only.

Why

AGENT_REVIEW_PROVIDERS=github-code-quality was accepted at plan time even when the repository has GitHub Code Quality disabled. Nothing checked, so code-quality-state.sh failed mid-gate with 403 Code quality is not enabled for this repository — a declaration accepted at plan time that only fails much later, at the worst moment.

What

code-quality-state.sh --probe reports state=enabled|not-enabled|unknown. review-provider-config.sh --probe (opt-in) emits provider=github-code-quality mode=none source=declared reason=not-enabled when the probe decides the feature is off, and merge-gate.sh --code-quality-scan-state now accepts not-enabled, treating it exactly as it treats complete. pending remains the only blocker.

Decisions

Known follow-up

pr-to-green/references/auto-merge.md still describes --code-quality-scan-state as complete|pending in prose and does not mention not-enabled. The mechanism is correct and tested; only that prose is stale. It sits outside this change's declared write set, and was reported rather than silently widened into it — it will be corrected in a follow-up touch on this branch.

Diff size

operational.lines as reported below, across 7 files, measured against the chain base — within the ~500-line guideline.

Testing

  • bash tests/test-code-quality-state.sh → 12/12 (new file)
  • bash tests/test-review-provider-config.sh → 26/26 (16 pre-existing + 10 new)
  • bash tests/test-pr-to-green-merge-gate.sh → 80/80 (78 pre-existing + 2 new)
  • Full suite — bash tests/run-tests.shALL GREEN (run independently at root review, on the chain-cumulative tree)
  • Size gate — bash tests/lint-skill-size.sh agentkit/skills → 0 violations, no ceiling raise
  • shellcheck on every changed script → clean apart from pre-existing repo-wide SC1091/SC2034 notices
  • CI green

🤖 Co-authored by Claude Sonnet 5 (worker) and Claude Opus 5 (root review).

Closes #403

mergetest and others added 6 commits August 23, 2026 13:09
…s from staleness

record-tier0.yml pushes a post-merge [skip ci] commit to main after every merge; merge-gate.sh blocked the next queued PR on base: stale=yes, forcing a second merge-down and CI run per PR (agent-kit#394, 2026-08-22 queue #387-#389). gh-pr-state.sh now exempts a base advance whose new commits touch only the repository-declared AGENT_GENERATED_PATHS prefixes from staleness; any other base advance still stales. Documented in onboard-repo and the dispatch-plan generated-path handling, with a fixture test covering a base advance confined to bench/results/tier0.jsonl.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
The base-staleness exemption added in f4c8728 was correct but inert for agent-kit's own record-tier0.yml commits: this repository's declared AGENT_GENERATED_PATHS (.agent/board.json only) did not cover bench/results/tier0.jsonl, so the issue's own Evidence-section defect stayed live on merge. Adds bench/results/ to the declaration, a regression-pin test asserting this repo's own config covers bench/results/tier0.jsonl, and a note on the dual meaning of AGENT_GENERATED_PATHS in its schema template.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
…names

Adversarial review of PR #416 (Codex gpt-5.6-terra, xhigh) confirmed two fail-open gaps in base_advance_is_automation_only: (1) GitHub compare API caps .files at 300 entries per page with no pagination follow-through here, so a base advance touching 301+ files could report stale=no if only the first 300 (all declared) were read; (2) a rename only checked the new filename, so a rename FROM an undeclared path INTO a declared one (or vice versa) reported stale=no despite moving application code. Both now fail closed: a files count at or above the named COMPARE_FILES_PAGE_CAP (300) is treated as unreadable evidence, and both filename and previous_filename must match a declared prefix for a renamed entry. Adds regression-pin tests for each.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
…of coderabbit=none

gh-pr-state.sh derived provider: coderabbit=... from an issue-comment phrase scan, which an
APPROVED review with zero actionable threads (or a CHANGES_REQUESTED review with inline
threads only) never matches -- PR #386 read coderabbit=none for 15 wasted one-minute
rounds after CodeRabbit had already approved it. The real signal is the reviews endpoint
itself: an acknowledgement is a plain issue comment, never a review submission, so it
can never be mistaken for one. provider_state() now reports the most recent terminal
review directly (state=APPROVED|CHANGES_REQUESTED|COMMENTED threads=N since=TIMESTAMP),
falling back to the rate-limit/none scan only when no review has landed yet.

review-transition.sh gains a lightweight --observe --since TIMESTAMP mode that answers
"has the review landed since I triggered it" without repeating the full ready-transition
and provider-spend flow, returning LANDED (or PENDING); its TRIGGERED/ALREADY_SPENT
results now carry that since= boundary. merge-gate.sh accepts LANDED as evidence-green,
exactly like AUTO_REVIEW/ALREADY_SPENT.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
… into feat/issue-395

# Conflicts:
#	tests/test-gh-pr-state.sh
…eanly

AGENT_REVIEW_PROVIDERS=github-code-quality was accepted at plan time even
when the repository had GitHub Code Quality disabled, and code-quality-state.sh
then died mid-gate on a raw 403. code-quality-state.sh gains --probe: a single
lightweight request that decides state=enabled/not-enabled/unknown, treating
only a confirmed "not enabled" 403 message as proof of disablement -- every
other failure (network, auth/scope, 5xx) reports unknown and fails closed.
review-provider-config.sh --probe uses it once to downgrade the declared
github-code-quality plan line on a confirmed not-enabled, leaving every other
provider and the default (no --probe) call path -- including review-transition.sh -- byte-for-byte
unchanged. The review-remote-pr Step 5 recipe probes before fetching findings
instead of dying on the 403, and merge-gate.sh accepts
--code-quality-scan-state not-enabled as a pass, since a disabled repository
has no scan to wait for.

Closes #403.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f9dcaabd-6621-4843-81fc-cce5ece867a6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

mergetest and others added 2 commits August 23, 2026 14:17
Adversarial review of PR #418 found that neither gh-pr-state.sh's provider_state()
nor review-transition.sh's new --observe path checked a review's own commit_id: a
CodeRabbit review submitted against an OLD head can finish AFTER the PR advances to a
new one, with a submitted_at that looks perfectly current. That let a stale review
(of code nobody has reviewed) be reported/accepted as landed evidence for the current
head -- the exact failure this issue set out to fix, arriving from the other direction.

Both selectors now require the review's commit_id to match the current head (fetched
fresh for --observe, read from the already-fetched PR metadata for the digest) before
calling it landed/reviewed. A terminal review that exists but targets a different head
is reported distinctly (stale-head / STALE_HEAD) -- never reviewed/LANDED (misrepresents
stale evidence as current) and never none/PENDING (hides that a review exists at all).
merge-gate.sh blocks STALE_HEAD exactly like an in-flight TRIGGERED review.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
@thewrz

thewrz commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator Author

This was written agentically; verify its assertions:

Adversarial review receipt

  • Reviewer: provider=openai; model=gpt-5.6-terra; effort=xhigh; mode=cross-provider (reason: peer-cli=codex present; Claude session reviews cross-provider)
  • Counts: P1=0; P2=0; total=0
  • Confirmed finding: none confirmed

🤖 Co-authored by Claude Opus 5 (root).

auto-merge.md still described --code-quality-scan-state as complete|pending
after issue #403 added a third value; the STALE_HEAD provider-result direction
was already current (issue #395 documented it in the same file). Updates the
bullet to name not-enabled and explain it gates exactly like complete, while
an unreadable probe (network failure, auth/scope 403, a 5xx) still blocks.
Prose only, no behavior change.

Co-Authored-By: Claude claude-sonnet-5 <noreply@anthropic.com>
@thewrz
thewrz changed the base branch from feat/issue-395 to main August 23, 2026 22:32
Integrates the advanced base into this branch ahead of its own retarget.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@thewrz
thewrz marked this pull request as ready for review August 23, 2026 22:38
@thewrz
thewrz merged commit 2fd17e2 into main Aug 23, 2026
4 checks passed
thewrz pushed a commit that referenced this pull request Aug 23, 2026
Integrates the advanced base into this branch ahead of its own retarget.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
thewrz pushed a commit that referenced this pull request Aug 23, 2026
Integrates the advanced base into this independent root before its merge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@thewrz
thewrz deleted the feat/issue-403 branch August 26, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(review-remote-pr): review-provider-config.sh should detect Code Quality disabled (403) and report the provider as effectively none

1 participant