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

Plan: Extract hardcoded constants (org, labels) to TenantConfig#

Summary#

Replace hardcoded GH_ORG constant and label strings ('in-refinement', 'refined', 'in-review', 'agent-blocked') with lookups from TenantConfigService. This makes org and label names configurable per tenant (Wave 2 config extraction). Depends on #348 (TenantConfigService must exist).

Files#

FileActionDescription
src/config/constants.tsmodifyRemove GH_ORG; inline ARTEFACTS_REPO value
src/hooks/phase-hooks.service.tsmodifyInject TenantConfigService; replace 5 hardcoded label strings + any org refs
src/hooks/phase-hooks.service.spec.tsmodifyProvide TenantConfigService mock in test module
src/webhook/adapters/github.adapter.tsmodifyInject TenantConfigService; replace 3 'in-refinement' comparisons with config lookup
src/webhook/adapters/github.adapter.spec.tsmodifyProvide TenantConfigService mock in test module
src/artefacts/artefacts.service.tsmodifyInject TenantConfigService; replace GH_ORG usages (lines 79, 254, 288, 373, 419) with tenantConfig.org
src/artefacts/artefacts.service.spec.tsmodifyProvide TenantConfigService mock; update assertions referencing GH_ORG
src/hooks/hooks.module.tsmodifyAdd TenantConfigService to module providers/imports if not already present
src/webhook/webhook.module.tsmodifyAdd TenantConfigService to module providers/imports if not already present

Steps#

  1. Remove GH_ORG from constants.ts: Delete the GH_ORG export. Change ARTEFACTS_REPO to use inline string 'AgentSDE/agent-core-artefacts' (infrastructure constant, not tenant-specific per issue scope).
  2. Update phase-hooks.service.ts: Inject TenantConfigService via constructor. Replace 'agent-blocked' → tenantConfig.labels.agentBlocked, 'in-refinement' → tenantConfig.labels.inRefinement, 'refined' → tenantConfig.labels.refined, 'in-review' → tenantConfig.labels.inReview at lines 123, 216, 224, 238, 252, 256, 290.
  3. Update github.adapter.ts: Inject TenantConfigService. Replace 'in-refinement' string comparisons at lines 136, 567, 638 with tenantConfig.labels.inRefinement.
  4. Update artefacts.service.ts: Inject TenantConfigService. Replace all GH_ORG references (lines 79, 254, 288, 373, 419) with this.tenantConfig.getConfig().org.
  5. Update unit tests: Add TenantConfigService mock (returning default config values) to test modules for phase-hooks.service.spec.ts, github.adapter.spec.ts, and artefacts.service.spec.ts.
  6. Verify: Run tsc --noEmit, npm run lint, npm run test. Grep for remaining GH_ORG and hardcoded label strings in src/.

Verification#

  • grep -r "GH_ORG" src/ returns zero results (excluding test assertions that reference the default value 'AgentSDE')
  • grep -rn "'in-refinement'\|'refined'\|'in-review'\|'agent-blocked'" src/hooks/phase-hooks.service.ts src/webhook/adapters/github.adapter.ts returns zero results
  • npm run test and npm run lint pass clean

Risks#

  • Dependency on #348: TenantConfigService must be merged first. If the interface shape changes, config accessor calls in this PR will need updating.
  • ARTEFACTS_REPO inlining: Changing from ${GH_ORG}/... to a hardcoded string is safe since ARTEFACTS_REPO is infrastructure-scoped, but creates a second 'AgentSDE' hardcoded string in constants.ts — acceptable per issue scope.
ContextPrd