Skip to content

Bound and monitor AI extraction workflows #577

Description

@kelvinkipruto

Parent

#572

What to build

Make AI extraction runs bounded, non-overlapping, traceable, and operationally visible. Every extraction can be matched to its downstream upload, duplicate cron runs cannot process the same work, and provider time/cost exposure is capped per call and document.

Acceptance criteria

  • Every extraction row has a required system-generated unique ID, with existing records safely backfilled.
  • The extraction workflow has an atomic queued/running guard preventing overlapping runs over the same work.
  • AI calls enforce per-call deadlines and each document enforces total duration, character, chunk, token, retry, and cost ceilings.
  • Rejected or truncated documents enter an explicit operator-reviewable state.
  • Retries use bounded exponential backoff and respect provider rate-limit guidance.
  • Metrics and alerts cover calls, tokens, duration, retries, costs, workflow pileups, and terminal failures.
  • Tests cover missing IDs, duplicate scheduling, provider timeout, retry exhaustion, and oversized documents.

Blocked by

None - can start immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions