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

Summary#

Add server-side EXCLUDED_REPOS filtering across all CC API endpoints so items from excluded repos (default: AgentSDE/agent-core-e2e) never reach the frontend. Replaces the existing hardcoded exclusion in MetricsService with a configurable, centralized approach.

Files#

FileActionDescription
src/config/config.schema.tsmodifyAdd EXCLUDED_REPOS env var with default
src/config/excluded-repos.service.tscreateInjectable service: parses EXCLUDED_REPOS CSV, exposes getList() and isExcluded(repo)
src/config/config.module.tsmodifyRegister and export ExcludedReposService
src/control-api/controllers/tasks.controller.tsmodifyInject ExcludedReposService; add NOT IN filter to listTasks() and bulkAction() QBs; guard getTask() with 404
src/control-api/controllers/events.controller.tsmodifyInject service; join events→tasks, add NOT IN filter to listEvents()
src/control-api/controllers/jobs.controller.tsmodifyInject service; add NOT IN filter to listJobs(); guard getJob() with 404
src/metrics/metrics.service.tsmodifyReplace hardcoded EXCLUDED_REPOS constant with injected ExcludedReposService; use parameterized queries
src/config/excluded-repos.service.spec.tscreateUnit tests for parsing, isExcluded(), empty/default cases
src/control-api/controllers/tasks.controller.spec.tscreateTests for list filtering and direct-fetch 404 on excluded repos
src/metrics/metrics.service.spec.tsmodifyUpdate tests to provide ExcludedReposService mock

Steps#

  1. Add EXCLUDED_REPOS to config.schema.ts (Joi string, default AgentSDE/agent-core-e2e) and create ExcludedReposService in src/config/ that reads it from ConfigService, splits on comma, and exposes getList(): string[] + isExcluded(repo: string): boolean. Export from AppConfigModule.
  2. Inject ExcludedReposService into TasksController, EventsController, JobsController. Apply NOT IN (:...excludedRepos) clause to all list query builders. For getTask() and getJob(), check isExcluded(entity.repo) after fetch — throw NotFoundException if excluded. Add debug-level logging on excluded access attempts. For EventsController.listEvents(), join to tasks table via taskId to filter by repo.
  3. Inject ExcludedReposService into MetricsService. Replace the hardcoded EXCLUDED_REPOS string constant with getList() values. Convert raw SQL IN clauses to use parameterized placeholders instead of string interpolation.
  4. Write unit tests: ExcludedReposService parsing (CSV split, trim, empty string handling), TasksController list filtering + 404 on excluded direct fetch, MetricsService with mocked exclusion service.

Verification#

  • npm run lint passes with zero warnings
  • npm run test passes — new and existing tests
  • Manual: GET /api/cc/tasks with agent-core-e2e tasks in DB returns none; GET /api/cc/tasks/:id for an excluded task returns 404

Risks#

  • Events lack a repo column — listEvents() must join to tasks via taskId, adding a JOIN that wasn't there before. Mitigated by indexing on taskId (FK, already indexed).
  • MetricsService raw SQL refactor — switching from string interpolation to parameterized queries changes the SQL shape. Mitigated by test coverage on all four metric methods.
ContextPrd