AI Agents SDE Task Viewer
      • Context
      • Plan
      • Prd
  1. Home
  2. AgentSDE
  3. agent-core
  4. gh-229
  5. plan
  6. context.json
context.json(4.3 KB)· Apr 1, 2026
{
  "meta": {
    "agent": "planner",
    "task_id": "229",
    "title": "CC APIs: exclude repos via configurable EXCLUDED_REPOS env var",
    "created_at": "2026-04-01T12:00:00Z"
  },
  "inputs": [
    {
      "name": "issue-229",
      "type": "context",
      "ref": "https://github.com/AgentSDE/agent-core/issues/229",
      "notes": "Server-side EXCLUDED_REPOS filtering for all CC API endpoints"
    },
    {
      "name": "metrics.service.ts",
      "type": "file",
      "ref": "src/metrics/metrics.service.ts",
      "notes": "Already has hardcoded EXCLUDED_REPOS constant at line 34"
    },
    {
      "name": "tasks.controller.ts",
      "type": "file",
      "ref": "src/control-api/controllers/tasks.controller.ts",
      "notes": "Has excludeRepo query param but no server-side enforcement"
    },
    {
      "name": "config.schema.ts",
      "type": "file",
      "ref": "src/config/config.schema.ts",
      "notes": "Joi validation schema — add EXCLUDED_REPOS here"
    }
  ],
  "outputs": [
    {
      "name": "plan",
      "type": "plan",
      "format": "md",
      "content": "plan.md"
    }
  ],
  "files": [
    {
      "path": "src/config/config.schema.ts",
      "action": "modify",
      "reason": "Add EXCLUDED_REPOS env var"
    },
    {
      "path": "src/config/excluded-repos.service.ts",
      "action": "create",
      "reason": "Centralized exclusion service"
    },
    {
      "path": "src/config/config.module.ts",
      "action": "modify",
      "reason": "Register and export ExcludedReposService"
    },
    {
      "path": "src/control-api/controllers/tasks.controller.ts",
      "action": "modify",
      "reason": "Add server-side exclusion to list + direct fetch"
    },
    {
      "path": "src/control-api/controllers/events.controller.ts",
      "action": "modify",
      "reason": "Add exclusion via tasks JOIN"
    },
    {
      "path": "src/control-api/controllers/jobs.controller.ts",
      "action": "modify",
      "reason": "Add exclusion to list + direct fetch"
    },
    {
      "path": "src/metrics/metrics.service.ts",
      "action": "modify",
      "reason": "Replace hardcoded constant with configurable service"
    },
    {
      "path": "src/config/excluded-repos.service.spec.ts",
      "action": "create",
      "reason": "Unit tests for ExcludedReposService"
    },
    {
      "path": "src/control-api/controllers/tasks.controller.spec.ts",
      "action": "create",
      "reason": "Tests for list filtering and 404 guard"
    },
    {
      "path": "src/metrics/metrics.service.spec.ts",
      "action": "modify",
      "reason": "Update to mock ExcludedReposService"
    }
  ],
  "steps": [
    {
      "id": "S1",
      "summary": "Add EXCLUDED_REPOS env var and create ExcludedReposService",
      "acceptance": [
        "EXCLUDED_REPOS env var registered in Joi schema with default 'AgentSDE/agent-core-e2e'",
        "ExcludedReposService parses CSV, exposes getList() and isExcluded()",
        "Service exported from AppConfigModule",
        "Unit tests pass for ExcludedReposService"
      ],
      "depends_on": []
    },
    {
      "id": "S2",
      "summary": "Apply server-side exclusion to CC API list and direct-fetch endpoints",
      "acceptance": [
        "listTasks(), listEvents(), listJobs() exclude items from EXCLUDED_REPOS",
        "getTask() and getJob() return 404 for excluded repos",
        "bulkAction() excludes items from EXCLUDED_REPOS",
        "Debug-level logging on excluded access attempts",
        "Unit tests cover list filtering and 404 guard"
      ],
      "depends_on": [
        "S1"
      ]
    },
    {
      "id": "S3",
      "summary": "Refactor MetricsService to use ExcludedReposService with parameterized queries",
      "acceptance": [
        "Hardcoded EXCLUDED_REPOS constant removed from metrics.service.ts",
        "All four metric methods use ExcludedReposService.getList()",
        "SQL uses parameterized placeholders instead of string interpolation for repo list",
        "Existing and new metrics tests pass"
      ],
      "depends_on": [
        "S1"
      ]
    }
  ],
  "risks": [
    {
      "risk": "Events JOIN to tasks adds query overhead to listEvents()",
      "mitigation": "taskId FK is already indexed; JOIN is lightweight"
    },
    {
      "risk": "Raw SQL parameterization changes in MetricsService could break queries",
      "mitigation": "All four metric methods covered by tests; SQLite placeholder syntax verified"
    }
  ],
  "assumptions": [
    "EXCLUDED_REPOS default of 'AgentSDE/agent-core-e2e' matches current hardcoded behavior",
    "EventEntity.taskId always references a valid TaskEntity (FK constraint)",
    "WebhookDeliveryEntity does not need filtering (raw delivery log, not user-facing data)"
  ],
  "open_questions": []
}
Plan