Skip to content

fix(selfhost): keep review queue live and verify configured CI - #2843

Merged
JSONbored merged 1 commit into
mainfrom
claude/lucid-agnesi-23f308
Jul 3, 2026
Merged

fix(selfhost): keep review queue live and verify configured CI#2843
JSONbored merged 1 commit into
mainfrom
claude/lucid-agnesi-23f308

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Add settings.expectedCiContexts (.gittensory.yml gate.expectedCiContexts) as a generic fallback/merge source for CI required-status-check verification when GitHub branch protection is unreadable (no administration:read) or unconfigured — wired through the settings resolver, OpenAPI schema, and the request-scoped required-context/live-CI caches (cache keys now include expectedCiContexts so a config change can't reuse a stale merge).
  • Add a foreground-liveness invariant (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.
  • Reclassify current-head agent-regate-pr work (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.
  • Add processing/runnable-now gauges, a release-reason-labeled counter, dashboard panels, and alerts distinguishing "queue large but intentionally deferred" from "queue stuck" without manual SQL.

Scope

  • src/** backend changes only (queue admission/liveness, CI verification, settings)
  • No repo-specific hardcoding — all changes are generic self-host engine behavior, config-driven via .gittensory.yml
  • Generated artifacts regenerated: apps/gittensory-ui/public/openapi.json, apps/gittensory-ui/src/lib/selfhost-env-reference.ts

Validation

  • npm run typecheck
  • npm run test:coverage (full unsharded suite; 3 pre-existing unrelated failures noted below)
  • git diff --check
  • npm run ui:openapi:check / ui:openapi:settings-parity
  • npm run db:migrations:check
  • npm run cf-typegen:check
  • npm run selfhost:validate-observability
  • npm run selfhost:env-reference:check
  • Rebased onto latest origin/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 except src/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.ts fails because .github/workflows/audit.yml doesn't yet match an in-progress runner-label migration; the other two spawn scripts/check-migrations.mjs/check-schema-drift.mjs as subprocesses that don't produce output in this environment even though the scripts themselves run cleanly standalone (npm run db:migrations:check passes directly). None of these files were touched by this PR.

Safety

  • No secrets/wallet/hotkey/trust-score/reward terms introduced
  • No changes to site/, CNAME, **/lovable/**
  • No CHANGELOG.md edit

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).
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@JSONbored JSONbored self-assigned this Jul 3, 2026
@JSONbored
JSONbored merged commit d8801ee into main Jul 3, 2026
11 checks passed
@JSONbored
JSONbored deleted the claude/lucid-agnesi-23f308 branch July 3, 2026 22:28
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.23%. Comparing base (1e6a87a) to head (8f366a5).
⚠️ Report is 5 commits behind head on main.
✅ All tests successful. No failed tests found.

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           
Files with missing lines Coverage Δ
src/github/backfill.ts 97.14% <100.00%> (+0.01%) ⬆️
src/github/rate-limit.ts 100.00% <ø> (ø)
src/openapi/schemas.ts 100.00% <ø> (ø)
src/queue/processors.ts 92.78% <ø> (+0.01%) ⬆️
src/selfhost/foreground-liveness.ts 100.00% <100.00%> (ø)
src/selfhost/maintenance-admission.ts 100.00% <ø> (ø)
src/selfhost/metrics.ts 100.00% <ø> (ø)
src/selfhost/queue-common.ts 94.64% <100.00%> (+0.06%) ⬆️
src/selfhost/sqlite-queue.ts 99.52% <100.00%> (+0.04%) ⬆️
src/signals/focus-manifest.ts 99.38% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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