diff --git a/apps/server/tests/unit/routes/running-agents.test.ts b/apps/server/tests/unit/routes/running-agents.test.ts index 6071567f..59279668 100644 --- a/apps/server/tests/unit/routes/running-agents.test.ts +++ b/apps/server/tests/unit/routes/running-agents.test.ts @@ -14,7 +14,6 @@ describe('running-agents routes', () => { mockAutoModeService = { getRunningAgents: vi.fn(), - getStatus: vi.fn(), }; const context = createMockExpressContext(); diff --git a/apps/ui/src/components/views/board-view/dialogs/agent-output-modal.tsx b/apps/ui/src/components/views/board-view/dialogs/agent-output-modal.tsx index 50a60291..9a1ebb75 100644 --- a/apps/ui/src/components/views/board-view/dialogs/agent-output-modal.tsx +++ b/apps/ui/src/components/views/board-view/dialogs/agent-output-modal.tsx @@ -23,6 +23,8 @@ interface AgentOutputModalProps { featureStatus?: string; /** Called when a number key (0-9) is pressed while the modal is open */ onNumberKeyPress?: (key: string) => void; + /** Project path - if not provided, falls back to window.__currentProject for backward compatibility */ + projectPath?: string; } type ViewMode = 'parsed' | 'raw' | 'changes'; @@ -34,6 +36,7 @@ export function AgentOutputModal({ featureId, featureStatus, onNumberKeyPress, + projectPath: projectPathProp, }: AgentOutputModalProps) { const [output, setOutput] = useState(''); const [isLoading, setIsLoading] = useState(true); @@ -62,19 +65,20 @@ export function AgentOutputModal({ setIsLoading(true); try { - // Get current project path from store (we'll need to pass this) - const currentProject = (window as any).__currentProject; - if (!currentProject?.path) { + // Use projectPath prop if provided, otherwise fall back to window.__currentProject for backward compatibility + const resolvedProjectPath = + projectPathProp || (window as any).__currentProject?.path; + if (!resolvedProjectPath) { setIsLoading(false); return; } - projectPathRef.current = currentProject.path; - setProjectPath(currentProject.path); + projectPathRef.current = resolvedProjectPath; + setProjectPath(resolvedProjectPath); // Use features API to get agent output if (api.features) { - const result = await api.features.getAgentOutput(currentProject.path, featureId); + const result = await api.features.getAgentOutput(resolvedProjectPath, featureId); if (result.success) { setOutput(result.content || ''); @@ -93,7 +97,7 @@ export function AgentOutputModal({ }; loadOutput(); - }, [open, featureId]); + }, [open, featureId, projectPathProp]); // Listen to auto mode events and update output useEffect(() => { diff --git a/apps/ui/src/components/views/running-agents-view.tsx b/apps/ui/src/components/views/running-agents-view.tsx index 804b5a19..53c621da 100644 --- a/apps/ui/src/components/views/running-agents-view.tsx +++ b/apps/ui/src/components/views/running-agents-view.tsx @@ -97,13 +97,8 @@ export function RunningAgentsView() { ); const handleViewLogs = useCallback((agent: RunningAgent) => { - // Set the current project context for the modal - const project = projects.find((p) => p.path === agent.projectPath); - if (project) { - (window as any).__currentProject = project; - } setSelectedAgent(agent); - }, [projects]); + }, []); if (loading) { return ( @@ -232,6 +227,7 @@ export function RunningAgentsView() { setSelectedAgent(null)} + projectPath={selectedAgent.projectPath} featureDescription={selectedAgent.description || selectedAgent.title || selectedAgent.featureId} featureId={selectedAgent.featureId} featureStatus="running"