fix(review): never approve/merge red CI — close-on-red + CI trigger + status legend + clickable visual table - #1075
Conversation
…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.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
|
Note 🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦🟦 💡 Gittensory review — advisory only
💡 Advisory only — PR closed before full evaluation. No late first comment was created.
🟩 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
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
ghost
left a comment
There was a problem hiding this comment.
Gittensory requests changes — CI is not green:
- CI is failing (codecov/project, codecov/patch)
Superseded — duplicate from a CI-completion re-review storm (fixed by coalescing in this PR).
…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.
Fixes the reported bug where gittensory said "CI green" / "safe to merge" and APPROVED a PR with a failing codecov/patch.
CI policy (G)
fetchLiveCiAggregatereads 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).deriveUnifiedStatus: red CI downgrades any "merge" verdict to Blocked (no more "safe to merge" over red).Trigger (F)
check_run/check_suitecompletion re-reviews the PR (merge on green, close/hold on red); hourly sweep backstop;deployment_statusre-review for visuals.Comment (H) + Visual (I)
3448 tests pass; typecheck clean.