Skip to content

LLM enrichment pipeline re-runs on already validated metadata #162

Closed

Description

@neuromechanist

Problem

The llm-enrichment.yml CI workflow triggers on every push to README.md or dataset_description.json on main. The POST /webhooks/llm-enrich handler always runs the full pipeline (seed -> LLM enrich -> MeSH validate -> LLM judge validate), regardless of whether .nemar/metadata.json already has pipeline_stage: "validated".

This means:

  • Unnecessary LLM API calls (OpenRouter costs)
  • Risk of overwriting a human-curated or already-validated result with a potentially different LLM output
  • Minor README formatting changes trigger a full re-enrichment

Current behavior

push README.md -> CI triggers -> webhook called -> full pipeline runs -> metadata.json overwritten

No check for current pipeline_stage or whether the changes are significant enough to warrant re-enrichment.

Expected behavior

The webhook should check whether re-enrichment is warranted:

  1. Read existing .nemar/metadata.json and check pipeline_stage
  2. If already validated:
    • Compare the incoming dataset_description.json against what was used to seed (author changes, title changes, license changes are significant)
    • Compare README content hash or length delta to detect significant changes
    • Skip re-enrichment if changes are not significant (respond with { skipped: true, reason: "..." })
    • Allow override via request body { force: true } or workflow_dispatch
  3. If seeded or enriched, always re-run (the pipeline hasn't completed yet)
  4. If no .nemar/metadata.json exists, always run (first enrichment)

Significance heuristics

Consider a change "significant" if any of:

  • Authors changed (added, removed, reordered)
  • Title changed
  • License changed
  • README content changed by more than N% or N lines (threshold TBD)
  • dataset_description.json fields changed (beyond whitespace/formatting)

Non-significant changes (skip re-enrichment):

  • README whitespace or formatting-only changes
  • README changes that only affect acknowledgments or boilerplate
  • No actual content change (e.g., git-annex pointer updates)

Affected files

  • backend/src/routes/webhooks.ts - POST /webhooks/llm-enrich handler (line 560+)
  • .github/workflows/llm-enrichment.yml (in dataset repos via nemarDatasets/.github)

Workaround

Manual workflow_dispatch already exists for intentional re-runs. The fix is adding a guard in the webhook handler, not changing the CI trigger.

Activity

  1. added
    bug
    on Feb 19, 2026
  2. neuromechanist commented on Feb 20, 2026

    @neuromechanist
    ContributorAuthor

    Addressed in #163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions