AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-439
  5. plan
  6. context.json
context.json(4.0 KB)ยท Apr 12, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "439",
    "title": "AW-3: Add Redis (BullMQ) to agent-core",
    "created_at": "2026-04-12T12:00:00Z"
  },
  "inputs": [
    {
      "name": "issue-439",
      "type": "link",
      "ref": "https://github.com/AgentSDE/agent-core/issues/439",
      "notes": "AW-3 spec: Redis + BullMQ foundation"
    },
    {
      "name": "app.module.ts",
      "type": "file",
      "ref": "src/app.module.ts",
      "notes": "Module registration target"
    },
    {
      "name": "config.schema.ts",
      "type": "file",
      "ref": "src/config/config.schema.ts",
      "notes": "Joi validation schema for env vars"
    },
    {
      "name": "health.service.ts",
      "type": "file",
      "ref": "src/health/health.service.ts",
      "notes": "Health check service to extend"
    },
    {
      "name": "health.controller.ts",
      "type": "file",
      "ref": "src/health/health.controller.ts",
      "notes": "Health endpoint controller"
    },
    {
      "name": "health.module.ts",
      "type": "file",
      "ref": "src/health/health.module.ts",
      "notes": "Health module to add Redis provider"
    }
  ],
  "outputs": [
    {
      "name": "plan",
      "type": "plan",
      "format": "md",
      "content": "plan.md"
    }
  ],
  "files": [
    {
      "path": "package.json",
      "action": "modify",
      "reason": "Add @nestjs/bullmq, bullmq, ioredis"
    },
    {
      "path": "src/config/config.schema.ts",
      "action": "modify",
      "reason": "Add REDIS_HOST and REDIS_PORT env vars"
    },
    {
      "path": "src/app.module.ts",
      "action": "modify",
      "reason": "Register BullModule.forRootAsync() and queues"
    },
    {
      "path": "src/health/health.service.ts",
      "action": "modify",
      "reason": "Add Redis ping health check"
    },
    {
      "path": "src/health/health.controller.ts",
      "action": "modify",
      "reason": "Update return type for redis field"
    },
    {
      "path": "src/health/health.module.ts",
      "action": "modify",
      "reason": "Add Redis client provider"
    },
    {
      "path": "src/health/health.controller.spec.ts",
      "action": "modify",
      "reason": "Update test for new response shape"
    },
    {
      "path": "src/health/health.service.spec.ts",
      "action": "create",
      "reason": "Unit test for Redis health check"
    },
    {
      "path": ".env",
      "action": "modify",
      "reason": "Add REDIS_HOST and REDIS_PORT defaults"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Install dependencies and add env vars to config schema and .env",
      "acceptance": [
        "@nestjs/bullmq, bullmq, ioredis appear in package.json dependencies",
        "REDIS_HOST and REDIS_PORT in configValidationSchema with correct defaults",
        "REDIS_HOST and REDIS_PORT appended to .env"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Register BullModule and queues in AppModule, add Redis health check to HealthModule",
      "acceptance": [
        "BullModule.forRootAsync() registered in AppModule with ConfigService-driven connection",
        "phase-invoke and phase-result queues registered via BullModule.registerQueue()",
        "HealthModule provides a Redis client via custom factory",
        "HealthService.getHealth() returns redis: connected|disconnected",
        "HealthController return type includes redis field"
      ],
      "depends_on": [
        "S1"
      ]
    },
    {
      "id": "S3",
      "summary": "Add and update unit tests for health service and controller",
      "acceptance": [
        "health.service.spec.ts covers connected and disconnected Redis states",
        "health.controller.spec.ts updated for new response shape",
        "npm run build passes",
        "npm run test passes with no regressions",
        "npm run lint reports zero warnings"
      ],
      "depends_on": [
        "S2"
      ]
    }
  ],
  "risks": [
    {
      "risk": "BullMQ silently swallows Redis connection errors at startup",
      "mitigation": "Verify fail-fast behavior; add onModuleInit ping guard if needed"
    },
    {
      "risk": "Health check coupled to BullMQ internal connection",
      "mitigation": "Use separate ioredis instance for health probes"
    }
  ],
  "assumptions": [
    "Redis is available at localhost:6379 in both dev and production environments",
    "No existing BullMQ or ioredis usage in the codebase"
  ],
  "open_questions": []
}
Plan