AI Agents SDE Task Viewer
      • Pr description
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-444
  5. changes
  6. pr_description.md
pr_description.md(1.8 KB)· Apr 13, 2026· 1 min read
  • Problem
  • Task / Link
  • Changes
  • Notes
  • Testing

Problem#

All in-process events (task.updated, task.stuck, job.created/completed/failed, artefacts.synced) still used the in-process EventEmitter2 bus, making them invisible to horizontally-scaled workers and inaccessible via Redis. This blocked AW-1's multi-worker architecture from receiving real-time pipeline state changes.

Task / Link#

Closes #444 — AW-8: Migrate EventEmitter2 events to EventBusService

Depends on #443 (AW-7: EventBusService backed by Redis) — merged into this branch.

Changes#

  • R1 (task.updated): TaskStateService emits via EventBusService; WsGatewayService and MetricsCache register handlers via eventBus.on() in onModuleInit
  • R2 (task.stuck): WatchdogService emits via EventBusService
  • R3 (artefacts.synced): PhaseRouterService emits via EventBusService
  • R4 (job.completed/job.failed): SqliteJobQueue emits via EventBusService
  • R5 (job.created): Replace 3× self-trigger emits with direct void this.processNext() calls; Redis emit added for multi-instance support
  • R6 (cleanup): npm uninstall @nestjs/event-emitter; all EventEmitterModule.forRoot() and EventEmitter2 imports removed
  • All spec/integration/e2e files updated to use EventBusService mocks

Notes#

  • All eventBus.emit() calls are wrapped in try/catch to avoid breaking pipeline if Redis publish fails
  • The job.created self-trigger migration (R5) uses direct processNext() call — simpler and more reliable than pub/sub for single-instance; Redis emit future-proofs multi-instance
  • Unit tests for SqliteJobQueue adjusted: enqueue now directly calls processNext, tests register handler after enqueue to avoid race conditions

Testing#

  • npm run lint — passed (zero warnings)
  • npm run test — 807/807 tests passed
PrdAi-done