Skip to content

fix(review): never approve/merge red CI — close-on-red + CI trigger + status legend + clickable visual table - #1075

Merged
JSONbored merged 2 commits into
mainfrom
fix/ci-policy-legend-visual
Jun 22, 2026
Merged

fix(review): never approve/merge red CI — close-on-red + CI trigger + status legend + clickable visual table#1075
JSONbored merged 2 commits into
mainfrom
fix/ci-policy-legend-visual

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Fixes the reported bug where gittensory said "CI green" / "safe to merge" and APPROVED a PR with a failing codecov/patch.

CI policy (G)

  • fetchLiveCiAggregate reads the LIVE CI over both check-runs AND commit-statuses (codecov posts a commit-status, not a check-run — that's why a red codecov was invisible).
  • Planner: never approve/merge unless CI is green; red CI → request-changes + close non-owner (citing the failing checks) / hold owner open; pending CI → defer (settle-before-decide); unverified → hold.
  • deriveUnifiedStatus: red CI downgrades any "merge" verdict to Blocked (no more "safe to merge" over red).

Trigger (F)

  • check_run/check_suite completion re-reviews the PR (merge on green, close/hold on red); hourly sweep backstop; deployment_status re-review for visuals.

Comment (H) + Visual (I)

  • Color-coded status legend; before/after = clean table of clickable thumbnails (desktop/mobile rows + route captions). Screenshots enabled.

3448 tests pass; typecheck clean.

…n trigger + status legend + clickable visual table

CI policy (core bug: gittensory said "CI green" / "safe to merge" + approved a PR with a failing
codecov/patch). codecov posts a classic COMMIT-STATUS, not a check-run, and the review path only read
check-runs (and stored summaries), so a red commit-status was invisible. Now:
- backfill.ts fetchLiveCiAggregate(): live aggregate over BOTH /check-runs AND /commits/{sha}/status, so any
  red check (required or not — codecov included) is seen. passed / failed / pending / unverified.
- agent-actions planner factors ciState: NEVER approve/merge unless CI is green; a red CI is request-changes
  and closes a non-owner PR (citing the failing checks) while the owner's is held open; a pending CI defers
  every action (settle-before-decide); an unverified CI holds for a human.
- maybeRunAgentMaintenance + the unified-comment publish path both use the live aggregate, so the public CI
  chip and the disposition can never disagree.
- deriveUnifiedStatus: a failing CI downgrades any optimistic "merge" verdict to BLOCKED.

Auto-merge / close trigger: check_run/check_suite "completed" re-reviews the PR (merge on green,
close-non-owner / hold-owner on red); the hourly re-gate sweep also runs maintenance as a backstop;
deployment_status re-reviews so the visual "after" capture fills in.

Comment: color-coded status legend; visual before/after section is now a clean table of CLICKABLE THUMBNAILS
(small <img> wrapped in <a href> to the full-size shot) with desktop/mobile rows + route captions.
GITTENSORY_REVIEW_SCREENSHOTS enabled.
@dosubot dosubot Bot added the size:L label Jun 22, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.02985% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.92%. Comparing base (d7f4ccf) to head (23d33bf).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/queue/processors.ts 15.00% 38 Missing and 13 partials ⚠️
src/github/backfill.ts 36.36% 11 Missing and 10 partials ⚠️
src/review/unified-comment-bridge.ts 83.33% 1 Missing and 1 partial ⚠️
src/settings/agent-actions.ts 96.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
- Coverage   95.28%   94.92%   -0.36%     
==========================================
  Files         149      149              
  Lines       18053    18155     +102     
  Branches     6535     6581      +46     
==========================================
+ Hits        17202    17234      +32     
- Misses        363      413      +50     
- Partials      488      508      +20     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghost

ghost commented Jun 22, 2026

Copy link
Copy Markdown

Note

🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦

💡 Gittensory review — advisory only

0 files · no blockers · readiness 0/100

💡 Advisory only — PR closed before full evaluation. No late first comment was created.

Signal Result Evidence
Code review ✅ No blockers synthesized
Gate result ⚠️ Skipped #1075 is no longer open.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

ghost
ghost previously requested changes Jun 22, 2026

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Gittensory requests changes — CI is not green:

  • CI is failing (codecov/project, codecov/patch)

@JSONbored
JSONbored dismissed stale reviews from ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , ghost , and ghost June 22, 2026 23:12

Superseded — duplicate from a CI-completion re-review storm (fixed by coalescing in this PR).

@JSONbored
JSONbored merged commit 9223ab3 into main Jun 22, 2026
17 of 19 checks passed
@JSONbored
JSONbored deleted the fix/ci-policy-legend-visual branch June 22, 2026 23:13
JSONbored added a commit that referenced this pull request Jun 23, 2026
…1084)

