diff --git a/README.md b/README.md index 5fc044a..0890556 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,8 @@ docker compose down - Valkey (Redis-compatible cache) - Mosaic API (NestJS) - Mosaic Web (Next.js) +- Mosaic Orchestrator (Agent lifecycle management) +- Mosaic Coordinator (Task assignment & monitoring) - Authentik OIDC (optional, use `--profile authentik`) - Ollama AI (optional, use `--profile ollama`) @@ -124,13 +126,29 @@ mosaic-stack/ │ │ ├── src/ │ │ │ ├── auth/ # BetterAuth + Authentik OIDC │ │ │ ├── prisma/ # Database service +│ │ │ ├── coordinator-integration/ # Coordinator API client │ │ │ └── app.module.ts # Main application module │ │ ├── prisma/ │ │ │ └── schema.prisma # Database schema │ │ └── Dockerfile -│ └── web/ # Next.js 16 frontend (planned) -│ ├── app/ -│ ├── components/ +│ ├── web/ # Next.js 16 frontend +│ │ ├── app/ +│ │ ├── components/ +│ │ │ └── widgets/ # HUD widgets (agent status, etc.) +│ │ └── Dockerfile +│ ├── orchestrator/ # Agent lifecycle & spawning (NestJS) +│ │ ├── src/ +│ │ │ ├── spawner/ # Agent spawning service +│ │ │ ├── queue/ # Valkey-backed task queue +│ │ │ ├── monitor/ # Health monitoring +│ │ │ ├── git/ # Git worktree management +│ │ │ └── killswitch/ # Emergency agent termination +│ │ └── Dockerfile +│ └── coordinator/ # Task assignment & monitoring (FastAPI) +│ ├── src/ +│ │ ├── webhook.py # Gitea webhook receiver +│ │ ├── parser.py # Issue metadata parser +│ │ └── security.py # HMAC signature verification │ └── Dockerfile ├── packages/ │ ├── shared/ # Shared types & utilities @@ -159,23 +177,36 @@ mosaic-stack/ └── pnpm-workspace.yaml # Workspace configuration ``` +## Agent Orchestration Layer (v0.0.6) + +Mosaic Stack includes a sophisticated agent orchestration system for autonomous task execution: + +- **Orchestrator Service** (NestJS) - Manages agent lifecycle, spawning, and health monitoring +- **Coordinator Service** (FastAPI) - Receives Gitea webhooks, assigns tasks to agents +- **Task Queue** - Valkey-backed queue for distributed task management +- **Git Worktrees** - Isolated workspaces for parallel agent execution +- **Killswitch** - Emergency stop mechanism for runaway agents +- **Agent Dashboard** - Real-time monitoring UI with status widgets + +See [Agent Orchestration Design](docs/design/agent-orchestration.md) for architecture details. + ## Current Implementation Status -### ✅ Completed (v0.0.1) +### ✅ Completed (v0.0.1-0.0.6) -- **Issue #1:** Project scaffold and monorepo setup -- **Issue #2:** PostgreSQL 17 + pgvector database schema -- **Issue #3:** Prisma ORM integration with tests and seed data -- **Issue #4:** Authentik OIDC authentication with BetterAuth +- **M1-Foundation:** Project scaffold, PostgreSQL 17 + pgvector, Prisma ORM +- **M2-MultiTenant:** Workspace isolation with RLS, team management +- **M3-Features:** Knowledge management, tasks, calendar, authentication +- **M4-MoltBot:** Bot integration architecture (in progress) +- **M6-AgentOrchestration:** Orchestrator service, coordinator, agent dashboard ✅ -**Test Coverage:** 26/26 tests passing (100%) +**Test Coverage:** 2168+ tests passing ### 🚧 In Progress (v0.0.x) -- **Issue #5:** Multi-tenant workspace isolation (planned) -- **Issue #6:** Frontend authentication UI ✅ **COMPLETED** -- **Issue #7:** Activity logging system (planned) -- **Issue #8:** Docker compose setup ✅ **COMPLETED** +- Agent orchestration E2E testing +- Usage budget management +- Performance optimization ### 📋 Planned Features (v0.1.0 MVP) diff --git a/apps/orchestrator/README.md b/apps/orchestrator/README.md index a0a442c..3621f7d 100644 --- a/apps/orchestrator/README.md +++ b/apps/orchestrator/README.md @@ -6,59 +6,187 @@ Agent orchestration service for Mosaic Stack built with NestJS. The Orchestrator is the execution plane of Mosaic Stack, responsible for: -- Spawning and managing Claude agents -- Task queue management (Valkey-backed) -- Agent health monitoring and recovery -- Git workflow automation -- Quality gate enforcement callbacks -- Killswitch emergency stop +- Spawning and managing Claude agents (worker, reviewer, tester) +- Task queue management via BullMQ with Valkey backend +- Agent lifecycle state machine (spawning → running → completed/failed/killed) +- Git workflow automation with worktree isolation per agent +- Quality gate enforcement via Coordinator integration +- Killswitch emergency stop with cleanup +- Docker sandbox isolation (optional) +- Secret scanning on agent commits ## Architecture -Part of the Mosaic Stack monorepo at `apps/orchestrator/`. +``` +AppModule +├── HealthModule → GET /health, GET /health/ready +├── AgentsModule → POST /agents/spawn, GET /agents/:id/status, kill endpoints +│ ├── QueueModule → BullMQ task queue (priority 1-10, retry with backoff) +│ ├── SpawnerModule → Agent session management, Docker sandbox, lifecycle FSM +│ ├── KillswitchModule → Emergency kill + cleanup (Docker, worktree, Valkey state) +│ └── ValkeyModule → Distributed state persistence and pub/sub events +├── CoordinatorModule → Quality gate checks (typecheck, lint, tests, coverage, AI review) +├── GitModule → Clone, branch, commit, push, conflict detection, secret scanning +└── MonitorModule → Agent health monitoring (placeholder) +``` +Part of the Mosaic Stack monorepo at `apps/orchestrator/`. Controlled by `apps/coordinator/` (Quality Coordinator). Monitored via `apps/web/` (Agent Dashboard). +## API Reference + +### Health + +| Method | Path | Description | +| ------ | --------------- | ----------------- | +| GET | `/health` | Uptime and status | +| GET | `/health/ready` | Readiness check | + +### Agents + +| Method | Path | Description | +| ------ | ------------------------- | ---------------------- | +| POST | `/agents/spawn` | Spawn a new agent | +| GET | `/agents/:agentId/status` | Get agent status | +| POST | `/agents/:agentId/kill` | Kill a single agent | +| POST | `/agents/kill-all` | Kill all active agents | + +#### POST /agents/spawn + +```json +{ + "taskId": "string (required)", + "agentType": "worker | reviewer | tester", + "gateProfile": "strict | standard | minimal | custom (optional)", + "context": { + "repository": "https://git.example.com/repo.git", + "branch": "main", + "workItems": ["US-001"], + "skills": ["typescript"] + } +} +``` + +Response: + +```json +{ + "agentId": "uuid", + "status": "spawning" +} +``` + +#### GET /agents/:agentId/status + +Response: + +```json +{ + "agentId": "uuid", + "taskId": "string", + "status": "spawning | running | completed | failed | killed", + "spawnedAt": "ISO timestamp", + "startedAt": "ISO timestamp (optional)", + "completedAt": "ISO timestamp (optional)", + "error": "string (optional)" +} +``` + +#### POST /agents/kill-all + +Response: + +```json +{ + "message": "Kill all completed: 3 killed, 0 failed", + "total": 3, + "killed": 3, + "failed": 0, + "errors": [] +} +``` + +## Services + +| Service | Module | Responsibility | +| ------------------------ | ----------- | ---------------------------------------------------- | +| AgentSpawnerService | Spawner | Create agent sessions, generate UUIDs, track state | +| AgentLifecycleService | Spawner | State machine transitions with Valkey pub/sub events | +| DockerSandboxService | Spawner | Container creation with memory/CPU limits | +| QueueService | Queue | BullMQ priority queue with exponential backoff retry | +| KillswitchService | Killswitch | Emergency agent termination with audit logging | +| CleanupService | Killswitch | Multi-step cleanup (Docker, worktree, Valkey state) | +| GitOperationsService | Git | Clone, branch, commit, push operations | +| WorktreeManagerService | Git | Per-agent worktree isolation | +| ConflictDetectionService | Git | Merge conflict detection before push | +| SecretScannerService | Git | Detect hardcoded secrets (AWS, API keys, JWTs, etc.) | +| ValkeyService | Valkey | Distributed state and event pub/sub | +| CoordinatorClientService | Coordinator | HTTP client for quality gate API with retry | +| QualityGatesService | Coordinator | Pre-commit and post-commit gate evaluation | + +## Valkey State Keys + +``` +orchestrator:task:{taskId} → TaskState (status, agentId, context, timestamps) +orchestrator:agent:{agentId} → AgentState (status, taskId, timestamps, error) +orchestrator:events → Pub/sub channel for lifecycle events +``` + +## Quality Gate Profiles + +| Profile | Default For | Gates | +| -------- | ----------- | --------------------------------------------------------------------- | +| strict | reviewer | typecheck, lint, tests, coverage (85%), build, integration, AI review | +| standard | worker | typecheck, lint, tests, coverage (85%) | +| minimal | tester | tests only | + ## Development ```bash # Install dependencies (from monorepo root) pnpm install -# Run in dev mode (watch mode) +# Run in dev mode pnpm --filter @mosaic/orchestrator dev # Build pnpm --filter @mosaic/orchestrator build -# Start production -pnpm --filter @mosaic/orchestrator start:prod - -# Test +# Run unit tests pnpm --filter @mosaic/orchestrator test -# Generate module (NestJS CLI) -cd apps/orchestrator -nest generate module -nest generate controller -nest generate service +# Run E2E/integration tests +pnpm --filter @mosaic/orchestrator test:e2e + +# Type check +pnpm --filter @mosaic/orchestrator typecheck + +# Lint +pnpm --filter @mosaic/orchestrator lint ``` -## NestJS Architecture +## Testing -- **Modules:** Feature-based organization (spawner, queue, monitor, etc.) -- **Controllers:** HTTP endpoints (health, agents, tasks) -- **Services:** Business logic -- **Providers:** Dependency injection +- **Unit tests:** Co-located `*.spec.ts` files (19 test files, 447+ tests) +- **Integration tests:** `tests/integration/*.e2e-spec.ts` (17 E2E tests) +- **Coverage threshold:** 85% (lines, functions, branches, statements) ## Configuration -Environment variables loaded via @nestjs/config. -See `.env.example` for required vars. +Environment variables loaded via `@nestjs/config`. Key variables: -## Documentation +| Variable | Description | +| ------------------- | -------------------------------------- | +| `ORCHESTRATOR_PORT` | HTTP port (default: 3001) | +| `CLAUDE_API_KEY` | Claude API key for agents | +| `VALKEY_HOST` | Valkey/Redis host (default: localhost) | +| `VALKEY_PORT` | Valkey/Redis port (default: 6379) | +| `COORDINATOR_URL` | Quality Coordinator base URL | +| `SANDBOX_ENABLED` | Enable Docker sandbox (true/false) | -- Architecture: `/docs/ORCHESTRATOR-MONOREPO-SETUP.md` -- API Contracts: `/docs/M6-ISSUE-AUDIT.md` +## Related Documentation + +- Design: `docs/design/agent-orchestration.md` +- Setup: `docs/ORCHESTRATOR-MONOREPO-SETUP.md` - Milestone: M6-AgentOrchestration (0.0.6) diff --git a/apps/orchestrator/src/api/agents/agents.controller.spec.ts b/apps/orchestrator/src/api/agents/agents.controller.spec.ts index 1cb00fc..bd4d7ad 100644 --- a/apps/orchestrator/src/api/agents/agents.controller.spec.ts +++ b/apps/orchestrator/src/api/agents/agents.controller.spec.ts @@ -13,6 +13,8 @@ describe("AgentsController", () => { }; let spawnerService: { spawnAgent: ReturnType; + listAgentSessions: ReturnType; + getAgentSession: ReturnType; }; let lifecycleService: { getAgentLifecycleState: ReturnType; @@ -30,6 +32,8 @@ describe("AgentsController", () => { spawnerService = { spawnAgent: vi.fn(), + listAgentSessions: vi.fn(), + getAgentSession: vi.fn(), }; lifecycleService = { @@ -58,6 +62,109 @@ describe("AgentsController", () => { expect(controller).toBeDefined(); }); + describe("listAgents", () => { + it("should return empty array when no agents exist", () => { + // Arrange + spawnerService.listAgentSessions.mockReturnValue([]); + + // Act + const result = controller.listAgents(); + + // Assert + expect(spawnerService.listAgentSessions).toHaveBeenCalled(); + expect(result).toEqual([]); + }); + + it("should return all agent sessions with mapped status", () => { + // Arrange + const sessions = [ + { + agentId: "agent-1", + taskId: "task-1", + agentType: "worker" as const, + state: "running" as const, + context: { + repository: "repo", + branch: "main", + workItems: [], + }, + spawnedAt: new Date("2026-02-05T12:00:00Z"), + }, + { + agentId: "agent-2", + taskId: "task-2", + agentType: "reviewer" as const, + state: "completed" as const, + context: { + repository: "repo", + branch: "main", + workItems: [], + }, + spawnedAt: new Date("2026-02-05T11:00:00Z"), + completedAt: new Date("2026-02-05T11:30:00Z"), + }, + { + agentId: "agent-3", + taskId: "task-3", + agentType: "tester" as const, + state: "failed" as const, + context: { + repository: "repo", + branch: "main", + workItems: [], + }, + spawnedAt: new Date("2026-02-05T10:00:00Z"), + error: "Test execution failed", + }, + ]; + spawnerService.listAgentSessions.mockReturnValue(sessions); + + // Act + const result = controller.listAgents(); + + // Assert + expect(spawnerService.listAgentSessions).toHaveBeenCalled(); + expect(result).toHaveLength(3); + expect(result[0]).toEqual({ + agentId: "agent-1", + taskId: "task-1", + status: "running", + agentType: "worker", + spawnedAt: "2026-02-05T12:00:00.000Z", + completedAt: undefined, + error: undefined, + }); + expect(result[1]).toEqual({ + agentId: "agent-2", + taskId: "task-2", + status: "completed", + agentType: "reviewer", + spawnedAt: "2026-02-05T11:00:00.000Z", + completedAt: "2026-02-05T11:30:00.000Z", + error: undefined, + }); + expect(result[2]).toEqual({ + agentId: "agent-3", + taskId: "task-3", + status: "failed", + agentType: "tester", + spawnedAt: "2026-02-05T10:00:00.000Z", + completedAt: undefined, + error: "Test execution failed", + }); + }); + + it("should handle errors gracefully", () => { + // Arrange + spawnerService.listAgentSessions.mockImplementation(() => { + throw new Error("Service unavailable"); + }); + + // Act & Assert + expect(() => controller.listAgents()).toThrow("Failed to list agents: Service unavailable"); + }); + }); + describe("spawn", () => { const validRequest = { taskId: "task-123", diff --git a/apps/orchestrator/src/api/agents/agents.controller.ts b/apps/orchestrator/src/api/agents/agents.controller.ts index 17db768..d8b74e5 100644 --- a/apps/orchestrator/src/api/agents/agents.controller.ts +++ b/apps/orchestrator/src/api/agents/agents.controller.ts @@ -70,6 +70,47 @@ export class AgentsController { } } + /** + * List all agents + * @returns Array of all agent sessions with their status + */ + @Get() + listAgents(): { + agentId: string; + taskId: string; + status: string; + agentType: string; + spawnedAt: string; + completedAt?: string; + error?: string; + }[] { + this.logger.log("Received request to list all agents"); + + try { + // Get all sessions from spawner service + const sessions = this.spawnerService.listAgentSessions(); + + // Map to response format + const agents = sessions.map((session) => ({ + agentId: session.agentId, + taskId: session.taskId, + status: session.state, + agentType: session.agentType, + spawnedAt: session.spawnedAt.toISOString(), + completedAt: session.completedAt?.toISOString(), + error: session.error, + })); + + this.logger.log(`Found ${agents.length.toString()} agents`); + + return agents; + } catch (error: unknown) { + const errorMessage = error instanceof Error ? error.message : String(error); + this.logger.error(`Failed to list agents: ${errorMessage}`); + throw new Error(`Failed to list agents: ${errorMessage}`); + } + } + /** * Get agent status * @param agentId Agent ID to query diff --git a/apps/orchestrator/tests/integration/agent-lifecycle.e2e-spec.ts b/apps/orchestrator/tests/integration/agent-lifecycle.e2e-spec.ts new file mode 100644 index 0000000..ebe70b5 --- /dev/null +++ b/apps/orchestrator/tests/integration/agent-lifecycle.e2e-spec.ts @@ -0,0 +1,242 @@ +/** + * E2E Test: Full Agent Lifecycle + * + * Tests the complete lifecycle of an agent from spawn to completion/failure. + * Uses mocked services to simulate the full flow without external dependencies. + * + * Lifecycle: spawn → running → completed/failed/killed + * + * Covers issue #226 (ORCH-125) + */ +import { describe, it, expect, beforeEach, vi } from "vitest"; +import { ConfigService } from "@nestjs/config"; +import { AgentSpawnerService } from "../../src/spawner/agent-spawner.service"; +import { AgentLifecycleService } from "../../src/spawner/agent-lifecycle.service"; +import { QueueService } from "../../src/queue/queue.service"; +import { KillswitchService } from "../../src/killswitch/killswitch.service"; +import { AgentsController } from "../../src/api/agents/agents.controller"; +import type { AgentState } from "../../src/valkey/types"; + +describe("E2E: Full Agent Lifecycle", () => { + let controller: AgentsController; + let spawnerService: AgentSpawnerService; + let lifecycleService: AgentLifecycleService; + let queueService: QueueService; + + const mockConfigService = { + get: vi.fn((key: string, defaultValue?: unknown) => { + const config: Record = { + "orchestrator.claude.apiKey": "test-api-key", + "orchestrator.queue.name": "test-queue", + "orchestrator.queue.maxRetries": 3, + "orchestrator.queue.baseDelay": 100, + "orchestrator.queue.maxDelay": 1000, + "orchestrator.valkey.host": "localhost", + "orchestrator.valkey.port": 6379, + }; + return config[key] ?? defaultValue; + }), + }; + + beforeEach(async () => { + vi.clearAllMocks(); + + // Create real spawner service with mock config + spawnerService = new AgentSpawnerService(mockConfigService as unknown as ConfigService); + + // Create mock lifecycle service + lifecycleService = { + transitionToRunning: vi.fn(), + transitionToCompleted: vi.fn(), + transitionToFailed: vi.fn(), + getAgentLifecycleState: vi.fn(), + } as unknown as AgentLifecycleService; + + // Create mock queue service + queueService = { + addTask: vi.fn().mockResolvedValue(undefined), + getStats: vi.fn(), + } as unknown as QueueService; + + const killswitchService = { + killAgent: vi.fn(), + killAllAgents: vi.fn(), + } as unknown as KillswitchService; + + controller = new AgentsController( + queueService, + spawnerService, + lifecycleService, + killswitchService + ); + }); + + describe("Happy path: spawn → queue → track", () => { + it("should spawn an agent, register it, and queue the task", async () => { + // Step 1: Spawn agent + const spawnResult = await controller.spawn({ + taskId: "e2e-task-001", + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + skills: ["typescript"], + }, + }); + + expect(spawnResult.agentId).toBeDefined(); + expect(spawnResult.status).toBe("spawning"); + + // Step 2: Verify agent appears in list + const agents = spawnerService.listAgentSessions(); + expect(agents).toHaveLength(1); + expect(agents[0].state).toBe("spawning"); + expect(agents[0].taskId).toBe("e2e-task-001"); + + // Step 3: Verify agent status + const session = spawnerService.getAgentSession(spawnResult.agentId); + expect(session).toBeDefined(); + expect(session?.state).toBe("spawning"); + expect(session?.agentType).toBe("worker"); + + // Step 4: Verify task was queued + expect(queueService.addTask).toHaveBeenCalledWith( + "e2e-task-001", + expect.objectContaining({ + repository: "https://git.example.com/repo.git", + branch: "main", + }), + { priority: 5 } + ); + }); + + it("should track multiple agents spawned sequentially", async () => { + // Spawn 3 agents + const agents = []; + for (let i = 0; i < 3; i++) { + const result = await controller.spawn({ + taskId: `e2e-task-${String(i).padStart(3, "0")}`, + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: [`US-${String(i).padStart(3, "0")}`], + }, + }); + agents.push(result); + } + + // Verify all 3 agents are listed + const listedAgents = spawnerService.listAgentSessions(); + expect(listedAgents).toHaveLength(3); + + // Verify each agent has unique ID + const agentIds = listedAgents.map((a) => a.agentId); + const uniqueIds = new Set(agentIds); + expect(uniqueIds.size).toBe(3); + }); + }); + + describe("Failure path: spawn → running → failed", () => { + it("should handle agent spawn with invalid parameters", async () => { + await expect( + controller.spawn({ + taskId: "", + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }) + ).rejects.toThrow("taskId is required"); + }); + + it("should reject invalid agent types", async () => { + await expect( + controller.spawn({ + taskId: "e2e-task-001", + agentType: "invalid" as "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }) + ).rejects.toThrow("agentType must be one of"); + }); + }); + + describe("Multi-type agents", () => { + it("should support worker, reviewer, and tester agent types", async () => { + const types = ["worker", "reviewer", "tester"] as const; + + for (const agentType of types) { + const result = await controller.spawn({ + taskId: `e2e-task-${agentType}`, + agentType, + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }); + + expect(result.agentId).toBeDefined(); + expect(result.status).toBe("spawning"); + } + + const agents = spawnerService.listAgentSessions(); + expect(agents).toHaveLength(3); + + const agentTypes = agents.map((a) => a.agentType); + expect(agentTypes).toContain("worker"); + expect(agentTypes).toContain("reviewer"); + expect(agentTypes).toContain("tester"); + }); + }); + + describe("Agent status tracking", () => { + it("should track spawn timestamp", async () => { + const before = new Date(); + + const result = await controller.spawn({ + taskId: "e2e-task-time", + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }); + + const after = new Date(); + const agents = spawnerService.listAgentSessions(); + const agent = agents.find((a) => a.agentId === result.agentId); + expect(agent).toBeDefined(); + + const spawnedAt = new Date(agent!.spawnedAt); + expect(spawnedAt.getTime()).toBeGreaterThanOrEqual(before.getTime()); + expect(spawnedAt.getTime()).toBeLessThanOrEqual(after.getTime()); + }); + + it("should return correct status for each agent", async () => { + // Mock lifecycle to return specific states + const mockState: AgentState = { + agentId: "mock-agent-1", + taskId: "e2e-task-001", + status: "running", + startedAt: new Date().toISOString(), + }; + + (lifecycleService.getAgentLifecycleState as ReturnType).mockResolvedValue( + mockState + ); + + const status = await controller.getAgentStatus("mock-agent-1"); + expect(status.status).toBe("running"); + expect(status.taskId).toBe("e2e-task-001"); + }); + }); +}); diff --git a/apps/orchestrator/tests/integration/concurrent-agents.e2e-spec.ts b/apps/orchestrator/tests/integration/concurrent-agents.e2e-spec.ts new file mode 100644 index 0000000..61e830e --- /dev/null +++ b/apps/orchestrator/tests/integration/concurrent-agents.e2e-spec.ts @@ -0,0 +1,218 @@ +/** + * E2E Test: Concurrent Agents + * + * Tests multiple agents running concurrently with proper isolation. + * Verifies agent-level isolation, queue management, and concurrent operations. + * + * Covers issue #228 (ORCH-127) + */ +import { describe, it, expect, beforeEach, vi } from "vitest"; +import { AgentSpawnerService } from "../../src/spawner/agent-spawner.service"; +import { AgentsController } from "../../src/api/agents/agents.controller"; +import { QueueService } from "../../src/queue/queue.service"; +import { AgentLifecycleService } from "../../src/spawner/agent-lifecycle.service"; +import { KillswitchService } from "../../src/killswitch/killswitch.service"; +import { ConfigService } from "@nestjs/config"; + +describe("E2E: Concurrent Agents", () => { + let controller: AgentsController; + let spawnerService: AgentSpawnerService; + + const mockConfigService = { + get: vi.fn((key: string, defaultValue?: unknown) => { + const config: Record = { + "orchestrator.claude.apiKey": "test-api-key", + }; + return config[key] ?? defaultValue; + }), + }; + + beforeEach(() => { + vi.clearAllMocks(); + + spawnerService = new AgentSpawnerService(mockConfigService as unknown as ConfigService); + + const queueService = { + addTask: vi.fn().mockResolvedValue(undefined), + } as unknown as QueueService; + + const lifecycleService = { + getAgentLifecycleState: vi.fn(), + } as unknown as AgentLifecycleService; + + const killswitchService = { + killAgent: vi.fn(), + killAllAgents: vi.fn(), + } as unknown as KillswitchService; + + controller = new AgentsController( + queueService, + spawnerService, + lifecycleService, + killswitchService + ); + }); + + describe("Concurrent spawning", () => { + it("should spawn multiple agents simultaneously without conflicts", async () => { + // Spawn 5 agents in parallel + const spawnPromises = Array.from({ length: 5 }, (_, i) => + controller.spawn({ + taskId: `concurrent-task-${String(i)}`, + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: `feature/task-${String(i)}`, + workItems: [`US-${String(i).padStart(3, "0")}`], + }, + }) + ); + + const results = await Promise.all(spawnPromises); + + // All should succeed + expect(results).toHaveLength(5); + results.forEach((result) => { + expect(result.agentId).toBeDefined(); + expect(result.status).toBe("spawning"); + }); + + // All IDs should be unique + const ids = new Set(results.map((r) => r.agentId)); + expect(ids.size).toBe(5); + + // All should appear in the list + const agents = spawnerService.listAgentSessions(); + expect(agents).toHaveLength(5); + }); + + it("should assign unique IDs to every agent even under concurrent load", async () => { + const allIds = new Set(); + const batchSize = 10; + + // Spawn agents in batches + for (let batch = 0; batch < 3; batch++) { + const promises = Array.from({ length: batchSize }, (_, i) => + controller.spawn({ + taskId: `batch-${String(batch)}-task-${String(i)}`, + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: [`US-${String(batch * batchSize + i)}`], + }, + }) + ); + + const results = await Promise.all(promises); + results.forEach((r) => allIds.add(r.agentId)); + } + + // All 30 IDs should be unique + expect(allIds.size).toBe(30); + + // All 30 should be listed + const agents = spawnerService.listAgentSessions(); + expect(agents).toHaveLength(30); + }); + }); + + describe("Mixed agent types concurrently", () => { + it("should handle mixed worker/reviewer/tester agents concurrently", async () => { + const types = ["worker", "reviewer", "tester"] as const; + + const promises = types.flatMap((agentType, typeIndex) => + Array.from({ length: 3 }, (_, i) => + controller.spawn({ + taskId: `mixed-${agentType}-${String(i)}`, + agentType, + context: { + repository: "https://git.example.com/repo.git", + branch: `branch-${String(typeIndex * 3 + i)}`, + workItems: [`US-${String(typeIndex * 3 + i)}`], + }, + }) + ) + ); + + const results = await Promise.all(promises); + expect(results).toHaveLength(9); + + const agents = spawnerService.listAgentSessions(); + expect(agents).toHaveLength(9); + + // Verify type distribution + const typeCounts = agents.reduce( + (acc, a) => { + acc[a.agentType] = (acc[a.agentType] ?? 0) + 1; + return acc; + }, + {} as Record + ); + + expect(typeCounts["worker"]).toBe(3); + expect(typeCounts["reviewer"]).toBe(3); + expect(typeCounts["tester"]).toBe(3); + }); + }); + + describe("Agent isolation", () => { + it("should isolate agent contexts from each other", async () => { + const agent1 = await controller.spawn({ + taskId: "isolated-task-1", + agentType: "worker", + context: { + repository: "https://git.example.com/repo-a.git", + branch: "main", + workItems: ["US-001"], + skills: ["typescript"], + }, + }); + + const agent2 = await controller.spawn({ + taskId: "isolated-task-2", + agentType: "reviewer", + context: { + repository: "https://git.example.com/repo-b.git", + branch: "develop", + workItems: ["US-002"], + skills: ["python"], + }, + }); + + // Verify sessions are independent + const session1 = spawnerService.getAgentSession(agent1.agentId); + const session2 = spawnerService.getAgentSession(agent2.agentId); + + expect(session1?.context.repository).toBe("https://git.example.com/repo-a.git"); + expect(session2?.context.repository).toBe("https://git.example.com/repo-b.git"); + expect(session1?.context.branch).toBe("main"); + expect(session2?.context.branch).toBe("develop"); + }); + + it("should not leak state between concurrent agent operations", async () => { + // Spawn agents with different task contexts + const spawnPromises = Array.from({ length: 5 }, (_, i) => + controller.spawn({ + taskId: `leak-test-${String(i)}`, + agentType: "worker", + context: { + repository: `https://git.example.com/repo-${String(i)}.git`, + branch: `branch-${String(i)}`, + workItems: [`US-${String(i).padStart(3, "0")}`], + }, + }) + ); + + const results = await Promise.all(spawnPromises); + + // Verify each agent has its own isolated context + results.forEach((result, i) => { + const session = spawnerService.getAgentSession(result.agentId); + expect(session?.taskId).toBe(`leak-test-${String(i)}`); + expect(session?.context.repository).toBe(`https://git.example.com/repo-${String(i)}.git`); + expect(session?.context.branch).toBe(`branch-${String(i)}`); + }); + }); + }); +}); diff --git a/apps/orchestrator/tests/integration/killswitch.e2e-spec.ts b/apps/orchestrator/tests/integration/killswitch.e2e-spec.ts new file mode 100644 index 0000000..b8f19b2 --- /dev/null +++ b/apps/orchestrator/tests/integration/killswitch.e2e-spec.ts @@ -0,0 +1,158 @@ +/** + * E2E Test: Killswitch + * + * Tests the emergency stop mechanism for terminating agents. + * Verifies single agent kill, kill-all, and cleanup operations. + * + * Covers issue #227 (ORCH-126) + */ +import { describe, it, expect, beforeEach, vi } from "vitest"; +import { KillswitchService } from "../../src/killswitch/killswitch.service"; +import { AgentSpawnerService } from "../../src/spawner/agent-spawner.service"; +import { AgentsController } from "../../src/api/agents/agents.controller"; +import { QueueService } from "../../src/queue/queue.service"; +import { AgentLifecycleService } from "../../src/spawner/agent-lifecycle.service"; +import { ConfigService } from "@nestjs/config"; + +describe("E2E: Killswitch", () => { + let controller: AgentsController; + let spawnerService: AgentSpawnerService; + let killswitchService: KillswitchService; + + const mockConfigService = { + get: vi.fn((key: string, defaultValue?: unknown) => { + const config: Record = { + "orchestrator.claude.apiKey": "test-api-key", + }; + return config[key] ?? defaultValue; + }), + }; + + beforeEach(() => { + vi.clearAllMocks(); + + spawnerService = new AgentSpawnerService(mockConfigService as unknown as ConfigService); + + killswitchService = { + killAgent: vi.fn().mockResolvedValue(undefined), + killAllAgents: vi.fn().mockResolvedValue({ + total: 3, + killed: 3, + failed: 0, + }), + } as unknown as KillswitchService; + + const queueService = { + addTask: vi.fn().mockResolvedValue(undefined), + } as unknown as QueueService; + + const lifecycleService = { + getAgentLifecycleState: vi.fn(), + } as unknown as AgentLifecycleService; + + controller = new AgentsController( + queueService, + spawnerService, + lifecycleService, + killswitchService + ); + }); + + describe("Single agent kill", () => { + it("should kill a single agent by ID", async () => { + // Spawn an agent first + const spawnResult = await controller.spawn({ + taskId: "kill-test-001", + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }); + + // Kill the agent + const result = await controller.killAgent(spawnResult.agentId); + + expect(result.message).toContain("killed successfully"); + expect(killswitchService.killAgent).toHaveBeenCalledWith(spawnResult.agentId); + }); + + it("should handle kill of non-existent agent gracefully", async () => { + (killswitchService.killAgent as ReturnType).mockRejectedValue( + new Error("Agent not found") + ); + + await expect(controller.killAgent("non-existent")).rejects.toThrow("Agent not found"); + }); + }); + + describe("Kill all agents", () => { + it("should kill all active agents", async () => { + // Spawn multiple agents to verify they exist before kill-all + const spawned = []; + for (let i = 0; i < 3; i++) { + const result = await controller.spawn({ + taskId: `kill-all-test-${String(i)}`, + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: [`US-${String(i)}`], + }, + }); + spawned.push(result); + } + + // Verify agents were spawned + expect(spawnerService.listAgentSessions()).toHaveLength(3); + + // Kill all (mock returns hardcoded result matching spawn count) + const result = await controller.killAllAgents(); + + expect(result.total).toBe(3); + expect(result.killed).toBe(3); + expect(result.failed).toBe(0); + expect(killswitchService.killAllAgents).toHaveBeenCalled(); + }); + + it("should report partial failures in kill-all", async () => { + (killswitchService.killAllAgents as ReturnType).mockResolvedValue({ + total: 3, + killed: 2, + failed: 1, + errors: ["Agent abc123 unresponsive"], + }); + + const result = await controller.killAllAgents(); + + expect(result.total).toBe(3); + expect(result.killed).toBe(2); + expect(result.failed).toBe(1); + expect(result.errors).toContain("Agent abc123 unresponsive"); + }); + }); + + describe("Kill during lifecycle states", () => { + it("should be able to kill agent in spawning state", async () => { + const spawnResult = await controller.spawn({ + taskId: "kill-spawning-test", + agentType: "worker", + context: { + repository: "https://git.example.com/repo.git", + branch: "main", + workItems: ["US-001"], + }, + }); + + // Verify agent is spawning + const agents = spawnerService.listAgentSessions(); + const agent = agents.find((a) => a.agentId === spawnResult.agentId); + expect(agent?.state).toBe("spawning"); + + // Kill should succeed even in spawning state + const result = await controller.killAgent(spawnResult.agentId); + expect(result.message).toContain("killed successfully"); + }); + }); +}); diff --git a/apps/orchestrator/tests/integration/vitest.config.ts b/apps/orchestrator/tests/integration/vitest.config.ts new file mode 100644 index 0000000..45a1a0b --- /dev/null +++ b/apps/orchestrator/tests/integration/vitest.config.ts @@ -0,0 +1,10 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + globals: true, + environment: "node", + include: ["**/*.e2e-spec.ts"], + testTimeout: 30000, + }, +}); diff --git a/apps/web/src/components/widgets/AgentStatusWidget.tsx b/apps/web/src/components/widgets/AgentStatusWidget.tsx index c62b238..87c551e 100644 --- a/apps/web/src/components/widgets/AgentStatusWidget.tsx +++ b/apps/web/src/components/widgets/AgentStatusWidget.tsx @@ -7,76 +7,103 @@ import { Bot, Activity, AlertCircle, CheckCircle, Clock } from "lucide-react"; import type { WidgetProps } from "@mosaic/shared"; interface Agent { - id: string; - name: string; - status: "IDLE" | "WORKING" | "WAITING" | "ERROR" | "TERMINATED"; - currentTask?: string; - lastHeartbeat: string; - taskCount: number; + agentId: string; + taskId: string; + status: string; + agentType: string; + spawnedAt: string; + completedAt?: string; + error?: string; } export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): React.JSX.Element { const [agents, setAgents] = useState([]); const [isLoading, setIsLoading] = useState(true); + const [error, setError] = useState(null); - // Mock data for now - will fetch from API later + // Fetch agents from orchestrator API useEffect(() => { - setIsLoading(true); - setTimeout(() => { - setAgents([ - { - id: "1", - name: "Code Review Agent", - status: "WORKING", - currentTask: "Reviewing PR #123", - lastHeartbeat: new Date().toISOString(), - taskCount: 42, - }, - { - id: "2", - name: "Documentation Agent", - status: "IDLE", - lastHeartbeat: new Date().toISOString(), - taskCount: 15, - }, - { - id: "3", - name: "Test Runner Agent", - status: "ERROR", - currentTask: "Failed to run tests", - lastHeartbeat: new Date(Date.now() - 300000).toISOString(), - taskCount: 28, - }, - ]); - setIsLoading(false); - }, 500); + const fetchAgents = async (): Promise => { + setIsLoading(true); + setError(null); + + try { + // Get orchestrator URL from environment or default to localhost + const orchestratorUrl = process.env.NEXT_PUBLIC_ORCHESTRATOR_URL ?? "http://localhost:8001"; + + const response = await fetch(`${orchestratorUrl}/agents`, { + headers: { + "Content-Type": "application/json", + }, + }); + + if (!response.ok) { + throw new Error(`Failed to fetch agents: ${response.statusText}`); + } + + const data = (await response.json()) as Agent[]; + setAgents(data); + } catch (err: unknown) { + const errorMessage = err instanceof Error ? err.message : "Unknown error"; + console.error("Failed to fetch agents:", errorMessage); + setError(errorMessage); + setAgents([]); // Clear agents on error + } finally { + setIsLoading(false); + } + }; + + void fetchAgents(); + + // Refresh every 30 seconds + const interval = setInterval(() => { + void fetchAgents(); + }, 30000); + + return (): void => { + clearInterval(interval); + }; }, []); - const getStatusIcon = (status: Agent["status"]): React.JSX.Element => { - switch (status) { - case "WORKING": + const getStatusIcon = (status: string): React.JSX.Element => { + const statusLower = status.toLowerCase(); + switch (statusLower) { + case "running": + case "working": return ; - case "IDLE": - return ; - case "WAITING": + case "spawning": + case "queued": return ; - case "ERROR": + case "completed": + return ; + case "failed": + case "error": return ; - case "TERMINATED": + case "terminated": + case "killed": return ; default: return ; } }; - const getStatusText = (status: Agent["status"]): string => { + const getStatusText = (status: string): string => { return status.charAt(0).toUpperCase() + status.slice(1).toLowerCase(); }; - const getTimeSinceLastHeartbeat = (timestamp: string): string => { + const getAgentName = (agent: Agent): string => { + const typeMap: Record = { + worker: "Worker Agent", + reviewer: "Code Review Agent", + tester: "Test Runner Agent", + }; + return typeMap[agent.agentType] ?? `${getStatusText(agent.agentType)} Agent`; + }; + + const getTimeSinceSpawn = (timestamp: string): string => { const now = new Date(); - const last = new Date(timestamp); - const diffMs = now.getTime() - last.getTime(); + const spawned = new Date(timestamp); + const diffMs = now.getTime() - spawned.getTime(); if (diffMs < 60000) return "Just now"; if (diffMs < 3600000) return `${String(Math.floor(diffMs / 60000))}m ago`; @@ -86,9 +113,9 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): Re const stats = { total: agents.length, - working: agents.filter((a) => a.status === "WORKING").length, - idle: agents.filter((a) => a.status === "IDLE").length, - error: agents.filter((a) => a.status === "ERROR").length, + working: agents.filter((a) => a.status.toLowerCase() === "running").length, + idle: agents.filter((a) => a.status.toLowerCase() === "spawning").length, + error: agents.filter((a) => a.status.toLowerCase() === "failed").length, }; if (isLoading) { @@ -99,6 +126,17 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): Re ); } + if (error) { + return ( +
+
+ + {error} +
+
+ ); + } + return (
{/* Summary stats */} @@ -124,15 +162,15 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): Re {/* Agent list */}
{agents.length === 0 ? ( -
No agents configured
+
No agents running
) : ( agents.map((agent) => (
- {agent.name} + {getAgentName(agent)}
{getStatusIcon(agent.status)} @@ -148,13 +186,13 @@ export function AgentStatusWidget({ id: _id, config: _config }: WidgetProps): Re
- {agent.currentTask && ( -
{agent.currentTask}
- )} +
Task: {agent.taskId}
+ + {agent.error &&
{agent.error}
}
- {agent.taskCount} tasks completed - {getTimeSinceLastHeartbeat(agent.lastHeartbeat)} + Agent ID: {agent.agentId.slice(0, 8)}... + {getTimeSinceSpawn(agent.spawnedAt)}
)) diff --git a/apps/web/src/components/widgets/__tests__/AgentStatusWidget.test.tsx b/apps/web/src/components/widgets/__tests__/AgentStatusWidget.test.tsx new file mode 100644 index 0000000..c1d7b15 --- /dev/null +++ b/apps/web/src/components/widgets/__tests__/AgentStatusWidget.test.tsx @@ -0,0 +1,153 @@ +import { render, screen, waitFor } from "@testing-library/react"; +import { describe, it, expect, vi, beforeEach, afterEach } from "vitest"; +import { AgentStatusWidget } from "../AgentStatusWidget"; + +describe("AgentStatusWidget", () => { + const mockFetch = vi.fn(); + + beforeEach(() => { + global.fetch = mockFetch as unknown as typeof fetch; + }); + + afterEach(() => { + vi.clearAllMocks(); + }); + + it("should render loading state initially", () => { + mockFetch.mockImplementation( + // eslint-disable-next-line @typescript-eslint/no-empty-function + () => new Promise(() => {}) // Never resolves + ); + + render(); + + expect(screen.getByText("Loading agents...")).toBeInTheDocument(); + }); + + it("should fetch and display agents from API", async () => { + const mockAgents = [ + { + agentId: "agent-1", + taskId: "task-1", + status: "running", + agentType: "worker", + spawnedAt: new Date().toISOString(), + }, + { + agentId: "agent-2", + taskId: "task-2", + status: "completed", + agentType: "reviewer", + spawnedAt: new Date().toISOString(), + completedAt: new Date().toISOString(), + }, + ]; + + mockFetch.mockResolvedValue({ + ok: true, + json: () => Promise.resolve(mockAgents), + }); + + render(); + + await waitFor(() => { + expect(screen.getByText("Worker Agent")).toBeInTheDocument(); + expect(screen.getByText("Code Review Agent")).toBeInTheDocument(); + }); + + expect(screen.getByText("Task: task-1")).toBeInTheDocument(); + expect(screen.getByText("Task: task-2")).toBeInTheDocument(); + }); + + it("should display error message when fetch fails", async () => { + mockFetch.mockResolvedValue({ + ok: false, + statusText: "Internal Server Error", + }); + + render(); + + await waitFor(() => { + expect(screen.getByText(/Failed to fetch agents: Internal Server Error/)).toBeInTheDocument(); + }); + }); + + it("should display no agents message when list is empty", async () => { + mockFetch.mockResolvedValue({ + ok: true, + json: () => Promise.resolve([]), + }); + + render(); + + await waitFor(() => { + expect(screen.getByText("No agents running")).toBeInTheDocument(); + }); + }); + + it("should display agent error messages", async () => { + const mockAgents = [ + { + agentId: "agent-1", + taskId: "task-1", + status: "failed", + agentType: "tester", + spawnedAt: new Date().toISOString(), + error: "Test execution failed", + }, + ]; + + mockFetch.mockResolvedValue({ + ok: true, + json: () => Promise.resolve(mockAgents), + }); + + render(); + + await waitFor(() => { + expect(screen.getByText("Test execution failed")).toBeInTheDocument(); + }); + }); + + it("should display correct stats summary", async () => { + const mockAgents = [ + { + agentId: "agent-1", + taskId: "task-1", + status: "running", + agentType: "worker", + spawnedAt: new Date().toISOString(), + }, + { + agentId: "agent-2", + taskId: "task-2", + status: "running", + agentType: "reviewer", + spawnedAt: new Date().toISOString(), + }, + { + agentId: "agent-3", + taskId: "task-3", + status: "failed", + agentType: "tester", + spawnedAt: new Date().toISOString(), + }, + ]; + + mockFetch.mockResolvedValue({ + ok: true, + json: () => Promise.resolve(mockAgents), + }); + + render(); + + await waitFor(() => { + // Check stats: 3 total, 2 working, 0 idle, 1 error + const stats = screen.getAllByText(/^[0-9]+$/); + expect(stats[0]).toHaveTextContent("3"); // Total + expect(stats[1]).toHaveTextContent("2"); // Working + expect(stats[2]).toHaveTextContent("0"); // Idle + expect(stats[3]).toHaveTextContent("1"); // Error + }); + }); +}); diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_1_remediation_needed.md new file mode 100644 index 0000000..e93073b --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:25:45 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_2_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_2_remediation_needed.md new file mode 100644 index 0000000..eb5f1ae --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_2_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 2 +**Generated:** 2026-02-05 12:25:47 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_2_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_3_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_3_remediation_needed.md new file mode 100644 index 0000000..e41a361 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_3_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 3 +**Generated:** 2026-02-05 12:25:57 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1225_3_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1227_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1227_1_remediation_needed.md new file mode 100644 index 0000000..4c2848a --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1227_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:27:48 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1227_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_1_remediation_needed.md new file mode 100644 index 0000000..ebf7af5 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:28:48 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_2_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_2_remediation_needed.md new file mode 100644 index 0000000..bf5b61e --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_2_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 2 +**Generated:** 2026-02-05 12:28:50 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_2_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_3_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_3_remediation_needed.md new file mode 100644 index 0000000..d018993 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_3_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.spec.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 3 +**Generated:** 2026-02-05 12:28:52 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.spec.ts_20260205-1228_3_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1225_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1225_1_remediation_needed.md new file mode 100644 index 0000000..32f6a38 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1225_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:25:37 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1225_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_1_remediation_needed.md new file mode 100644 index 0000000..ac7fe34 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:27:25 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_2_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_2_remediation_needed.md new file mode 100644 index 0000000..ba5ff8e --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_2_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 2 +**Generated:** 2026-02-05 12:27:27 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1227_2_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1228_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1228_1_remediation_needed.md new file mode 100644 index 0000000..00e6ad3 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1228_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/orchestrator/src/api/agents/agents.controller.ts +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:28:41 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-orchestrator-src-api-agents-agents.controller.ts_20260205-1228_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_1_remediation_needed.md new file mode 100644 index 0000000..edf51de --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:26:19 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_2_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_2_remediation_needed.md new file mode 100644 index 0000000..d1bd7c3 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_2_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 2 +**Generated:** 2026-02-05 12:26:34 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_2_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_3_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_3_remediation_needed.md new file mode 100644 index 0000000..50e4cea --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_3_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 3 +**Generated:** 2026-02-05 12:26:36 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_3_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_4_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_4_remediation_needed.md new file mode 100644 index 0000000..8a95f2d --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_4_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 4 +**Generated:** 2026-02-05 12:26:46 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1226_4_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1227_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1227_1_remediation_needed.md new file mode 100644 index 0000000..911d03c --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1227_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:27:48 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1227_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1229_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1229_1_remediation_needed.md new file mode 100644 index 0000000..3ae2d91 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1229_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/AgentStatusWidget.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:29:51 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-AgentStatusWidget.tsx_20260205-1229_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1227_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1227_1_remediation_needed.md new file mode 100644 index 0000000..7842cab --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1227_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/**tests**/AgentStatusWidget.test.tsx +**Tool Used:** Write +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:27:06 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1227_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1230_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1230_1_remediation_needed.md new file mode 100644 index 0000000..9ee6545 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1230_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/**tests**/AgentStatusWidget.test.tsx +**Tool Used:** Write +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:30:26 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1230_1_remediation_needed.md" +``` diff --git a/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1231_1_remediation_needed.md b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1231_1_remediation_needed.md new file mode 100644 index 0000000..c04fbc7 --- /dev/null +++ b/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1231_1_remediation_needed.md @@ -0,0 +1,20 @@ +# QA Remediation Report + +**File:** /home/localadmin/src/mosaic-stack/apps/web/src/components/widgets/**tests**/AgentStatusWidget.test.tsx +**Tool Used:** Edit +**Epic:** general +**Iteration:** 1 +**Generated:** 2026-02-05 12:31:04 + +## Status + +Pending QA validation + +## Next Steps + +This report was created by the QA automation hook. +To process this report, run: + +```bash +claude -p "Use Task tool to launch universal-qa-agent for report: /home/localadmin/src/mosaic-stack/docs/reports/qa-automation/pending/home-localadmin-src-mosaic-stack-apps-web-src-components-widgets-__tests__-AgentStatusWidget.test.tsx_20260205-1231_1_remediation_needed.md" +```