Repository navigation
feat(workflow): retry HTTP 5xx and fail loud in llm-enrichment.yml - #599
Merged
neuromechanist merged 2 commits intoMay 23, 2026
Conversation
Closes #598. The template at backend/src/services/github.ts now retries transient curl-level failures and HTTP 5xx from /webhooks/llm-enrich up to 3 times with linear backoff, treats HTTP 4xx as terminal config errors, and exits 1 on persistent failure. Previously every non-2xx exited 0 as a 'non-blocking warning' which silently desynced D1 from the repo and is unacceptable for the OpenNeuro mass-import.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR599Version: 🤖 Updated on each push. |
Code-review findings: 1) 401 was treated as terminal alongside other 4xx codes, but during a NEMAR_WEBHOOK_TOKEN rotation a brief 401 race across Workers instances is realistic and would silently abort every in-flight workflow at attempt 1. Add a 401 carve-out so the retry loop covers the rotation window; persistent 401 still hits the post-loop exit 1. 2) Add an anchored regex assertion that the post-loop branch contains exit 1, so a future edit that removes the exit code while keeping the log message is caught by the test.
neuromechanist
deleted the
598-workflow-template-retry-http-5xx-and-fail-loud-on-persistent-enrichment-failure
branch
May 23, 2026 13:52
This was referenced May 23, 2026
neuromechanist
added a commit
that referenced
this pull request
May 23, 2026
…ub dispatch Closes #602. Phase 1 of epic #601. Removes the per-repo .github/workflows/llm-enrichment.yml that shipped to 123 dataset repos via deployWorkflows() and replaces it with: - A new Worker endpoint POST /webhooks/github that receives GitHub App push events, HMAC-verifies the signature, filters to nemarDatasets dataset repos pushing README.md/dataset_description.json/.nemar/ metadata.json on main or release/** branches, and fires repository_dispatch[run-enrichment] at nemarDatasets/.github. - A new triggerEnrichmentRun() helper mirroring triggerManifestGeneration(). - A new webhook-signature service implementing HMAC-SHA256 verification with a constant-time compare (no crypto.timingSafeEqual on Workers). - The central run-enrichment.yml workflow lives on nemarDatasets/.github (see nemarDatasets/.github#5). It mints a per-repo App token scoped to the target dataset_id, checks out the dataset repo at the given ref, and reuses the same Worker round-trip + retry contract as the legacy per-repo workflow (#599). Tests added: webhook-signature.test.ts (11 cases), trigger-enrichment.test.ts (4 cases), webhook-github-push.test.ts (19 cases) covering the dispatch filter table. workflow-yaml.test.ts updated to assert the template is no longer shipped. Cutover script: scripts/strip-per-repo-llm-enrichment.ts deletes the legacy file from every dataset repo. Idempotent. Operator runs once after the App webhook URL is pointed at the new endpoint.
This branch was previously deployed
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.
Closes #598.
Problem
The per-dataset `.github/workflows/llm-enrichment.yml` swallowed every non-2xx response from `/webhooks/llm-enrich` as `::warning::LLM enrichment failed - this is non-blocking` and exited 0. So:
Fix (workflow template in `backend/src/services/github.ts`)
Replace the single-shot fire-and-forget with a 3-attempt linear-backoff retry loop:
Pairs with #596 (Worker-side 401 self-heal) — together a one-off stale-App-token-401 is fully transparent to the user.
Rollout
This template is the source of truth; existing repos still carry the old version. After this merges + deploys, sync by calling `POST /admin/datasets/:id/ci/sync` against each of the 123 dataset repos (the sync handler is idempotent and only writes drifted files).
Test plan