* fix(github): cache installation tokens — stop the rate-limit storm that dead-lettered reviews

ROOT CAUSE of the dead-lettered reviews + stale head SHAs: createInstallationToken minted a FRESH GitHub token
on EVERY call (no cache). The converged review path mints several tokens per review (live CI aggregate, mergeable
fetch, file resolve, visual capture, permission check) and across the sweep + re-reviews this exhausted the
hourly GitHub rate limit (observed min_remaining=0 at 6753 calls/hr) → reviews errored → dead-lettered → missed
synchronize webhooks → stale stored head SHAs → reviews ran against the old (green) commit → wrong 'CI is green'
approvals after a rebase. FIX: in-isolate token cache (valid ~1h, 2-min safety margin) → ~1 mint/hour/installation
instead of per-call. Tests: clear the cache per-test; token-count assertions drop to the cached count.

* fix(review): re-gate sweep RE-PUBLISHES (refresh stale comments/labels on idle PRs)

The sweep re-gated + ran auto-maintain but never re-published the unified comment, so an idle PR kept a stale
comment ('safe to merge' from before a fix) + stale status label forever even after the head was re-synced.
Switch to reReviewStoredPullRequest (rebuild advisory → re-publish comment with current head/CI → re-run
auto-maintain) so comment + label + action reflect reality. Paced at SWEEP_MAX_PRS/sweep; cheap with token caching.

* fix(ai-review): raise neuron budget off the free-tier 10k cap (enterprise) + interactive re-run checkbox

The 10k AI_DAILY_NEURON_BUDGET default starved EVERY dual-AI review (~573 neurons each)
into quota_exceeded on the enterprise Workers AI plan (account does hundreds of k/day),
so no review ever produced its synthesis. Models were correct all along (gpt-oss-120b +
nemotron-3-120b-a12b); the self-imposed cap was the sole blocker.

- AI_DAILY_NEURON_BUDGET 10k -> 2M; code clamp ceiling 1M -> 10M (runaway backstop, not a cap)
- AI_MAX_OUTPUT_TOKENS 256 -> 1024 (room for a real assessment + suggestions + risks)
- unified-comment: render the re-run checkbox OUTSIDE the alert blockquote — GitHub disables
  task-list checkboxes inside a blockquote, so clicking it never fired issue_comment.edited
- sweep: keep the full re-review re-publish (affordable under the raised budget) so idle PRs
  refresh their comment/label/synthesis and dead-lettered reviews get a fresh verdict

* fix(review): unbounded gate check-run title 422'd → aborted the WHOLE review (no comment/audit/close)

THE root cause of 'nothing works': formatGateCheckOutput returned output.title unbounded.
GitHub 422s an over-long check-run title; the throw escaped createOrUpdateGateCheckRun
(unwrapped) and the outer catch RE-THREW, so the review aborted before publishing the
comment, writing the audit row, and running auto-maintain (merge/close). #1075 appended
failing-check names to the title, so RED-CI PRs got long titles → 422 → they were never
reviewed or closed — exactly the PRs that should auto-close.

- advisory.ts: cap gate output.title at 255 (matches the annotation cap) — prevents the 422
- processors.ts: wrap createOrUpdateGateCheckRun in a local try/catch — a check-run API
  failure now finalizes the pending check to neutral and CONTINUES (records
  github_app.gate_check_failed_nonfatal) instead of dead-lettering the whole review
- tests updated for the non-fatal-continue behavior

* fix(review): production reliability pass (budget/loop/merge/notify)

- ai-review: neuron budget defaults to the safe max when unset/empty/NaN. The deployed worker read the 10k free-tier default off main and starved every dual-AI review into quota_exceeded; an explicit value (incl. "0" to disable) still wins.
- review loop: refresh reviewDecision live so the action planner does not re-post a review every cycle.
- CI gate: only branch-protection REQUIRED red checks block; non-required reds are surfaced, not blocking.
- merges: classify terminal merge failures (perm/conflict/required-absent) and stop retrying them every sweep; transient failures retry to a cap (+ migration 0052).
- safety: dial back the secret_leak heuristic so config/workflow PRs are not false-blocked.
- stats: read the live audit_events overlay for homepage counters.
- notify: per-repo Discord embeds on merge/close/manual.
- rebase: update-branch before review when behind base.
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