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

Title#

feat: implement #356 — MT-12: Create TenantResolver service + TenantContext

Problem#

No mechanism existed to resolve incoming webhooks to a tenant context carrying platform provider, LLM provider, and config references. This is a Wave 3 foundational piece required for multi-tenant support.

Task / Link#

Closes #356

Changes#

  • Add TenantContext interface (src/tenant/tenant-context.interface.ts) with tenant, repoConfig, platformProvider, and llmProvider fields
  • Add TenantResolverService (src/tenant/tenant-resolver.service.ts) with resolveFromWebhook() and resolveFromRepo() — single-tenant MVP returns ENV-based default context
  • Update TenantModule to import LLMModule and provide a default PlatformProvider
  • Extend DispatchEvent / DispatchEventParams with optional tenantContext?: TenantContext
  • Wire TenantResolverService into WebhookController to attach resolved context after adapter normalization
  • Fix integration/e2e test helpers to provide TenantResolverService mock in WebhookController test modules

Notes#

  • Single-tenant MVP: all requests resolve to the same ENV-based default context; no DB lookup
  • Uses the upstream LLM_PROVIDER Symbol from llm-provider.interface.ts (Wave 2, #346) rather than defining a local token
  • PlatformModule not yet available; TenantModule provides a hardcoded default github platform provider directly
  • Also carries forward the watchdog spec env-var pinning fix (STUCK_THRESHOLD_MS/SLOW_THRESHOLD_MS) from local master to unblock pre-commit hook in the worktree environment

Testing#

  • Unit tests: src/tenant/tenant-resolver.service.spec.ts — 5 tests covering webhook resolution, repo resolution, fallback, provider instance correctness, and repoConfig reference equality
  • Updated webhook.controller.spec.ts, webhook.e2e.spec.ts, and test/integration/integration-test.utils.ts to mock TenantResolverService
  • All 768 tests pass with npm run test
PrdAgent-runner