Skip to content

fix(review): stop mis-closing registry edits and AI-guessed CI diagnoses - #7670

Merged
JSONbored merged 2 commits into
mainfrom
claude/loopover-gittensory-orb-bugs-a63c52
Jul 21, 2026
Merged

fix(review): stop mis-closing registry edits and AI-guessed CI diagnoses#7670
JSONbored merged 2 commits into
mainfrom
claude/loopover-gittensory-orb-bugs-a63c52

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

Two review-accuracy bugs in the registry/CI-review pipeline, both confirmed against real closed PRs (read-only investigation, no action taken on those PRs themselves):

  • The registry surface lane's duplicate check compared an appended entry against the raw base surfaces[] array, so any in-place edit of an already-registered surface (same url, changed fields) collided with its own prior self and closed as a "duplicate resubmission" -- regardless of whether the edit was correct. Every legitimate content-fix PR to a registry file was hitting this. Fixed by only counting a base entry as still "existing" when it survives byte-identical into head. Also fixed a compounding bug where every such finding's real reason (detail/publicText) was silently dropped from the "Why this is blocked" panel in favor of a constant, uninformative title.
  • The AI reviewer, given only a failing check's name with no error detail, was writing a confidently-hedged content-level diagnosis and getting that guess quoted verbatim into the auto-close message -- directly against its own existing "do not assert a defect on code you cannot see" instruction. Tightened the grounding guidance to explicitly forbid this exact pattern, and added a new deterministic fact (commits the default branch has advanced since this PR's base, via the compare API) so an undetailed CI failure on a stale branch gets attributed correctly instead of guessed at.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves -- no issue exists; these were found via direct maintainer investigation, not the contributor pipeline.

Validation

  • git diff --check
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage locally (unsharded) -- 19618 passed, 0 failed; every line/branch touched by this diff is 100% covered (verified directly against lcov.info, not just the console table).
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • npm audit --audit-level=moderate -- 0 vulnerabilities
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries
  • Full npm run test:ci (all ~35 steps) run clean end to end, in isolation.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests. -- N/A, no such changes.
  • API/OpenAPI/MCP behavior is updated and tested where needed. -- N/A, no API/OpenAPI/MCP surface touched.
  • UI changes use live API data or real empty/error/loading states -- N/A, no UI changes.
  • Visible UI changes include a UI Evidence section -- N/A, no UI changes.
  • Public docs/changelogs are updated where needed -- N/A, no docs/changelog changes.

Notes

Backend-only, no UI/API/MCP surface touched. Both bugs were diagnosed by tracing this repo's own source against the bot's real comments on live PRs (read-only gh calls), not by guessing from the bug report alone.

…submission

The registry surface lane's duplicate check compared an appended entry's
identity key against the raw base surfaces[] array, so editing an
already-registered entry in place (same url, changed fields -- e.g.
tightening probe.expect after live-verification) collided with its own
prior self and closed as a resubmitted duplicate, regardless of whether
the edit was correct. Every legitimate "fix an existing surface" PR hit
this. survivingExistingEntries now only counts a base entry as still
"existing" when it survives byte-identical into head, so an edit is
validated as content instead of auto-flagged as a duplicate.

Also fixes a compounding issue in the unified comment renderer: every
gate blocker finding from this lane shares the same constant title
("Registry surface review"), and only the title was ever rendered under
"Why this is blocked" -- the actual, verdict-specific reason in
finding.detail/publicText was silently dropped from the panel for every
close.
…d CI check failed

Confirmed against a real closed PR that the AI reviewer, given only a
failing check's name (no error text, no file content), was writing a
confidently-hedged content-level diagnosis ("this likely means a field
mismatch... which isn't visible in this diff") and getting that guess
quoted verbatim into the auto-close message -- directly against its own
existing "do not assert a defect on code you cannot see" instruction.
GROUNDING_GUIDANCE now explicitly names and forbids this exact hedge
pattern, and a failing check with no detail is marked "(no detail
provided)" in-line so the model can't miss it.

Also adds a new, genuinely verifiable fact for the same case: how many
commits the repository's current default branch has landed since this
PR's own base commit, via GitHub's compare API. Unlike the
mergeable_state "behind" signal the review pipeline already uses
elsewhere, this works regardless of a repo's branch-protection
configuration, so the reviewer can correctly attribute an unexplained CI
failure to a stale base instead of guessing a content defect.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@JSONbored JSONbored self-assigned this Jul 21, 2026
@JSONbored
JSONbored merged commit e78a03d into main Jul 21, 2026
6 checks passed
@JSONbored
JSONbored deleted the claude/loopover-gittensory-orb-bugs-a63c52 branch July 21, 2026 07:09
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.51%. Comparing base (3629080) to head (6af259d).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7670      +/-   ##
==========================================
- Coverage   88.51%   88.51%   -0.01%     
==========================================
  Files         724      724              
  Lines       76020    76045      +25     
  Branches    22629    22635       +6     
==========================================
+ Hits        67291    67308      +17     
- Misses       7681     7688       +7     
- Partials     1048     1049       +1     
Flag Coverage Δ
shard-1 35.70% <18.18%> (-0.01%) ⬇️
shard-2 32.95% <9.09%> (-0.03%) ⬇️
shard-3 28.63% <81.81%> (-0.02%) ⬇️
shard-4 40.52% <39.39%> (-0.11%) ⬇️
shard-5 33.99% <24.24%> (-0.01%) ⬇️
shard-6 35.91% <18.18%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/github/backfill.ts 95.96% <100.00%> (+0.01%) ⬆️
src/queue/ai-review-orchestration.ts 100.00% <100.00%> (ø)
src/review/content-lane/orchestrator.ts 100.00% <100.00%> (ø)
src/review/grounding-wire.ts 97.00% <100.00%> (+0.22%) ⬆️
src/review/review-grounding.ts 98.80% <100.00%> (+3.80%) ⬆️
src/review/unified-comment-bridge.ts 99.62% <100.00%> (+<0.01%) ⬆️

... and 2 files with indirect coverage changes

JSONbored added a commit that referenced this pull request Jul 21, 2026
…eable_state blind spot it depends on (#7686)

The base-branch staleness fact shipped in #7670 anchored its compare-API
read on a PR's own base.sha -- but GitHub keeps that field pointed at the
live tip of the target branch as it moves, so comparing it against the
current default branch would read ~0 regardless of how stale a PR's
actual code is, making the fact effectively dead. Anchors on the PR's
HEAD instead, which the compare API resolves via a true git merge-base,
independent of that metadata timing.

Also adds gate.staleBaseAheadByThreshold: when a repo opts in, the
pre-review readiness gate (prReadyForReview) forces an update_branch
once the default branch has advanced at least that many commits beyond
a PR's head -- the same action the existing BEHIND-base path takes, but
triggered by the same compare-API read rather than GitHub's own
mergeable_state, which only ever reports "behind" when a repo's branch
protection requires branches to be up to date before merging. A repo
without that setting can have a PR genuinely dozens of commits behind
and never see it auto-rebased before review otherwise.
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.

1 participant