AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-459
  5. plan
  6. plan.md
plan.md(4.1 KB)· Apr 13, 2026· 3 min read
  • Summary
  • Files
  • Steps
  • Verification
  • Risks
  • Open Questions

AW-13: Migrate from SqliteJobQueue to BullMQJobQueue and Remove SQLite Queue#

Summary#

Replace the SqliteJobQueue provider in QueueModule with BullMQJobQueue (created by AW-11), remove the SQLite queue implementation and JobEntity, delete the JOB_QUEUE_DRIVER config flag if present, and update all tests. This completes the AW-10 initiative by making BullMQ the sole job queue backend.

Files#

FileActionDescription
src/queue/queue.module.tsmodifySwap SqliteJobQueue → BullMQJobQueue; remove TypeOrmModule.forFeature([JobEntity]) and EventEmitterModule imports
src/queue/index.tsmodifyReplace SqliteJobQueue export with BullMQJobQueue
src/queue/sqlite-job-queue.tsdeleteRemove SQLite queue implementation
src/queue/sqlite-job-queue.spec.tsdeleteRemove SQLite queue unit tests
src/database/entities/job.entity.tsdeleteRemove JobEntity (jobs table)
src/database/entities/index.tsmodifyRemove JobEntity export
src/database/database.module.tsmodifyRemove JobEntity from entities array and forFeature
src/database/database.module.spec.tsmodifyRemove JobEntity references and job creation test
src/operational/operational.module.tsmodifyRemove TypeOrmModule.forFeature([JobEntity])
src/operational/operational.controller.tsmodifyRemove jobRepo injection and job-related endpoints (or adapt to query BullMQ)
src/operational/operational.controller.spec.tsmodifyRemove JobEntity mock and job endpoint tests
src/control-api/control-api.module.tsmodifyRemove JobEntity from forFeature
src/control-api/controllers/jobs.controller.tsmodifyReplace JobEntity repo queries with BullMQ queue introspection
test/job-queue.e2e-spec.tsmodifyRewrite E2E tests against BullMQJobQueue
.env.examplemodifyRemove JOB_QUEUE_DRIVER if present; ensure Redis vars are documented

Steps#

  1. Remove SqliteJobQueue and wire BullMQJobQueue — Delete sqlite-job-queue.ts and its spec. Update queue.module.ts to import and provide BullMQJobQueue (from AW-11) as the JOB_QUEUE token. Update index.ts exports.
  2. Remove JobEntity from database layer — Delete job.entity.ts. Remove from entities/index.ts, database.module.ts entities array, and database.module.spec.ts.
  3. Update consumers that import JobEntity — Remove JobEntity from operational.module.ts, control-api.module.ts, and all spec files that include it in TypeORM setup (event.service.spec.ts, internal-adapter.service.spec.ts, metrics.service.spec.ts, tasks.controller.spec.ts).
  4. Adapt jobs controller and operational endpoints — Replace JobEntity repo queries in jobs.controller.ts and operational.controller.ts with BullMQ queue introspection APIs (list jobs, retry, cancel via BullMQ Queue class). Update corresponding specs.
  5. Update E2E tests — Rewrite test/job-queue.e2e-spec.ts to test against BullMQJobQueue with a real Redis connection (use REDIS_DB isolation per CLAUDE.md conventions).
  6. Clean up config — Remove JOB_QUEUE_DRIVER from config schema and .env.example if present. Ensure REDIS_HOST, REDIS_PORT, REDIS_DB are documented.
  7. Verify — Run npm run lint, npm run test, npm run build.

Verification#

  • npm run test passes with no SqliteJobQueue or JobEntity references remaining
  • npm run build succeeds; npm run lint reports zero warnings
  • grep -r "SqliteJobQueue\|JOB_QUEUE_DRIVER" src/ returns zero results

Risks#

  • AW-11 dependency — BullMQJobQueue must exist and implement JobQueue interface before this work starts. AW-11 (#457) and AW-12 (#458) are prerequisites.
  • Jobs controller redesign — jobs.controller.ts currently queries JobEntity via TypeORM. Replacing with BullMQ introspection changes the data shape; consumers of GET /api/jobs may need client updates.

Open Questions#

  • Should the GET /api/jobs endpoint maintain the same response shape (with adapter mapping), or is a breaking change acceptable?
ContextPrd