fix(selfhost): keep review queue live and verify configured CI - #2843
Merged
Conversation
Two self-host review-stack problems, fixed together: CI verification: branch-protection required-status-check reads are unreadable on many self-host installs (no administration:read grant), so the live-CI aggregate fell back to a hardcoded fold-all heuristic tuned to this repo's own CI job names. A repo with different CI naming got stuck pending or lost completeness verification. Add settings.expectedCiContexts (config-as-code, .gittensory.yml gate.expectedCiContexts) as a generic fallback/merge source for required contexts, threaded through the settings resolver, OpenAPI schema, and the request-scoped required-context/live-CI caches (whose cache keys now include expectedCiContexts so a config change can't serve a stale merge). Queue liveness: the self-host queue had no invariant guaranteeing foreground (contributor-PR-review) work stays runnable. GitHub rate-limit admission and the rate-limit budget sweep can defer a foreground job for its full computed window (up to ~65 minutes) with no floor, unlike maintenance work's own trickle escape hatch. Add a foreground-liveness sweep (foreground-liveness.ts) that periodically releases a foreground job once it has genuinely waited too long, or immediately once re-checking its rate-limit admission against current observations shows it would be admitted now -- runs at boot too, so a restart self-heals inherited over-deferral. Reclassify current-head agent-regate-pr work (trailing re-reviews, sibling wakes, linked-issue re-reviews, outage-repair candidates) as live/foreground for rate-limit admission, distinct from the scheduled sweep's own stale-candidate fan-out, which stays background. Add processing/runnable-now gauges, a release-reason-labeled counter, dashboard panels, and alerts so "queue large but intentionally deferred" is distinguishable from "queue stuck" without manual SQL. Validated: npm run typecheck, npm run test:coverage (full suite), git diff --check, ui:openapi/settings-parity, db:migrations:check, cf-typegen:check, selfhost:validate-observability, and selfhost:env-reference all clean. Every added/changed line in src/** has 100% line and branch coverage except src/server.ts (codecov-ignored, integration-tested).
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 8f366a5 | Commit Preview URL Branch Preview URL |
Jul 03 2026, 10:25 PM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2843 +/- ##
=======================================
Coverage 96.22% 96.23%
=======================================
Files 256 257 +1
Lines 28022 28085 +63
Branches 10181 10207 +26
=======================================
+ Hits 26965 27028 +63
Misses 433 433
Partials 624 624
🚀 New features to boost your workflow:
|
This was referenced Jul 3, 2026
This was referenced Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
settings.expectedCiContexts(.gittensory.ymlgate.expectedCiContexts) as a generic fallback/merge source for CI required-status-check verification when GitHub branch protection is unreadable (noadministration:read) or unconfigured — wired through the settings resolver, OpenAPI schema, and the request-scoped required-context/live-CI caches (cache keys now includeexpectedCiContextsso a config change can't reuse a stale merge).src/selfhost/foreground-liveness.ts) so contributor-PR-review work in the self-host queue can never be silently parked: a periodic sweep releases a foreground job once it's genuinely waited too long, or immediately once re-checking its rate-limit admission against current observations shows it would be admitted now. Runs at boot too, so a restart self-heals inherited over-deferral.agent-regate-prwork (trailing re-reviews, sibling wakes, linked-issue re-reviews, outage-repair candidates surfaced by the existing repair-priority mechanism) as live/foreground for GitHub rate-limit admission, distinct from the scheduled sweep's own stale-candidate fan-out, which stays background.Scope
src/**backend changes only (queue admission/liveness, CI verification, settings).gittensory.ymlapps/gittensory-ui/public/openapi.json,apps/gittensory-ui/src/lib/selfhost-env-reference.tsValidation
npm run typechecknpm run test:coverage(full unsharded suite; 3 pre-existing unrelated failures noted below)git diff --checknpm run ui:openapi:check/ui:openapi:settings-paritynpm run db:migrations:checknpm run cf-typegen:checknpm run selfhost:validate-observabilitynpm run selfhost:env-reference:checkorigin/main; all conflicts (with the newly-landed claim-time fairness / backlog-convergence sweep work) resolved and re-verified — full relevant test suite (1224 tests across 10 files) green post-rebase.Every added/changed line in
src/**has 100% line and branch coverage exceptsrc/server.ts(already codecov-ignored, integration-tested via the Docker boot smoke test).Note: 3 pre-existing test failures (
check-migrations-script.test.ts,check-schema-drift-script.test.ts,workflow-runner-labels.test.ts) are unrelated to this diff —workflow-runner-labels.test.tsfails because.github/workflows/audit.ymldoesn't yet match an in-progress runner-label migration; the other two spawnscripts/check-migrations.mjs/check-schema-drift.mjsas subprocesses that don't produce output in this environment even though the scripts themselves run cleanly standalone (npm run db:migrations:checkpasses directly). None of these files were touched by this PR.Safety
site/,CNAME,**/lovable/**CHANGELOG.mdedit