feat(ops): ingestion autopilot, flake ledger, and CI failure triage#588
Conversation
Wave 2c. Three linked reliability tools; the two live/CI workflows ship inert. Ingestion autopilot (self-heals silent queue stalls): - scripts/ingestion-autopilot.ts: pure assessIngestionHealth() flags a stuck queue (failed jobs, or a processing job locked past a stale threshold) from the read-only reindex-health JSON; only with --apply does it run the existing recover-ingestion-queue path. Alerts (non-zero) only on unreachable Supabase or failed recovery. Dry-run by default. - .github/workflows/ingestion-autopilot.yml: SHIPPED DISABLED (dispatch-only, schedule commented). Apply is double-gated (dispatch input AND repo var INGESTION_AUTOPILOT_APPLY). check:supabase-project guard, pinned actions. Flake ledger (stop re-diagnosing known flakes): - tests/flake-ledger.json: the 4 known Playwright flakes with reasons/refs. - scripts/flake-ledger.mjs: loader + isKnownFlake() + --self-test/--list/--match. CI failure triage: - .github/workflows/ci-triage.yml: SHIPPED INERT (no-op until repo var CI_TRIAGE_ENABLED=true). On PR CI failure, posts ONE comment classifying each failed job as main-side (also failing on latest main — CI merges with current main), possible-known-flake (UI job → flake ledger), or needs-investigation. Reads only job metadata + the trusted default-branch flake ledger; never runs PR code; least-privilege token. Verified: 9/9 vitest, flake-ledger --self-test, check:github-actions, tsc, eslint, prettier — all green. No live provider/API calls in CI. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds CI failure triage with flake-ledger classification and pull-request comments, plus an ingestion autopilot CLI and GitHub Actions workflow for health checks, dry-run recovery, apply-mode recovery, and failure alerts. ChangesCI failure triage
Ingestion queue autopilot
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant WorkflowRun
participant CIJobsAPI
participant FlakeLedger
participant PullRequest
WorkflowRun->>CIJobsAPI: list failed jobs
CIJobsAPI->>FlakeLedger: read ledger entries
FlakeLedger-->>CIJobsAPI: return matching flake data
CIJobsAPI->>PullRequest: create or update triage comment
sequenceDiagram
participant WorkflowDispatch
participant IngestionAutopilot
participant ReindexHealth
participant RecoverIngestionQueue
WorkflowDispatch->>IngestionAutopilot: start with execution flags
IngestionAutopilot->>ReindexHealth: request health probe
ReindexHealth-->>IngestionAutopilot: return health JSON
IngestionAutopilot->>RecoverIngestionQueue: run recovery when apply is enabled
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9122feef29
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| APPLY_REQUESTED: ${{ github.event.inputs.apply }} | ||
| APPLY_ALLOWED: ${{ vars.INGESTION_AUTOPILOT_APPLY }} | ||
| run: | | ||
| if [ "$APPLY_REQUESTED" = "true" ] && [ "$APPLY_ALLOWED" = "true" ]; then |
There was a problem hiding this comment.
Allow scheduled autopilot runs to apply recovery
When the commented schedule is enabled, scheduled events do not have github.event.inputs.apply, so APPLY_REQUESTED is empty and this condition can never take the apply path even if INGESTION_AUTOPILOT_APPLY=true. A stuck queue would only run the dry-run command, exit 0, and skip the alert issue, leaving the promised self-healing cadence inert; gate scheduled recovery on the repo var separately from the manual dispatch input.
Useful? React with 👍 / 👎.
| repo: context.repo.repo, | ||
| event: "push", | ||
| branch: context.payload.repository.default_branch, | ||
| per_page: 1, |
There was a problem hiding this comment.
Query enough main runs to find the CI workflow
This fetches only the single latest default-branch workflow run across the repository, then later looks for one whose name matches CI. If any other workflow ran on main more recently than CI, latestMain is undefined and mainFailingJobs stays empty, so PR failures caused by an already-broken main are mislabeled as flakes or needing investigation. Query the specific workflow or fetch enough runs before selecting the latest matching CI run.
Useful? React with 👍 / 👎.
What
Wave 2c — three linked reliability tools. Both live/CI workflows ship inert (nothing runs until you enable it).
Ingestion autopilot (self-heals silent queue stalls)
scripts/ingestion-autopilot.ts— pureassessIngestionHealth()flags a stuck queue (failed jobs, or aprocessingjob locked past a stale threshold) from the read-onlyreindex-healthJSON. Only with--applydoes it run the existingrecover-ingestion-queuepath. Alerts (non-zero) only on unreachable Supabase or failed recovery. Dry-run by default. (Decision is based purely onreindex-health—check-indexingis intentionally not chained, as it needs the OpenAI+Python stack and is a strict corpus gate.).github/workflows/ingestion-autopilot.yml— SHIPPED DISABLED (dispatch-only; schedule commented). Apply is double-gated: dispatch inputapply=trueAND repo varINGESTION_AUTOPILOT_APPLY=true.check:supabase-projectguard, pinned actions.Flake ledger (stop re-diagnosing known flakes)
tests/flake-ledger.json— the 4 known Playwright flakes with reasons/refs.scripts/flake-ledger.mjs— loader +isKnownFlake()+--self-test/--list/--match.CI failure triage
.github/workflows/ci-triage.yml— SHIPPED INERT (no-op until repo varCI_TRIAGE_ENABLED=true). On PR CI failure, posts ONE comment classifying each failed job as main-side (also failing on the latestmainrun — CI merges with current main, which has cost debugging time before), possible known flake (UI job → flake ledger), or needs investigation. Reads only job metadata + the trusted default-branch flake ledger; never runs PR code; least-privilege token.Verification
9/9 vitest (autopilot assessment + flake ledger),
flake-ledger --self-test,check:github-actions,tsc --noEmit, eslint, prettier — all green. No live provider/API calls in CI.Enabling (operator steps)
SUPABASE_SERVICE_ROLE_KEYsecret, run one dispatch dry-run, then uncommentschedule:(and setINGESTION_AUTOPILOT_APPLY=trueto allow recovery).CI_TRIAGE_ENABLED=true.🤖 Generated with Claude Code