Add command parsing layer for chat integration (Discord, Mattermost, Slack). Features: - Parse @mosaic commands with action dispatch - Support 3 issue reference formats: #42, owner/repo#42, full URL - Handle 7 actions: fix, status, cancel, retry, verbose, quiet, help - Comprehensive error handling with helpful messages - Case-insensitive parsing - Platform-agnostic design Implementation: - CommandParserService with tokenizer and action dispatcher - Regex-based issue reference parsing - Type-safe command structures - 24 unit tests with 100% coverage TDD approach: - RED: Wrote comprehensive tests first - GREEN: Implemented parser to pass all tests - REFACTOR: Fixed TypeScript strict mode and linting issues Quality gates passed: - ✓ Typecheck - ✓ Lint - ✓ Build - ✓ Tests (24/24 passing) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
362 lines
12 KiB
Markdown
362 lines
12 KiB
Markdown
# M4.2-Infrastructure Token Usage Tracking
|
|
|
|
**Milestone:** M4.2-Infrastructure (0.0.4)
|
|
**Total Issues:** 18 (1 EPIC, 3 security, 14 implementation)
|
|
**Total Estimated Budget:** ~712,000 tokens
|
|
|
|
## Individual Issue Tracking
|
|
|
|
### Issue 162 - [EPIC] Mosaic Component Architecture
|
|
|
|
- **Estimate:** 0 tokens (tracker only)
|
|
- **Actual:** N/A
|
|
- **Variance:** N/A
|
|
- **Agent ID:** manual
|
|
- **Status:** pending (closes when all child issues complete)
|
|
- **Notes:** Parent issue tracking all INFRA issues
|
|
|
|
---
|
|
|
|
### Issue 163 - [INFRA-001] Add BullMQ dependencies
|
|
|
|
- **Estimate:** 15,000 tokens (haiku)
|
|
- **Actual:** ~35,000 tokens (haiku)
|
|
- **Variance:** +133% (over estimate)
|
|
- **Agent ID:** a7d18f8
|
|
- **Status:** ✅ completed
|
|
- **Commit:** d7328db
|
|
- **Dependencies:** none
|
|
- **Quality Gates:** ✅ pnpm install, pnpm build passed
|
|
- **Notes:** Added bullmq@^5.67.2, @nestjs/bullmq@^11.0.4. No conflicts with existing ioredis/Valkey
|
|
|
|
---
|
|
|
|
### Issue 164 - [INFRA-002] Database schema for job tracking
|
|
|
|
- **Estimate:** 40,000 tokens (sonnet)
|
|
- **Actual:** ~65,000 tokens (sonnet)
|
|
- **Variance:** +63% (over estimate)
|
|
- **Agent ID:** a1585e8
|
|
- **Status:** ✅ completed
|
|
- **Commit:** 65b1dad
|
|
- **Dependencies:** none
|
|
- **Quality Gates:** ✅ All passed (typecheck, lint, build, migration)
|
|
- **Notes:** Added 4 enums (RunnerJobStatus, JobStepPhase, JobStepType, JobStepStatus), 3 models (RunnerJob, JobStep, JobEvent). Migration applied successfully.
|
|
|
|
---
|
|
|
|
### Issue 165 - [INFRA-003] BullMQ module setup
|
|
|
|
- **Estimate:** 45,000 tokens (sonnet)
|
|
- **Actual:** ~45,000 tokens (sonnet)
|
|
- **Variance:** 0% (exact estimate)
|
|
- **Agent ID:** ace15a3
|
|
- **Status:** ✅ completed
|
|
- **Dependencies:** #163
|
|
- **Quality Gates:** ✅ All passed (11 unit tests, typecheck, lint, build)
|
|
- **Notes:** Created BullMQ module with 4 queues (mosaic-jobs, runner, weaver, inspector). Health check methods, proper lifecycle hooks.
|
|
|
|
---
|
|
|
|
### Issue 166 - [INFRA-004] Stitcher module structure
|
|
|
|
- **Estimate:** 50,000 tokens (sonnet)
|
|
- **Actual:** ~62,000 tokens (sonnet)
|
|
- **Variance:** +24% (over estimate)
|
|
- **Agent ID:** af3724d
|
|
- **Status:** ✅ completed
|
|
- **Dependencies:** #165
|
|
- **Quality Gates:** ✅ All passed (12 tests, typecheck, lint, build)
|
|
- **Notes:** Implemented webhook endpoint, Guard Rails, Quality Rails, BullMQ integration. Service and controller with full test coverage.
|
|
|
|
---
|
|
|
|
### Issue 167 - [INFRA-005] Runner jobs CRUD and queue submission
|
|
|
|
- **Estimate:** 55,000 tokens (sonnet)
|
|
- **Actual:** ~76,000 tokens (sonnet)
|
|
- **Variance:** +38% (over estimate)
|
|
- **Agent ID:** aa914a0
|
|
- **Status:** ✅ completed
|
|
- **Dependencies:** #164, #165
|
|
- **Quality Gates:** ✅ All passed (24 tests, typecheck, lint, build)
|
|
- **Notes:** Implemented 5 REST endpoints (create, list, get, cancel, retry) with BullMQ integration and Prisma persistence.
|
|
|
|
---
|
|
|
|
### Issue 168 - [INFRA-006] Job steps tracking
|
|
|
|
- **Estimate:** 45,000 tokens (sonnet)
|
|
- **Actual:** ~66,000 tokens (sonnet)
|
|
- **Variance:** +47% (over estimate)
|
|
- **Agent ID:** afdbbe9
|
|
- **Status:** ✅ completed
|
|
- **Commit:** efe624e
|
|
- **Dependencies:** #164, #167
|
|
- **Quality Gates:** ✅ All passed (16 tests, 100% coverage, typecheck, lint, build)
|
|
- **Notes:** Implemented step CRUD, status tracking (PENDING→RUNNING→COMPLETED/FAILED), token usage per step, duration calculation. Endpoints: GET /runner-jobs/:jobId/steps, GET /runner-jobs/:jobId/steps/:stepId
|
|
|
|
---
|
|
|
|
### Issue 169 - [INFRA-007] Job events and audit logging
|
|
|
|
- **Estimate:** 55,000 tokens (sonnet)
|
|
- **Actual:** ~66,700 tokens (sonnet)
|
|
- **Variance:** +21% (over estimate)
|
|
- **Agent ID:** aa98d29
|
|
- **Status:** ✅ completed
|
|
- **Commit:** efe624e (with #168)
|
|
- **Dependencies:** #164, #167
|
|
- **Quality Gates:** ✅ All passed (17 tests, typecheck, lint, build)
|
|
- **Notes:** Implemented 17 event types (job, step, AI, gate lifecycles). PostgreSQL persistence with emitEvent() and query methods. GET /runner-jobs/:jobId/events endpoint.
|
|
|
|
---
|
|
|
|
### Issue 170 - [INFRA-008] mosaic-bridge module for Discord
|
|
|
|
- **Estimate:** 55,000 tokens (sonnet)
|
|
- **Actual:** ~77,000 tokens (sonnet)
|
|
- **Variance:** +40% (over estimate)
|
|
- **Agent ID:** a8f16a2
|
|
- **Status:** ✅ completed
|
|
- **Commit:** 4ac21d1
|
|
- **Dependencies:** #166
|
|
- **Quality Gates:** ✅ All passed (23 tests, typecheck, lint, build)
|
|
- **Notes:** Discord bot connection, IChatProvider interface, command parsing, thread management. Added discord.js dependency.
|
|
|
|
---
|
|
|
|
### Issue 171 - [INFRA-009] Chat command parsing
|
|
|
|
- **Estimate:** 40,000 tokens (sonnet)
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Agent ID:** _pending_
|
|
- **Status:** pending
|
|
- **Dependencies:** #170
|
|
- **Notes:** Command grammar parsing, shared across Discord/Mattermost/Slack
|
|
|
|
---
|
|
|
|
### Issue 172 - [INFRA-010] Herald status updates
|
|
|
|
- **Estimate:** 50,000 tokens (sonnet)
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Agent ID:** _pending_
|
|
- **Status:** pending
|
|
- **Dependencies:** #169, #170
|
|
- **Notes:** Status reporting via bridge to chat channels, PR comments
|
|
|
|
---
|
|
|
|
### Issue 173 - [INFRA-011] WebSocket gateway for job events
|
|
|
|
- **Estimate:** 45,000 tokens (sonnet)
|
|
- **Actual:** ~49,000 tokens (sonnet)
|
|
- **Variance:** +9% (over estimate)
|
|
- **Agent ID:** af03015
|
|
- **Status:** ✅ completed
|
|
- **Commit:** fd78b72
|
|
- **Dependencies:** #169
|
|
- **Quality Gates:** ✅ All passed (22 tests, typecheck, lint)
|
|
- **Notes:** Extended existing WebSocket gateway with 6 event emission methods. Supports workspace-level and job-specific subscriptions.
|
|
|
|
---
|
|
|
|
### Issue 174 - [INFRA-012] SSE endpoint for CLI consumers
|
|
|
|
- **Estimate:** 40,000 tokens (sonnet)
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Agent ID:** _pending_
|
|
- **Status:** pending
|
|
- **Dependencies:** #169
|
|
- **Notes:** Server-Sent Events for CLI, Valkey Pub/Sub integration
|
|
|
|
---
|
|
|
|
### Issue 175 - [INFRA-013] End-to-end test harness
|
|
|
|
- **Estimate:** 65,000 tokens (sonnet)
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Agent ID:** _pending_
|
|
- **Status:** pending
|
|
- **Dependencies:** All Phase 1-4
|
|
- **Notes:** Happy path, error handling, chat integration tests
|
|
|
|
---
|
|
|
|
### Issue 176 - [INFRA-014] Integration with M4.1 coordinator
|
|
|
|
- **Estimate:** 75,000 tokens (opus)
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Agent ID:** _pending_
|
|
- **Status:** pending
|
|
- **Dependencies:** All M4.2 issues
|
|
- **Notes:** Complex integration requiring opus-level reasoning
|
|
|
|
---
|
|
|
|
### Issue 179 - fix(security): Update Node.js dependencies
|
|
|
|
- **Estimate:** 12,000 tokens (haiku)
|
|
- **Actual:** ~16,000 tokens (haiku)
|
|
- **Variance:** +33% (over estimate)
|
|
- **Agent ID:** a7f61cc
|
|
- **Status:** ✅ completed
|
|
- **Commit:** 79ea041
|
|
- **Dependencies:** none
|
|
- **Quality Gates:** ✅ All passed (typecheck, lint, build, 1554+ tests)
|
|
- **Notes:** Updated cross-spawn to 7.0.6, glob to 10.5.0, tar to 7.5.7. Fixed CVE-2024-21538, CVE-2025-64756, CVE-2026-23745, CVE-2026-23950, CVE-2026-24842
|
|
|
|
---
|
|
|
|
### Issue 180 - fix(security): Update pnpm in Dockerfiles
|
|
|
|
- **Estimate:** 10,000 tokens (haiku)
|
|
- **Actual:** ~29,000 tokens (haiku)
|
|
- **Variance:** +190% (over estimate)
|
|
- **Agent ID:** a950df4
|
|
- **Status:** ✅ completed
|
|
- **Commit:** a5416e4
|
|
- **Dependencies:** none
|
|
- **Quality Gates:** ✅ Dockerfile syntax verified
|
|
- **Notes:** Updated pnpm 10.19.0 -> 10.27.0 in apps/api/Dockerfile and apps/web/Dockerfile. Fixed CVE-2025-69262, CVE-2025-69263, CVE-2025-6926
|
|
|
|
---
|
|
|
|
### Issue 181 - fix(security): Update Go stdlib in postgres image
|
|
|
|
- **Estimate:** 15,000 tokens (haiku)
|
|
- **Actual:** ~12,000 tokens (haiku)
|
|
- **Variance:** -20% (under estimate)
|
|
- **Agent ID:** a63d2f5
|
|
- **Status:** ✅ completed
|
|
- **Commit:** 7c2df59
|
|
- **Dependencies:** none
|
|
- **Quality Gates:** ✅ Dockerfile syntax verified
|
|
- **Notes:** Added Alpine package update step to patch Go stdlib from base image. Addresses CVE-2025-58183, CVE-2025-61726, CVE-2025-61728, CVE-2025-61729
|
|
|
|
---
|
|
|
|
## Phase Summaries
|
|
|
|
### Security Issues (Wave 0)
|
|
|
|
- **Estimated:** 37,000 tokens
|
|
- **Actual:** ~57,000 tokens
|
|
- **Variance:** +54% (over estimate)
|
|
- **Issues:** #179 (✅), #180 (✅), #181 (✅)
|
|
|
|
### Phase 1: Core Infrastructure
|
|
|
|
- **Estimated:** 100,000 tokens
|
|
- **Actual:** ~145,000 tokens
|
|
- **Variance:** +45% (over estimate)
|
|
- **Issues:** #163 (✅), #164 (✅), #165 (✅)
|
|
|
|
### Phase 2: Stitcher Service
|
|
|
|
- **Estimated:** 205,000 tokens
|
|
- **Actual:** ~270,700 tokens
|
|
- **Variance:** +32% (over estimate)
|
|
- **Issues:** #166 (✅), #167 (✅), #168 (✅), #169 (✅)
|
|
|
|
### Phase 3: Chat Integration
|
|
|
|
- **Estimated:** 145,000 tokens
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Issues:** #170, #171, #172
|
|
|
|
### Phase 4: Real-time Status
|
|
|
|
- **Estimated:** 85,000 tokens
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Issues:** #173, #174
|
|
|
|
### Phase 5: Integration
|
|
|
|
- **Estimated:** 140,000 tokens
|
|
- **Actual:** _pending_
|
|
- **Variance:** _pending_
|
|
- **Issues:** #175, #176
|
|
|
|
### EPIC Tracker
|
|
|
|
- **Estimated:** 0 tokens (manual)
|
|
- **Actual:** N/A
|
|
- **Variance:** N/A
|
|
- **Issues:** #162
|
|
|
|
## Overall Summary
|
|
|
|
- **Total Estimated:** 712,000 tokens
|
|
- **Total Actual:** _pending_
|
|
- **Overall Variance:** _pending_
|
|
- **Estimation Accuracy:** _pending_
|
|
|
|
## Code Review & QA Tracking
|
|
|
|
| Issue | Code Review Agent | QA Agent | Review Status | QA Status |
|
|
| ----- | ----------------- | --------- | ------------- | --------- |
|
|
| #163 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #164 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #165 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #166 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #167 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #168 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #169 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #170 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #171 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #172 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #173 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #174 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #175 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #176 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #179 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #180 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
| #181 | _pending_ | _pending_ | _pending_ | _pending_ |
|
|
|
|
## Execution Log
|
|
|
|
_Execution events will be logged here as work progresses._
|
|
|
|
```
|
|
[2026-02-01 18:52] Orchestrator initialized
|
|
[2026-02-01 18:52] Implementation plan created
|
|
[2026-02-01 18:52] Token tracking initialized
|
|
[2026-02-01 18:52] Wave 0 started - Agents launched for #179, #180
|
|
[2026-02-01 18:55] Issue #180 COMPLETED - Agent a950df4 - ~29,000 tokens
|
|
[2026-02-01 18:55] Agent launched for #181
|
|
[2026-02-01 18:58] Issue #179 COMPLETED - Agent a7f61cc - ~16,000 tokens
|
|
[2026-02-01 19:02] Issue #181 COMPLETED - Agent a63d2f5 - ~12,000 tokens
|
|
[2026-02-01 19:02] Wave 0 COMPLETE - Total: ~57,000 tokens
|
|
[2026-02-01 19:02] Wave 1 STARTED - Foundation (#163, #164, #165)
|
|
[2026-02-01 19:06] Issue #163 COMPLETED - Agent a7d18f8 - ~35,000 tokens
|
|
[2026-02-01 19:06] Agent launched for #165 (BullMQ module)
|
|
[2026-02-01 19:12] Issue #165 COMPLETED - Agent ace15a3 - ~45,000 tokens
|
|
[2026-02-01 19:18] Issue #164 COMPLETED - Agent a1585e8 - ~65,000 tokens
|
|
[2026-02-01 19:18] Wave 1 COMPLETE - Total: ~145,000 tokens
|
|
[2026-02-01 19:18] Wave 2 STARTED - Stitcher core (#166, #167)
|
|
[2026-02-01 19:25] Issue #166 COMPLETED - Agent af3724d - ~62,000 tokens
|
|
[2026-02-01 19:32] Issue #167 COMPLETED - Agent aa914a0 - ~76,000 tokens
|
|
[2026-02-01 19:32] Wave 2 COMPLETE - Total: ~138,000 tokens
|
|
[2026-02-01 19:32] Wave 3 STARTED - Stitcher events (#168, #169)
|
|
[2026-02-01 19:40] Issue #168 COMPLETED - Agent afdbbe9 - ~66,000 tokens
|
|
[2026-02-01 19:48] Issue #169 COMPLETED - Agent aa98d29 - ~66,700 tokens
|
|
[2026-02-01 19:48] Wave 3 COMPLETE - Phase 2 done - Total: ~132,700 tokens
|
|
[2026-02-01 19:48] Wave 4 STARTED - Chat + Real-time (#170, #173 parallel, then #171, #174)
|
|
[2026-02-01 19:55] Issue #173 COMPLETED - Agent af03015 - ~49,000 tokens
|
|
[2026-02-01 20:02] Issue #170 COMPLETED - Agent a8f16a2 - ~77,000 tokens
|
|
[2026-02-01 20:02] Wave 4 Batch 2 - Launching #171 + #174
|
|
```
|
|
|
|
## Notes
|
|
|
|
_Observations and learnings will be recorded here._
|