feat(routing): task classifier + default rules + CI test fixes — M4-004/005 #316

Merged
jason.woltje merged 4 commits from feat/m4-classifier-seeds into main 2026-03-23 00:26:50 +00:00
Owner

Deterministic task classifier (regex/keyword), 11 default routing rules, 60+ unit tests. Also fixes provider.service.test.ts assertions for new adapter model names.

Deterministic task classifier (regex/keyword), 11 default routing rules, 60+ unit tests. Also fixes provider.service.test.ts assertions for new adapter model names.
jason.woltje added 4 commits 2026-03-23 00:26:42 +00:00
chore(orchestrator): Wave 4 complete, Wave 5 in progress — 25/65 done
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed
e020b78e3b
M3-001/002/003/004/006/007/009 done (PRs #303,#306,#308-#311).
Wave 5: M3-005, M3-010/011, M4-001-005 in progress.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add routing_rules table to packages/db with scope, priority, conditions (jsonb), and action (jsonb) columns; generate migration 0004
- Define RoutingCondition, RoutingAction, RoutingRule, TaskClassification, and RoutingDecision types in apps/gateway/src/agent/routing/routing.types.ts
- Expand @mosaic/types routing/index.ts to export all M4 types (TaskType, Complexity, Domain, CostTier+local, Capability) alongside existing RoutingCriteria/RoutingResult
- Fix pre-existing type errors in routing.service.ts (local CostTier) and default-rules.ts (count optional chaining, unknown cast)
- Fix pre-existing Prettier violations in agent module and provider files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add DefaultRoutingRulesSeed service that inserts 11 default routing rules on startup if table is empty
- Implement classifyTask() using deterministic regex/keyword matching for taskType, complexity, and domain
- Add unit tests covering all task types, complexity levels, and domain detection with 60+ test cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(tests): correct provider.service and chat-security test assertions
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/pr/ci Pipeline failed
50edfb6613
- Fix ProviderService constructor call: pass null for optional credentialsService
- Update Anthropic model order to match AnthropicAdapter registration (opus first)
- Update OpenAI model list to match OpenAIAdapter (codex-gpt-5-4 only)
- Update Z.ai assertion to verify glm-5 is present (Pi registry includes additional models)
- Add reflect-metadata import to chat-security test to fix Reflect.getMetadata error

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jason.woltje merged commit fa84bde6f6 into main 2026-03-23 00:26:50 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#316