Skip to content

Production-grade Postgres job queue - #1

Merged
jpr5 merged 6 commits into
mainfrom
feat/1a-job-queue
Apr 15, 2026
Merged

jpr5 merged 6 commits into
mainfrom
feat/1a-job-queue

Conversation

@jpr5

@jpr5 jpr5 commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Redesigns the job type system with 5 concrete, strongly-typed job types (AI_RESPONSE, TICKET_CLASSIFY, SLA_CHECK, ESCALATION, ONBOARDING_DIGEST) with dedicated payload interfaces
  • Makes the Worker production-grade: graceful SIGTERM/SIGINT shutdown, per-job-type timeouts, configurable concurrency, dead letter queue (DEAD_LETTER status after max retries), job progress tracking, and health check endpoint
  • Adds an interval-based Scheduler with duplicate prevention for recurring jobs (SLA check every 5 min, onboarding digest daily)
  • Extends the Prisma schema with DEAD_LETTER status and optional progress field on the Job model
  • 23 unit tests covering all components with mocked Prisma

Schema changes

  • JobStatus enum: added DEAD_LETTER
  • Job model: added progress Int?, added @@index([type])

Test plan

  • All 23 vitest tests pass
  • TypeScript strict mode passes with no errors
  • Verify Prisma migration applies cleanly against real database
  • Integration test with live Postgres (future)

jpr5 added 6 commits April 15, 2026 15:31
Extends the Prisma schema with a DEAD_LETTER variant in JobStatus for
jobs that exhaust all retry attempts, and an optional progress field
(0-100) for tracking job completion percentage. Adds an index on type
for efficient scheduler duplicate checks.
Replaces the original generic job types with the five concrete types
needed by Outpost: AI_RESPONSE, TICKET_CLASSIFY, SLA_CHECK, ESCALATION,
and ONBOARDING_DIGEST. Each type has a dedicated payload interface.
Adds JobHandlerContext for progress reporting, WorkerOptions for
concurrency/timeout config, WorkerHealthStatus, and ScheduledJobDefinition.
…ter queue

Adds graceful shutdown (SIGTERM/SIGINT), configurable per-job-type
timeouts, concurrent job processing with configurable max concurrency,
dead letter queue (DEAD_LETTER status after maxAttempts), job progress
tracking via handler context, and a health check method reporting
worker status, active jobs, and last poll time.
Creates a Scheduler class that manages recurring jobs using simple
interval timers. Includes default definitions for SLA_CHECK (every 5
minutes) and ONBOARDING_DIGEST (daily). Prevents duplicate scheduling
by checking for existing PENDING/PROCESSING jobs before creating new ones.
Tests cover createJob defaults and options, progress clamping, worker
job processing, dead letter queue after max attempts, retry with backoff,
job timeout, missing handler handling, concurrency limits, health checks,
graceful shutdown, progress reporting via handler context, scheduler
creation and deduplication, recurring intervals, and date injection
for digest jobs. Uses vitest with mocked Prisma.
@jpr5
jpr5 merged commit cd1fbc4 into main Apr 15, 2026
1 check failed
@jpr5
jpr5 deleted the feat/1a-job-queue branch May 15, 2026 20:11
NathanTarbert added a commit that referenced this pull request Jul 2, 2026
First card line is now a one-line italic caption (no label) that says
what the thing actually is, in a human sentence a non-engineer would
say — the "in one breath" gist, above What. Explicitly NOT agent/meta
("Landed Top issue #1, score 13, mirrored into Enterprise") — the
placement is already obvious from where the card sits. ~8-18 words,
plain, no jargon dump.
NathanTarbert added a commit that referenced this pull request Jul 17, 2026
Addresses PR #113 review nit #1: the App-credential describe block's
insertion had re-parented the existing 'posts to discussions via GraphQL
(GITHUB_DISCUSSION)' postSystemMessage test into the new describe. Moved
it back under postSystemMessage; App-credential now ends at the
throws-on-incomplete-creds test. Test-only; 19 platform-adapter tests pass.
NathanTarbert added a commit that referenced this pull request Aug 14, 2026
… the claim

A source link can resolve, carry the right issue number, and match its quoted
title while still being the wrong evidence. Both existing link-review checks
passed exactly that case on the Aug 07-14 report.

Top issue #1 ("merged AG-UI fixes aren't reaching npm") was sourced to
ag-ui#2305 and #2306 — two tool-error adapter bugs, both closed and fixed.
Following them showed completed work and nothing about publishing, so a reader
reasonably concluded the whole item was already resolved. Coverage checked that
links existed; correctness checked that numbers matched titles; neither asked
whether the linked issue evidenced the sentence beside it.

Adds a third mandatory check to step 14, and a companion rule: cite the artifact
that carries the evidence — for a release problem that's the merged PRs plus
registry output, not the issues those PRs closed.

Also adds a preview-channel warning. pkg.pr.new, TestPyPI and canary/.dev bot
comments make a merged PR look published; only a stable version on npm's latest
dist-tag or PyPI's info.version counts as released.

Report corrected in Notion: re-sourced to PRs #2330/#2335/#2316/#2317 plus npm
and PyPI timestamps, "Fix plan: Not started" replaced (the engineering is done,
only the release is outstanding), @ag-ui/core removed as unevidenced, and
@ag-ui/mastra and @ag-ui/langchain added — mastra had been used as an
unaffected carve-out when two of the four PRs touch it.
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