feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization#588
feat: TanStack Query Migration Phase 2 - Cleanup and Test Reorganization#588
Conversation
- Created new modern layout components in src/components/layout/ - Migrated from old MainLayout/SideNavigation to new system - Added BackendStatus component with proper separation of concerns - Fixed horizontal scrollbar issues in project list - Renamed old layouts folder to agent-chat for unused chat panel - Added layout directory to Biome configuration - Fixed all linting and TypeScript issues in new layout code - Uses TanStack Query for backend health monitoring - Temporarily imports old settings/credentials until full migration
…tories - Move tests into dedicated tests/ subdirectories within each feature - Create centralized test utilities in src/features/testing/ - Update all import paths to match new structure - Configure tsconfig.prod.json to exclude test files - Remove legacy test files from old test/ directory - All 32 tests passing with proper provider wrapping
- Export ProjectsViewWithBoundary from projects feature module - Update ProjectPage to use boundary-wrapped version - Provides proper error containment and recovery with TanStack Query integration
- Remove ToolTestingPanel, ClientCard, and MCPClients components - These were part of an unimplemented MCP clients feature - Clean up commented import in MCPPage - Preparing for proper MCP feature migration to features directory
- Remove duplicate/unused mcpService.ts (579 lines) - Keep mcpServerService.ts which is actively used by MCPPage and useMCPQueries - mcpService was never imported or used anywhere in the codebase
- Remove mcpClientService.ts (445 lines) - no longer used after removing MCP client components - Update deprecation comments in mcpServerService to remove references to deleted service - This completes the MCP service cleanup
|
Caution Review failedThe pull request is closed. WalkthroughRefactors layout (adds MainLayout/MinimalLayout, Navigation, useBackendHealth), replaces legacy MCP lifecycle/services/UI with a container-aware MCP feature (new backend endpoints, mcpApi, hooks, views, components), reorganizes and adds colocated tests under Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant App
participant MainLayout
participant HealthHook as useBackendHealth
participant Backend as /api/health
participant Creds as credentialsService
participant Router as react-router
User->>App: open app
App->>MainLayout: mount
MainLayout->>HealthHook: start health query (poll + retries)
HealthHook->>Backend: GET /api/health (5s timeout)
Backend-->>HealthHook: { ready, ... } or error
HealthHook-->>MainLayout: data / error / loading
alt startup failed
MainLayout-->>User: render BackendStartupError
else ready
MainLayout->>Creds: fetch rag_strategy & api_keys
Creds-->>MainLayout: config
MainLayout->>Router: navigate /onboarding if needed
end
MainLayout-->>User: render children + Navigation
sequenceDiagram
autonumber
actor User
participant MCPPage
participant McpViewWithBoundary
participant mcpApi
participant backend as /api/mcp
User->>MCPPage: open MCP page
MCPPage->>McpViewWithBoundary: render
McpViewWithBoundary->>mcpApi: useMcpStatus/useMcpConfig/useMcpClients/useMcpSessionInfo
mcpApi->>backend: GET /api/mcp/status/config/clients/sessions (ETag-aware)
backend-->>mcpApi: status/config/clients/sessions
mcpApi-->>McpViewWithBoundary: data
McpViewWithBoundary-->>User: render dashboard (McpStatusBar, McpClientList, McpConfigSection)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
archon-ui-main/vite.config.ts (1)
341-352: Fix leftover coverage exclusion for old test path.
Coverage excludes still list 'test/' (singular). Update to 'tests/' to avoid accidental inclusion in coverage.Apply this diff:
coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'node_modules/', - 'test/', + 'tests/', '**/*.d.ts', '**/*.config.*', '**/mockData.ts', '**/*.test.{ts,tsx}', ], }
🧹 Nitpick comments (39)
archon-ui-main/src/services/mcpServerService.ts (1)
212-213: Clarify deprecation guidance for callToolIf direct tool invocation is being retired, specify the replacement (or migration path) in the JSDoc to reduce churn for consumers. Consider also emitting a runtime warning for visibility in development.
Suggested update:
/** * Call a specific tool on the Archon MCP server - * @deprecated This method is deprecated + * @deprecated Direct MCP tool invocation is deprecated. Prefer feature-level services using TanStack Query and HTTP APIs. */ async callTool(name: string, arguments_: Record<string, any>): Promise<any> { + console.warn('[deprecated] mcpServerService.callTool(): prefer feature-level services with TanStack Query-backed HTTP APIs.');archon-ui-main/biome.json (1)
4-4: Confirm expanding Biome scope into src/components/layout/Past guidance said to run Biome only under src/features and keep legacy components linted by ESLint. Including src/components/layout/** may conflict with that convention and could introduce style drift between components vs features. Please confirm intent or revert.
If reverting is desired, apply:
- "includes": ["src/features/**", "src/components/layout/**"] + "includes": ["src/features/**"]archon-ui-main/vite.config.ts (1)
321-353: Avoid split Vitest configuration between vite.config.ts and vitest.config.ts.
Having test blocks in both files risks drift (reporters, coverage excludes, include globs). Prefer a single source of truth in vitest.config.ts.Apply this diff to drop the test block here and keep vitest.config.ts authoritative:
resolve: { alias: { "@": path.resolve(__dirname, "./src"), }, }, - test: { - globals: true, - environment: 'jsdom', - setupFiles: './tests/setup.ts', - css: true, - include: [ - 'src/**/*.{test,spec}.{ts,tsx}', // Tests colocated in features - 'tests/**/*.{test,spec}.{ts,tsx}' // Tests in tests directory - ], - exclude: [ - '**/node_modules/**', - '**/dist/**', - '**/cypress/**', - '**/.{idea,git,cache,output,temp}/**', - '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*' - ], - env: { - VITE_HOST: host, - VITE_PORT: port, - }, - coverage: { - provider: 'v8', - reporter: ['text', 'json', 'html'], - exclude: [ - 'node_modules/', - 'test/', - '**/*.d.ts', - '**/*.config.*', - '**/mockData.ts', - '**/*.test.{ts,tsx}', - ], - } - } + // Vitest configuration lives in vitest.config.tsarchon-ui-main/tests/README.md (4)
9-14: Add a language to fenced code blocks (tree snippet).Markdown lint MD040: specify a language, e.g., text.
-``` +```text src/features/projects/ ├── components/ │ ├── ProjectCard.tsx │ └── ProjectCard.test.tsx -``` +```
18-21: Add a language to fenced code blocks (tree snippet).-``` +```text tests/integration/ └── api.integration.test.ts -``` +```
26-28: Add a language to fenced code blocks (tree snippet).-``` +```text tests/e2e/ └── user-flows.e2e.test.ts -``` +```
43-44: Fix example path to match colocated tests structure.Docs show colocated unit tests under hooks/tests; command should reflect that.
-npx vitest run src/features/ui/hooks/useSmartPolling.test.ts +npx vitest run src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/tests/setup.ts (1)
38-59: Return stub React components instead of strings for lucide-react icons.Returning strings can break code relying on SVG/element props. Use no-op components that accept props; keeps snapshots stable and avoids prop/type issues.
-// Mock lucide-react icons - simple implementation -vi.mock('lucide-react', () => ({ - Trash2: () => 'Trash2', - X: () => 'X', - AlertCircle: () => 'AlertCircle', - Loader2: () => 'Loader2', - BookOpen: () => 'BookOpen', - Settings: () => 'Settings', - WifiOff: () => 'WifiOff', - ChevronDown: () => 'ChevronDown', - ChevronRight: () => 'ChevronRight', - Plus: () => 'Plus', - Search: () => 'Search', - Activity: () => 'Activity', - CheckCircle2: () => 'CheckCircle2', - ListTodo: () => 'ListTodo', - MoreHorizontal: () => 'MoreHorizontal', - Pin: () => 'Pin', - PinOff: () => 'PinOff', - Clipboard: () => 'Clipboard', - // Add more icons as needed -})) +// Mock lucide-react icons - stub components that accept props +vi.mock('lucide-react', () => { + const stub = (_name: string) => (_props: any) => null + return { + Trash2: stub('Trash2'), + X: stub('X'), + AlertCircle: stub('AlertCircle'), + Loader2: stub('Loader2'), + BookOpen: stub('BookOpen'), + Settings: stub('Settings'), + WifiOff: stub('WifiOff'), + ChevronDown: stub('ChevronDown'), + ChevronRight: stub('ChevronRight'), + Plus: stub('Plus'), + Search: stub('Search'), + Activity: stub('Activity'), + CheckCircle2: stub('CheckCircle2'), + ListTodo: stub('ListTodo'), + MoreHorizontal: stub('MoreHorizontal'), + Pin: stub('Pin'), + PinOff: stub('PinOff'), + Clipboard: stub('Clipboard'), + } +})If new icons are imported later, this static list will 404. Want a safe fallback (non-Proxy) that returns a stub for unknown names?
archon-ui-main/src/components/layout/types.ts (3)
17-21: Prefer avoiding placeholder comments in public types.Small tidy: remove “Add other settings as needed” to keep types clean; consumers can extend in-place if needed.
export interface AppSettings { projectsEnabled: boolean; theme?: "light" | "dark" | "system"; - // Add other settings as needed }
23-26: Consider using undefined instead of null for optional reason.Using null forces consumers to check three states; an optional property keeps it simpler.
-export interface OnboardingCheckResult { - shouldShowOnboarding: boolean; - reason: "dismissed" | "missing_rag" | "missing_api_key" | null; -} +export interface OnboardingCheckResult { + shouldShowOnboarding: boolean; + reason?: "dismissed" | "missing_rag" | "missing_api_key"; +}Only proceed if callers don’t rely on null specifically.
1-26: Location: new layout code under src/components conflicts with “legacy-only” rule.Guidelines state only legacy lives in src/components; new UI should be under src/features (e.g., src/features/ui/layout). Consider relocating types and related layout components/hooks to a feature slice.
If these are app-shell primitives, a top-level src/features/layout (components/hooks/types) would align with the vertical-slice convention and Biome scope.
archon-ui-main/src/components/layout/index.ts (2)
1-3: Barrel looks good; consider re-exporting types for convenience.Optional: expose types alongside components to stabilize import paths.
export { useBackendHealth } from "./hooks/useBackendHealth"; export { MainLayout, MinimalLayout } from "./MainLayout"; export { Navigation } from "./Navigation"; +export type * from "./types";
1-3: Confirm placement under src/components vs features.Matches the new layout system, but per repo rules new UI should be under src/features. If this is not legacy, consider moving.
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (2)
45-56: Simplify retry logicThe custom function equals retry: 5; use the built-in numeric form for clarity.
- // Retry configuration for startup scenarios - retry: (failureCount) => { - // Keep retrying during startup, up to 5 times - if (failureCount < 5) { - return true; - } - return false; - }, + // Retry configuration for startup scenarios + retry: 5,
57-63: Adaptive polling interval (faster while not ready)Poll more aggressively until the backend reports ready; otherwise keep 30s. Aligns with visibility-aware polling guidance.
- // Refetch every 30 seconds when healthy - refetchInterval: 30000, + // Faster while starting, slower when healthy + refetchInterval: (data) => (data?.ready ? 30000 : 5000), // Keep trying to connect on window focus refetchOnWindowFocus: true, // Consider data fresh for 20 seconds staleTime: 20000,archon-ui-main/src/components/layout/Navigation.tsx (4)
4-6: Remove “TEMPORARY” phrasing in commentsProject guidelines discourage timeline qualifiers. Rephrase to state current behavior.
-// TEMPORARY: Use old SettingsContext until settings are migrated +// Uses SettingsContext until settings are migrated
10-15: Use shared NavigationItem type (avoid duplication)If NavigationItem exists in layout/types.ts, import and remove the local interface.
-import type React from "react"; +import type React from "react"; +import type { NavigationItem } from "./types"; - -interface NavigationItem { - path: string; - icon: React.ReactNode; - label: string; - enabled?: boolean; -}If the type does not exist yet, consider adding it to layout/types.ts for reuse.
; prefer a single nav with a list
126-176: Avoid nestedFor better a11y semantics, render items in a list inside the outer
.- {/* Navigation Items */} - <nav className="flex flex-col gap-4"> + {/* Navigation Items */} + <ul className="flex flex-col gap-4" role="list"> {navigationItems.map((item) => { - const isActive = location.pathname === item.path; + const isActive = + item.path === "/" + ? location.pathname === "/" + : location.pathname.startsWith(item.path); const isEnabled = item.enabled !== false; - return ( + return ( + <li> <Tooltip key={item.path}> <TooltipTrigger asChild> <Link to={isEnabled ? item.path : "#"} className={cn( @@ - !isEnabled && "opacity-50 cursor-not-allowed pointer-events-none", + !isEnabled && "opacity-50 cursor-not-allowed", )} + aria-disabled={!isEnabled} + aria-current={isActive ? "page" : undefined} + tabIndex={isEnabled ? 0 : -1} onClick={(e) => { if (!isEnabled) { e.preventDefault(); } }} > {item.icon} @@ </Link> </TooltipTrigger> <TooltipContent> <p>{item.label}</p> </TooltipContent> </Tooltip> + </li> ); })} - </nav> + </ul>
129-151: Active-state detection for nested routesStrict equality fails on subroutes (e.g., /settings/profile). Use startsWith (special-case “/”) as above, or consider react-router’s NavLink for built-in active semantics.
archon-ui-main/src/App.tsx (1)
112-121: Remove duplicate health polling
useBackendHealth in MainLayout and serverHealthService.startMonitoring in App.tsx each poll/api/healthevery 30 s. Remove theserverHealthService.startMonitoringeffect inarchon-ui-main/src/App.tsxand derive disconnect-screen state from the React Query cache provided byuseBackendHealth.archon-ui-main/src/pages/ProjectPage.tsx (2)
7-9: Avoid prop spreading into a component that takes no props.
ProjectsViewWithBoundarydoesn’t accept props; passing...propsundermines TypeScript strictness. Keep the page a pure delegate.-function ProjectPage(props: any) { - return <ProjectsViewWithBoundary {...props} />; +function ProjectPage() { + return <ProjectsViewWithBoundary />; }
5-5: Refresh the comment to reflect the new delegation.Minor doc tweak to avoid pointing to a specific file that may change.
-// Uses ProjectsViewWithBoundary for proper error handling +// Delegates to ProjectsViewWithBoundary for error handling; implementation lives under src/features/projects/viewsarchon-ui-main/src/features/testing/test-utils.tsx (2)
11-22: Type the helper’s options for stricter tests.Add types for
renderOptionsandqueryClientto uphold strict mode and improve DX.-import { render as rtlRender } from '@testing-library/react'; +import { render as rtlRender } from '@testing-library/react'; +import type { RenderOptions } from '@testing-library/react'; @@ -export function renderWithProviders( - ui: React.ReactElement, - { - queryClient = new QueryClient({ - defaultOptions: { - queries: { retry: false }, - mutations: { retry: false }, - }, - }), - ...renderOptions - } = {} -) { +export function renderWithProviders( + ui: React.ReactElement, + { + queryClient = new QueryClient({ + defaultOptions: { + queries: { retry: false }, + mutations: { retry: false }, + }, + }), + ...renderOptions + }: { queryClient?: QueryClient } & Omit<RenderOptions, "wrapper"> = {}, +) {
1-6: Run Biome to enforce feature style (double quotes, trailing commas).This file sits under /src/features; running Biome will normalize quotes and minor formatting.
archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.ts (2)
30-35: Prefer partial mocking to avoid masking other hooks.Mocking the entire
../../../ui/hooksmodule can hide future exports. Usevi.importActualand override onlyuseSmartPolling.vi.mock('../../../ui/hooks', async () => { const actual = await vi.importActual<any>('../../../ui/hooks'); return { ...actual, useSmartPolling: () => ({ refetchInterval: 5000, isPaused: false }), }; });
37-48: Deduplicate wrapper creation via shared TestProviders.Consider exporting a
TestProviderswrapper fromfeatures/testing/test-utilsand reusing it here to keep providers in sync across tests.If you want, I can add
TestProvidersto test-utils and update this spec.archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsx (4)
76-81: Use userEvent for interaction.
userEventbetter reflects real user input thanfireEvent.-import { render, screen, fireEvent } from '../../../testing/test-utils'; +import { render, screen } from '../../../testing/test-utils'; +import userEvent from '@testing-library/user-event'; @@ - fireEvent.click(card); + await userEvent.click(card);
58-64: Be explicit about expected counts.The comment admits ambiguity; assert the exact “doing” count or remove the mention to avoid brittle expectations.
93-97: Avoid asserting on Tailwind class names.Class name assertions are brittle. Prefer role/aria-state, data attributes (e.g.,
data-selected,data-pinned), or visual token presence.Also applies to: 111-115
127-130: Animation class assertions are fragile.Consider toggling a
data-testid="aurora"(or similar) in the component and assert presence/absence instead.Also applies to: 142-145
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts (2)
6-20: Stabilize hasFocus mocking; avoid leaking overrides across testsUse a spy and restore it in
afterEach. Also,vi.clearAllTimers()isn’t needed here.describe('useSmartPolling', () => { + let hasFocusSpy: ReturnType<typeof vi.spyOn> | undefined; beforeEach(() => { // Reset document visibility state Object.defineProperty(document, 'visibilityState', { value: 'visible', writable: true, configurable: true, }); Object.defineProperty(document, 'hidden', { value: false, writable: true, configurable: true, }); - // Mock document.hasFocus - document.hasFocus = vi.fn(() => true); + // Mock document.hasFocus + hasFocusSpy = vi.spyOn(document, 'hasFocus').mockReturnValue(true); }); afterEach(() => { - vi.clearAllTimers(); vi.clearAllMocks(); + hasFocusSpy?.mockRestore(); });Also applies to: 22-25
1-3: Style nits: prefer double quotes (Biome) in features testsTests under src/features follow Biome (double quotes, trailing commas). Consider running the Biome fixer on this file.
archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts (3)
25-31: Mock shape of useSmartPolling may drift from real hookReal
useSmartPollingreturns{ refetchInterval, isActive, isVisible, hasFocus }; this mock returns{ refetchInterval, isPaused }. IfuseTaskQueriesreadsisActive, tests could pass erroneously. Align the mock with the real shape.vi.mock('../../../../ui/hooks', () => ({ useSmartPolling: () => ({ - refetchInterval: 5000, - isPaused: false, + refetchInterval: 5000, + isActive: true, + isVisible: true, + hasFocus: true, }), }));
109-147: Test the optimistic cache update and rollback behavior explicitlyCurrent tests assert API calls/success, but not the cache mutation/rollback. Add an assertion against the query cache for
taskKeys.all(projectId).describe('useCreateTask', () => { + it('should optimistically update the cache and rollback on error', async () => { + const projectId = 'project-123'; + const { taskService } = await import('../../services'); + vi.mocked(taskService.createTask).mockRejectedValue(new Error('boom')); + + // Harness that exposes the client for cache assertions + const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false }, mutations: { retry: false } } }); + const wrapper = ({ children }: { children: React.ReactNode }) => + React.createElement(QueryClientProvider, { client: queryClient }, children); + + // Seed initial list + queryClient.setQueryData(taskKeys.all(projectId), []); + + const { result } = renderHook(() => useCreateTask(), { wrapper }); + await expect(result.current.mutateAsync({ project_id: projectId, title: 'Temp' })) + .rejects.toThrow('boom'); + + // Ensure rollback restored the list to its initial state + expect(queryClient.getQueryData(taskKeys.all(projectId))).toEqual([]); + });
1-6: Style nits: prefer double quotes (Biome) in features testsRun Biome to convert single → double quotes and ensure trailing commas.
archon-ui-main/src/components/layout/MainLayout.tsx (4)
124-129: Prevent duplicate backend error toastsEffect can fire multiple times on retries/refetches. Gate with a ref to show once per mount.
-import { useEffect } from "react"; +import { useEffect, useRef } from "react"; ... export function MainLayout({ children, className }: MainLayoutProps) { const navigate = useNavigate(); const location = useLocation(); const { showToast } = useToast(); + const hasShownBackendToastRef = useRef(false); ... useEffect(() => { - if (isBackendError && backendError) { + if (isBackendError && backendError && !hasShownBackendToastRef.current) { const errorMessage = backendError instanceof Error ? backendError.message : "Backend connection failed"; showToast(`Backend unavailable: ${errorMessage}. Some features may not work.`, "error"); + hasShownBackendToastRef.current = true; } }, [isBackendError, backendError, showToast]);Also applies to: 3-3, 68-68
30-55: Minor a11y: mark BackendStatus as a status regionAdd
role="status"andaria-live="polite"to the status containers so screen readers announce it.- <div className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-yellow-50 dark:bg-yellow-950/30 text-yellow-700 dark:text-yellow-400 text-sm"> + <div role="status" aria-live="polite" className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-yellow-50 dark:bg-yellow-950/30 text-yellow-700 dark:text-yellow-400 text-sm"> ... - <div className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-400 text-sm"> + <div role="status" aria-live="polite" className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-red-50 dark:bg-red-950/30 text-red-700 dark:text-red-400 text-sm"> ... - <div className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-yellow-50 dark:bg-yellow-950/30 text-yellow-700 dark:text-yellow-400 text-sm"> + <div role="status" aria-live="polite" className="flex items-center gap-2 px-3 py-1.5 rounded-lg bg-yellow-50 dark:bg-yellow-950/30 text-yellow-700 dark:text-yellow-400 text-sm">
152-168: Consider Radix Tooltip for the “Coming Soon” buttonFor consistency with the migration, replace the custom tooltip with Radix Tooltip. Keeps behavior consistent and reduces bespoke CSS.
81-121: Onboarding check scope looks good; keep it cheapYou already guard on
healthData?.readyand failed startup. If credentials calls are heavy, consider memoizing dismissal flag and early-returning whenonboardingDismissedis true to skip async work sooner.useEffect(() => { const checkOnboarding = async () => { // Skip if backend failed to start if (backendStartupFailed) { return; } - // Skip if not ready, already on onboarding, or already dismissed - if (!healthData?.ready || location.pathname === "/onboarding") { + // Skip if not ready or already on onboarding + if (!healthData?.ready || location.pathname === "/onboarding") { return; } // Check if onboarding was already dismissed - if (localStorage.getItem("onboardingDismissed") === "true") { + if (localStorage.getItem("onboardingDismissed") === "true") { return; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (47)
archon-ui-main/.dockerignore(1 hunks)archon-ui-main/__mocks__/lucide-react.tsx(0 hunks)archon-ui-main/biome.json(1 hunks)archon-ui-main/src/App.tsx(1 hunks)archon-ui-main/src/components/layout/MainLayout.tsx(1 hunks)archon-ui-main/src/components/layout/Navigation.tsx(1 hunks)archon-ui-main/src/components/layout/hooks/useBackendHealth.ts(1 hunks)archon-ui-main/src/components/layout/index.ts(1 hunks)archon-ui-main/src/components/layout/types.ts(1 hunks)archon-ui-main/src/components/layouts/MainLayout.tsx(0 hunks)archon-ui-main/src/components/layouts/SideNavigation.tsx(0 hunks)archon-ui-main/src/components/mcp/ClientCard.tsx(0 hunks)archon-ui-main/src/components/mcp/MCPClients.tsx(0 hunks)archon-ui-main/src/components/mcp/ToolTestingPanel.tsx(0 hunks)archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsx(1 hunks)archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.ts(1 hunks)archon-ui-main/src/features/projects/index.ts(1 hunks)archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts(1 hunks)archon-ui-main/src/features/testing/test-utils.tsx(1 hunks)archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts(1 hunks)archon-ui-main/src/pages/MCPPage.tsx(0 hunks)archon-ui-main/src/pages/ProjectPage.tsx(1 hunks)archon-ui-main/src/services/mcpClientService.ts(0 hunks)archon-ui-main/src/services/mcpServerService.ts(3 hunks)archon-ui-main/src/services/mcpService.ts(0 hunks)archon-ui-main/test/components.test.tsx(0 hunks)archon-ui-main/test/components/common/DeleteConfirmModal.test.tsx(0 hunks)archon-ui-main/test/components/project-tasks/DocsTab.integration.test.tsx(0 hunks)archon-ui-main/test/components/project-tasks/DocumentCard.test.tsx(0 hunks)archon-ui-main/test/components/project-tasks/MilkdownEditor.test.tsx(0 hunks)archon-ui-main/test/components/project-tasks/TasksTab.dragdrop.test.tsx(0 hunks)archon-ui-main/test/components/prp/PRPViewer.test.tsx(0 hunks)archon-ui-main/test/config/api.test.ts(0 hunks)archon-ui-main/test/errors.test.tsx(0 hunks)archon-ui-main/test/hooks/usePolling.test.ts(0 hunks)archon-ui-main/test/pages.test.tsx(0 hunks)archon-ui-main/test/pages/ProjectPage.performance.test.tsx(0 hunks)archon-ui-main/test/pages/ProjectPage.polling.test.tsx(0 hunks)archon-ui-main/test/services/projectService.test.ts(0 hunks)archon-ui-main/test/user_flows.test.tsx(0 hunks)archon-ui-main/test/utils/taskOrdering.test.ts(0 hunks)archon-ui-main/tests/README.md(1 hunks)archon-ui-main/tests/setup.ts(1 hunks)archon-ui-main/tsconfig.json(1 hunks)archon-ui-main/tsconfig.prod.json(1 hunks)archon-ui-main/vite.config.ts(1 hunks)archon-ui-main/vitest.config.ts(2 hunks)
💤 Files with no reviewable changes (25)
- archon-ui-main/test/components.test.tsx
- archon-ui-main/test/pages.test.tsx
- archon-ui-main/test/components/prp/PRPViewer.test.tsx
- archon-ui-main/test/components/common/DeleteConfirmModal.test.tsx
- archon-ui-main/test/hooks/usePolling.test.ts
- archon-ui-main/test/components/project-tasks/DocumentCard.test.tsx
- archon-ui-main/test/services/projectService.test.ts
- archon-ui-main/test/components/project-tasks/TasksTab.dragdrop.test.tsx
- archon-ui-main/src/pages/MCPPage.tsx
- archon-ui-main/test/components/project-tasks/DocsTab.integration.test.tsx
- archon-ui-main/test/user_flows.test.tsx
- archon-ui-main/src/components/mcp/ClientCard.tsx
- archon-ui-main/test/pages/ProjectPage.performance.test.tsx
- archon-ui-main/src/components/layouts/SideNavigation.tsx
- archon-ui-main/src/components/layouts/MainLayout.tsx
- archon-ui-main/src/components/mcp/ToolTestingPanel.tsx
- archon-ui-main/src/services/mcpService.ts
- archon-ui-main/test/pages/ProjectPage.polling.test.tsx
- archon-ui-main/src/services/mcpClientService.ts
- archon-ui-main/test/errors.test.tsx
- archon-ui-main/test/utils/taskOrdering.test.ts
- archon-ui-main/test/config/api.test.ts
- archon-ui-main/test/components/project-tasks/MilkdownEditor.test.tsx
- archon-ui-main/src/components/mcp/MCPClients.tsx
- archon-ui-main/mocks/lucide-react.tsx
🧰 Additional context used
📓 Path-based instructions (10)
archon-ui-main/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/**/*.{ts,tsx}: Use TanStack Query for all data fetching; avoid prop drilling for server data
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selection
Service method naming conventions: get[Resource]sByProject, get[Resource], create[Resource], update[Resource], delete[Resource]
Task status values must be the canonical DB strings: 'todo', 'doing', 'review', 'done' (no UI mapping)
Enable and honor TypeScript strict mode (no implicit any)
archon-ui-main/src/**/*.{ts,tsx}: Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selections
Do not introduce Socket.IO; polling is the update mechanism
Files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/src/components/layout/Navigation.tsxarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/services/mcpServerService.tsarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsxarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce WebSocket-based updates; architecture mandates HTTP polling with ETag caching
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}: Never return None/null to signal failure; raise an exception (or reject) with details
Do not annotate comments with LEGACY, CHANGED, or REMOVED; write comments that document current functionality only
Files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/src/components/layout/Navigation.tsxarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/services/mcpServerService.tsarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsxarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
archon-ui-main/src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Legacy components should be composed within pages under src/pages
Files:
archon-ui-main/src/pages/ProjectPage.tsx
archon-ui-main/src/features/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/features/**/*.{ts,tsx}: Follow query key factory pattern for TanStack Query (all/lists/detail etc.)
Use useSmartPolling for visibility-aware polling; target 1–2s for active, 5–10s for background data
Implement optimistic updates with rollback in mutations (cancel, snapshot, set, restore)
Place feature code by vertical slice: components/, hooks/, services/, types/ within src/features/[feature]/
Frontend styling should follow Tron-inspired glassmorphism with Tailwind classes
Use Biome style in features: 120-character lines, double quotes, trailing commas
Use Vite proxy and HTTP polling (no WebSockets) for updates in the UI
Add new feature components under src/features/[feature]/components, types under types, services under services, hooks under hooks
Use dedicated polling hooks: useSmartPolling, useCrawlProgressPolling, and useProjectTasks for periodic updates
archon-ui-main/src/features/**/*.{ts,tsx}: Use provided hooks for polling and mutations: usePolling, useDatabaseMutation, useProjectMutation
New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
Use TanStack Query for all data fetching in features
Avoid prop drilling; use TanStack Query and context/providers
Use Radix UI (@radix-ui/react-*) for primitives in features; custom components remain in legacy components folder
Prefer Framer Motion sparingly; animations should be minimal
Files:
archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/features/testing/test-utils.tsx
archon-ui-main/src/features/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Tron-inspired glassmorphism styling with Tailwind CSS to features components
Files:
archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/features/testing/test-utils.tsx
archon-ui-main/src/features/**/*.{ts,tsx,js,jsx,css,json}
📄 CodeRabbit inference engine (AGENTS.md)
Run Biome and address diagnostics only within /src/features (biome:ai, biome:ai-fix workflow)
Files:
archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/features/testing/test-utils.tsx
archon-ui-main/biome.json
📄 CodeRabbit inference engine (AGENTS.md)
Biome configuration governs formatting (2 spaces, 80 columns), linting (recommended), and import organization
Files:
archon-ui-main/biome.json
archon-ui-main/src/components/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Legacy UI lives under src/components; continue using ESLint React rules there (not Biome)
Only add legacy components under src/components (not features)
Files:
archon-ui-main/src/components/layout/index.tsarchon-ui-main/src/components/layout/Navigation.tsxarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
archon-ui-main/src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
archon-ui-main/src/services/**/*.ts: Frontend service method naming: get[Resource]sByProject(projectId), getResource, createResource, update[Resource](id, updates), deleteResource
Update corresponding frontend service modules when backend endpoints change
Use Vite proxy for API calls in development; ensure service URLs align with proxy config
Files:
archon-ui-main/src/services/mcpServerService.ts
archon-ui-main/src/features/projects/tasks/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Place task-related frontend code under features/projects/tasks as a sub-feature
Files:
archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts
🧠 Learnings (33)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/pages/**/*.{ts,tsx} : Legacy components should be composed within pages under src/pages
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/MainLayout.tsx
📚 Learning: 2025-08-28T12:56:47.840Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/pages/ProjectPage.tsx:329-331
Timestamp: 2025-08-28T12:56:47.840Z
Learning: In the ProjectPage.tsx polling refactor, temporary project creation logic with progress cards was removed in favor of simpler modal loading states, as the complexity of managing in-flight temporary projects wasn't justified when HTTP polling would show new projects within seconds anyway.
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/projects/tasks/**/*.{ts,tsx} : Place task-related frontend code under features/projects/tasks as a sub-feature
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsxarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/components/**/*.{ts,tsx} : Only add legacy components under src/components (not features)
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/tsconfig.jsonarchon-ui-main/.dockerignorearchon-ui-main/vite.config.tsarchon-ui-main/tsconfig.prod.jsonarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/components/layout/MainLayout.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/tests/README.mdarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/tsconfig.jsonarchon-ui-main/src/components/layout/Navigation.tsxarchon-ui-main/vite.config.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/tsconfig.prod.jsonarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Radix UI (radix-ui/react-*) for primitives in features; custom components remain in legacy components folder
Applied to files:
archon-ui-main/src/pages/ProjectPage.tsxarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/tsconfig.jsonarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsx
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Add new feature components under src/features/[feature]/components, types under types, services under services, hooks under hooks
Applied to files:
archon-ui-main/tests/README.mdarchon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/index.tsarchon-ui-main/tsconfig.jsonarchon-ui-main/src/components/layout/Navigation.tsxarchon-ui-main/.dockerignorearchon-ui-main/vite.config.tsarchon-ui-main/src/features/projects/index.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/tsconfig.prod.jsonarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsxarchon-ui-main/vitest.config.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/components/**/*.{ts,tsx} : Legacy UI lives under src/components; continue using ESLint React rules there (not Biome)
Applied to files:
archon-ui-main/src/App.tsxarchon-ui-main/biome.jsonarchon-ui-main/tsconfig.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/ui/primitives/**/*.{ts,tsx} : Use Radix UI primitives from src/features/ui/primitives for base UI elements
Applied to files:
archon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/Navigation.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Avoid prop drilling; use TanStack Query and context/providers
Applied to files:
archon-ui-main/src/App.tsxarchon-ui-main/src/components/layout/MainLayout.tsxarchon-ui-main/src/features/testing/test-utils.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/services/**/*.ts : Update corresponding frontend service modules when backend endpoints change
Applied to files:
archon-ui-main/src/App.tsxarchon-ui-main/tsconfig.json
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Prefer Framer Motion sparingly; animations should be minimal
Applied to files:
archon-ui-main/src/App.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx,js,jsx,css,json} : Run Biome and address diagnostics only within /src/features (biome:ai, biome:ai-fix workflow)
Applied to files:
archon-ui-main/biome.jsonarchon-ui-main/tsconfig.jsonarchon-ui-main/.dockerignorearchon-ui-main/vite.config.tsarchon-ui-main/tsconfig.prod.jsonarchon-ui-main/vitest.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/biome.json : Biome configuration governs formatting (2 spaces, 80 columns), linting (recommended), and import organization
Applied to files:
archon-ui-main/biome.json
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Biome style in features: 120-character lines, double quotes, trailing commas
Applied to files:
archon-ui-main/biome.jsonarchon-ui-main/tsconfig.json
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Enable and honor TypeScript strict mode (no implicit any)
Applied to files:
archon-ui-main/tsconfig.jsonarchon-ui-main/vite.config.tsarchon-ui-main/tsconfig.prod.jsonarchon-ui-main/src/components/layout/types.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Do not introduce Socket.IO; polling is the update mechanism
Applied to files:
archon-ui-main/tsconfig.jsonarchon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use useSmartPolling for visibility-aware polling; target 1–2s for active, 5–10s for background data
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use dedicated polling hooks: useSmartPolling, useCrawlProgressPolling, and useProjectTasks for periodic updates
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use provided hooks for polling and mutations: usePolling, useDatabaseMutation, useProjectMutation
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/features/testing/test-utils.tsxarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Vite proxy and HTTP polling (no WebSockets) for updates in the UI
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/vite.config.tsarchon-ui-main/tests/setup.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-08-28T13:07:24.810Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.810Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.tsarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-08-28T13:50:10.499Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/pollingService.ts:38-45
Timestamp: 2025-08-28T13:50:10.499Z
Learning: The pollingService.ts file is being deprecated in favor of the usePolling hook from usePolling.ts. The team has decided to consolidate on the usePolling hook pattern rather than maintaining separate polling services, as it provides better React integration and reduces code duplication.
Applied to files:
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Place feature code by vertical slice: components/, hooks/, services/, types/ within src/features/[feature]/
Applied to files:
archon-ui-main/.dockerignorearchon-ui-main/vite.config.tsarchon-ui-main/src/components/layout/types.tsarchon-ui-main/src/components/layout/MainLayout.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/services/**/*.ts : Use Vite proxy for API calls in development; ensure service URLs align with proxy config
Applied to files:
archon-ui-main/vite.config.ts
📚 Learning: 2025-09-04T16:30:05.187Z
Learnt from: stevepresley
PR: coleam00/Archon#573
File: archon-ui-main/src/config/api.ts:15-25
Timestamp: 2025-09-04T16:30:05.187Z
Learning: Archon UI API config: Prefer lazy getters getApiFullUrl() and getWsUrl() over module-load constants to avoid SSR/test crashes. Avoid CommonJS exports patterns (Object.defineProperty(exports,…)) in ESM. Add typeof window guards with VITE_API_URL fallback inside getApiUrl()/getWebSocketUrl() when SSR safety is required.
Applied to files:
archon-ui-main/vite.config.tsarchon-ui-main/tests/setup.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Follow query key factory pattern for TanStack Query (all/lists/detail etc.)
Applied to files:
archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.tsarchon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Implement optimistic updates with rollback in mutations (cancel, snapshot, set, restore)
Applied to files:
archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Applied to files:
archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.tsarchon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Frontend styling should follow Tron-inspired glassmorphism with Tailwind classes
Applied to files:
archon-ui-main/src/components/layout/MainLayout.tsx
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx,css} : Apply Tron-inspired glassmorphism styling with Tailwind CSS to features components
Applied to files:
archon-ui-main/src/components/layout/MainLayout.tsx
🧬 Code graph analysis (3)
archon-ui-main/src/pages/ProjectPage.tsx (1)
archon-ui-main/src/features/projects/views/ProjectsViewWithBoundary.tsx (1)
ProjectsViewWithBoundary(5-15)
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts (1)
archon-ui-main/src/features/ui/hooks/useSmartPolling.ts (1)
useSmartPolling(8-66)
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (3)
archon-ui-main/src/components/layout/types.ts (1)
HealthResponse(8-15)archon-ui-main/src/components/layout/index.ts (1)
useBackendHealth(1-1)archon-ui-main/src/config/api.ts (1)
getApiUrl(9-31)
🪛 LanguageTool
archon-ui-main/tests/README.md
[grammar] ~7-~7: There might be a mistake here.
Context: ...ng strategy: ### Unit Tests (Colocated) Unit tests live next to the code they te...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...Card.test.tsx ``` ### Integration Tests Tests that cross multiple features/syste...
(QB_NEW_EN)
[grammar] ~23-~23: There might be a mistake here.
Context: ...i.integration.test.ts ### E2E Tests Full user flow tests: tests/e2e/ └──...
(QB_NEW_EN)
[grammar] ~48-~48: There might be a mistake here.
Context: ...it tests**: ComponentName.test.tsx or hookName.test.ts - Integration tests: `feature.integratio...
(QB_NEW_EN)
[grammar] ~49-~49: There might be a mistake here.
Context: ...kName.test.ts- **Integration tests**:feature.integration.test.ts- **E2E tests**:flow-name.e2e.test.ts` ##...
(QB_NEW_EN)
[grammar] ~54-~54: There might be a mistake here.
Context: ...test setup is in tests/setup.ts which: - Sets environment variables - Mocks fetch...
(QB_NEW_EN)
[grammar] ~55-~55: There might be a mistake here.
Context: ....ts` which: - Sets environment variables - Mocks fetch and localStorage - Mocks DOM...
(QB_NEW_EN)
[grammar] ~56-~56: There might be a mistake here.
Context: ...variables - Mocks fetch and localStorage - Mocks DOM APIs - Mocks external librarie...
(QB_NEW_EN)
[grammar] ~57-~57: There might be a mistake here.
Context: ... fetch and localStorage - Mocks DOM APIs - Mocks external libraries (lucide-react)
(QB_NEW_EN)
🪛 markdownlint-cli2 (0.17.2)
archon-ui-main/tests/README.md
9-9: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
18-18: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
25-25: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (17)
archon-ui-main/src/services/mcpServerService.ts (1)
195-196: Un-deprecategetAvailableToolsand keep onlygetMCPToolsdeprecated
Remove the@deprecatedJSDoc from thegetAvailableTools()method so that thegetMCPTools()wrapper’s deprecation warning correctly points to a non-deprecated API.archon-ui-main/tsconfig.json (1)
26-26: Include "tests" looks good; aligns with test reorg.
No issues spotted with compiler options; alias matches Vite config.archon-ui-main/vite.config.ts (1)
324-329: Test setup path and globs update: LGTM.
Moving setupFiles to ./tests/setup.ts and broadening include patterns matches the test relocation strategy.archon-ui-main/.dockerignore (1)
46-55: .dockerignore: tsconfig.prod.json isn’t referenced by the Dockerfile or any build scripts (no COPY or tsc –p tsconfig.prod.json in Dockerfile, and vite/npm scripts don’t use it), so it’s safe to exclude it.archon-ui-main/vitest.config.ts (2)
11-16: Setup path and include globs update: LGTM.
Matches the new tests/ location and colocated tests under src/.
40-41: Coverage excludes: correct 'tests/' path.
Nice catch updating from 'test/' to 'tests/'. Ensure Vite config coverage excludes are updated too (see vite.config.ts Lines 341–352).archon-ui-main/src/pages/ProjectPage.tsx (1)
1-1: Good swap to boundary-wrapped view.Importing from the feature index and using the error boundary aligns with the migration goals.
archon-ui-main/src/features/projects/index.ts (1)
22-22: Export looks good.Re-exporting
ProjectsViewWithBoundaryfrom the feature index keeps page imports clean.archon-ui-main/src/features/projects/hooks/tests/useProjectQueries.test.ts (5)
55-63: Query key assertions look correct.Keys follow the factory pattern and expected structure.
66-95: Solid happy-path fetch test.Good use of
waitForand single invocation assertion.
97-146: Create mutation tests cover optimistic + rollback.Covers both success and error branches clearly.
149-177: Update mutation test is precise.Asserts payload shape and success state.
180-207: Delete mutation tests are appropriate.Covers optimistic success and rollback on error.
archon-ui-main/src/features/projects/components/tests/ProjectCard.test.tsx (1)
35-46: Rendering/title test looks good.Simple presence check is sufficient here.
archon-ui-main/src/features/ui/hooks/tests/useSmartPolling.test.ts (1)
89-105: Confirm 60s background polling aligns with team targetsGuidelines note 5–10s for background polling; the hook (and this test) enforce 60s. If 60s is now the intended default, ignore; otherwise adjust hook/test.
archon-ui-main/src/features/projects/tasks/hooks/tests/useTaskQueries.test.ts (2)
33-44: Nice: deterministic QueryClient per test with retries offGood isolation; avoids flakiness on network-error simulations.
51-55: Query key factory check is spot onValidates the canonical key shape early; helps keep invalidations working.
| import { MCPPage } from './pages/MCPPage'; | ||
| import { OnboardingPage } from './pages/OnboardingPage'; | ||
| import { MainLayout } from './components/layouts/MainLayout'; | ||
| import { MainLayout } from './components/layout/MainLayout'; |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Import path update looks correct; verify no remaining references to old layouts path
Ensure there are no lingering imports from ./components/layouts/MainLayout or SideNavigation.
🏁 Script executed:
#!/bin/bash
# Find any remaining references to old layout paths
rg -nP -C2 $'/components/layouts/(MainLayout|SideNavigation)\\.(tsx|ts)'Length of output: 72
🏁 Script executed:
#!/bin/bash
# Search entire repo for any references to the old 'components/layouts' path
rg -n "components/layouts" -C2 .
# Check if the 'components/layouts' directory still exists
fd --type d 'components/layouts'Length of output: 313
🏁 Script executed:
#!/bin/bash
# Locate the ArchonChatPanel component file to confirm its new path
rg -n "ArchonChatPanel" -C2 src/components
fd --type f --extension tsx ArchonChatPanelLength of output: 204
🏁 Script executed:
#!/bin/bash
# Search for any lingering SideNavigation imports or references
rg -n "SideNavigation" -C2 .Length of output: 743
Update MDX docs to reference new layout and agent-chat paths
- docs/docs/agent-chat.mdx (line 48): change
import { ArchonChatPanel } from '@/components/layouts/ArchonChatPanel'
→
import { ArchonChatPanel } from '@/components/agent-chat/ArchonChatPanel' - docs/docs/ui-components.mdx (line 92): update
<SideNavigation />import to
@/components/layout/SideNavigation - docs/docs/ui.mdx (line 25): in the component tree, replace
components/layoutswithcomponents/layoutfor both MainLayout and SideNavigation
🤖 Prompt for AI Agents
In archon-ui-main/src/App.tsx around line 9 and the docs mentioned
(docs/docs/agent-chat.mdx line 48, docs/docs/ui-components.mdx line 92,
docs/docs/ui.mdx line 25), update MDX import paths and component-tree references
to match the new folder structure: change the agent-chat import to
"@/components/agent-chat/ArchonChatPanel", update the SideNavigation import to
"@/components/layout/SideNavigation", and replace any occurrences of
"components/layouts" with "components/layout" for MainLayout and SideNavigation
in the component tree; ensure path casing and aliases match the project’s
tsconfig/webpack aliases.
| export function useBackendHealth() { | ||
| return useQuery<HealthResponse>({ | ||
| queryKey: ["backend", "health"], | ||
| queryFn: async () => { | ||
| const controller = new AbortController(); | ||
| const timeoutId = setTimeout(() => controller.abort(), 5000); | ||
|
|
||
| try { | ||
| const response = await fetch(`${getApiUrl()}/api/health`, { | ||
| method: "GET", | ||
| signal: controller.signal, | ||
| }); | ||
|
|
||
| clearTimeout(timeoutId); | ||
|
|
||
| if (!response.ok) { | ||
| throw new Error(`Health check failed: ${response.status}`); | ||
| } | ||
|
|
||
| return response.json(); | ||
| } catch (error) { | ||
| clearTimeout(timeoutId); | ||
| if (error instanceof Error && error.name === "AbortError") { | ||
| throw new Error("Health check timeout (5s)"); | ||
| } | ||
| throw error; | ||
| } | ||
| }, |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Honor React Query cancellations and add ETag/304 handling
Per repo guidance, polling should leverage HTTP ETag caching. Also, use React Query’s provided abort signal, and consolidate timeout cleanup in finally.
-export function useBackendHealth() {
- return useQuery<HealthResponse>({
+export function useBackendHealth() {
+ const queryClient = useQueryClient();
+ return useQuery<HealthResponse>({
queryKey: ["backend", "health"],
- queryFn: async () => {
- const controller = new AbortController();
- const timeoutId = setTimeout(() => controller.abort(), 5000);
-
- try {
- const response = await fetch(`${getApiUrl()}/api/health`, {
- method: "GET",
- signal: controller.signal,
- });
-
- clearTimeout(timeoutId);
-
- if (!response.ok) {
- throw new Error(`Health check failed: ${response.status}`);
- }
-
- return response.json();
- } catch (error) {
- clearTimeout(timeoutId);
- if (error instanceof Error && error.name === "AbortError") {
- throw new Error("Health check timeout (5s)");
- }
- throw error;
- }
- },
+ queryFn: async ({ signal }) => {
+ const controller = new AbortController();
+ const onAbort = () => controller.abort();
+ signal?.addEventListener("abort", onAbort);
+ const timeoutId = setTimeout(() => controller.abort(), 5000);
+ try {
+ const response = await fetch(`${getApiUrl()}/api/health`, {
+ method: "GET",
+ signal: controller.signal,
+ cache: "no-store",
+ headers: {
+ Accept: "application/json",
+ ...(healthEtag ? { "If-None-Match": healthEtag } : {}),
+ },
+ });
+
+ if (response.status === 304) {
+ const cached = queryClient.getQueryData<HealthResponse>(["backend", "health"]);
+ if (cached) return cached;
+ throw new Error("Health 304 with no cached data");
+ }
+
+ if (!response.ok) {
+ throw new Error(`Health check failed: ${response.status} ${response.statusText}`);
+ }
+
+ healthEtag = response.headers.get("ETag") ?? undefined;
+ return (await response.json()) as HealthResponse;
+ } catch (error) {
+ if (error instanceof Error && error.name === "AbortError") {
+ throw new Error("Health check timeout (5s)");
+ }
+ throw error;
+ } finally {
+ clearTimeout(timeoutId);
+ signal?.removeEventListener("abort", onAbort);
+ }
+ },Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts lines 17-44:
update the queryFn to accept React Query’s provided context (async ({ signal })
=> ...) instead of creating a new AbortController so React Query cancellations
are honored; move the 5s timeout to use AbortSignal.timeout(5000) (or use a
single AbortController derived from the provided signal) and ensure timeout
cleanup is done in a single finally block; integrate ETag handling by reading a
stored ETag from cache (use useQueryClient() above the hook to get the previous
ETag stored with the previous response) and sending it in the If-None-Match
header, and if the fetch returns 304 return the cached data instead of throwing;
preserve existing error handling but throw a clear timeout error when the signal
is aborted due to timeout.
| export interface NavigationItem { | ||
| path: string; | ||
| icon: React.ReactNode; | ||
| label: string; | ||
| enabled?: boolean; | ||
| } |
There was a problem hiding this comment.
Import ReactNode type instead of using React namespace.
Using React.ReactNode without importing React types will fail under strict TS. Prefer a type-only import.
-export interface NavigationItem {
- path: string;
- icon: React.ReactNode;
- label: string;
- enabled?: boolean;
-}
+import type { ReactNode } from "react";
+
+export interface NavigationItem {
+ path: string;
+ icon: ReactNode;
+ label: string;
+ enabled?: boolean;
+}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export interface NavigationItem { | |
| path: string; | |
| icon: React.ReactNode; | |
| label: string; | |
| enabled?: boolean; | |
| } | |
| import type { ReactNode } from "react"; | |
| export interface NavigationItem { | |
| path: string; | |
| icon: ReactNode; | |
| label: string; | |
| enabled?: boolean; | |
| } |
🤖 Prompt for AI Agents
In archon-ui-main/src/components/layout/types.ts around lines 1 to 6, the type
uses React.ReactNode which will fail under strict TypeScript without importing
React types; change the declaration to import the ReactNode type via a type-only
import (e.g., add "import type { ReactNode } from 'react'") and update the
interface to use "icon: ReactNode" so the file uses the imported type instead of
the React namespace.
| * Legacy function - use mcpServerService.getAvailableTools() instead | ||
| * @deprecated Use mcpServerService.getAvailableTools() or mcpClientService instead | ||
| * @deprecated Use mcpServerService.getAvailableTools() instead | ||
| */ | ||
| export const getMCPTools = async () => { | ||
| console.warn('getMCPTools is deprecated. Use mcpServerService.getAvailableTools() or mcpClientService instead.'); | ||
| console.warn('getMCPTools is deprecated. Use mcpServerService.getAvailableTools() instead.'); | ||
| return mcpServerService.getAvailableTools(); |
There was a problem hiding this comment.
Align legacy wrapper docs/warning with the actual deprecation state
Current text says “use mcpServerService.getAvailableTools() instead,” but that method is annotated deprecated above. Align one of the following ways:
- Option A (if keeping
getAvailableToolsas the supported path): keep this wrapper deprecated and remove deprecation fromgetAvailableTools(see earlier diff).
/**
* Legacy function - use mcpServerService.getAvailableTools() instead
- * @deprecated Use mcpServerService.getAvailableTools() instead
+ * @deprecated Use mcpServerService.getAvailableTools() instead
*/
export const getMCPTools = async () => {
- console.warn('getMCPTools is deprecated. Use mcpServerService.getAvailableTools() instead.');
+ console.warn('[deprecated] getMCPTools(): use mcpServerService.getAvailableTools() instead.');
return mcpServerService.getAvailableTools();
};- Option B (if deprecating MCP tool discovery entirely): point callers to the new mechanism.
/**
- * Legacy function - use mcpServerService.getAvailableTools() instead
- * @deprecated Use mcpServerService.getAvailableTools() instead
+ * Legacy function - MCP tool discovery is deprecated
+ * @deprecated Use the new TanStack Query-backed feature services for tool discovery.
*/
export const getMCPTools = async () => {
- console.warn('getMCPTools is deprecated. Use mcpServerService.getAvailableTools() instead.');
- return mcpServerService.getAvailableTools();
+ console.warn('[deprecated] getMCPTools(): MCP tool discovery is deprecated. Use feature services with TanStack Query-backed HTTP APIs.');
+ throw new Error('getMCPTools() is deprecated. Use feature services with TanStack Query-backed HTTP APIs.');
};I can update the PR with Option A or B once you confirm the intended direction.
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In archon-ui-main/src/services/mcpServerService.ts around lines 231 to 236, the
wrapper getMCPTools logs and JSDoc point callers to
mcpServerService.getAvailableTools() but that method itself is marked
deprecated; choose one of two fixes: Option A - make getAvailableTools the
supported API by removing the @deprecated annotation and any deprecation
console/warning from getAvailableTools, keep getMCPTools as a thin deprecated
wrapper (update its JSDoc/console.warn to clearly say it is deprecated and
delegates to getAvailableTools); Option B - if tool discovery is being retired,
update getMCPTools’ JSDoc and console.warn to point callers to the new mechanism
(replace the getAvailableTools reference with the new API), and mark both
getMCPTools and getAvailableTools as deprecated (updating JSDoc and warnings
consistently). Implement the chosen option and ensure docs, console warnings,
and JSDoc annotations are consistent across both functions.
Update coverage exclusion from 'test/' to 'tests/' to match actual project structure and ensure proper test file exclusion from coverage. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Update import from deprecated layouts to agent-chat directory. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Use existing ETag infrastructure in useBackendHealth for 70% bandwidth reduction - Honor React Query cancellation signals with proper timeout handling - Remove duplicate HealthResponse interface, import from shared types - Add React type import to fix potential strict TypeScript issues 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
Removing **/*.d.ts exclusion to fix import.meta.env type errors in production builds. The exclusion was preventing src/env.d.ts from being included, breaking ImportMetaEnv interface definitions. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
archon-ui-main/vite.config.ts (1)
344-351: Spec files aren’t excluded from coverage.
coverage.excludeonly filters*.test.*; colocated*.spec.*undersrc/will inflate coverage.coverage: { provider: 'v8', reporter: ['text', 'json', 'html'], exclude: [ 'node_modules/', 'tests/', '**/*.d.ts', '**/*.config.*', '**/mockData.ts', - '**/*.test.{ts,tsx}', + '**/*.{test,spec}.{ts,tsx}', ], }
♻️ Duplicate comments (2)
archon-ui-main/tsconfig.prod.json (1)
3-14: Good exclude set; keeping .d.ts included fixes env typings.The prior concern about excluding declaration files is resolved—vite/env types will flow in prod.
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (1)
3-3: Good: using the shared HealthResponse typeThis addresses the prior duplication concern.
🧹 Nitpick comments (9)
archon-ui-main/tsconfig.prod.json (1)
3-14: Optional: exclude Storybook files from prod type-checks.If you use Storybook, consider excluding stories to keep prod checks lean.
Apply if relevant:
"exclude": [ "**/*.test.ts", "**/*.test.tsx", "**/*.spec.ts", "**/*.spec.tsx", + "**/*.stories.ts", + "**/*.stories.tsx", "**/__tests__/**", "**/tests/**", "src/features/testing/**", "test/**", "tests/**", "coverage/**" ]archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (5)
12-27: Clean up abort listener; prefer linked signalsYou add an abort listener but never remove it; minor leak across retries/re-renders. Also, you can link signals without a custom controller if AbortSignal.any/timeout is available.
Apply this minimal fix:
- queryFn: ({ signal }) => { - // Use existing ETag infrastructure with timeout - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), 5000); - - // Chain signals: React Query's signal + our timeout - if (signal) { - signal.addEventListener('abort', () => controller.abort()); - } + queryFn: ({ signal }) => { + const controller = new AbortController(); + const onAbort = () => controller.abort(); + const timeoutId = setTimeout(onAbort, 5000); + signal?.addEventListener("abort", onAbort); return callAPIWithETag<HealthResponse>("/api/health", { signal: controller.signal, }).finally(() => { clearTimeout(timeoutId); + signal?.removeEventListener("abort", onAbort); });Alternative (if supported by your TS/lib targets):
// const controller = AbortSignal.any([signal!, AbortSignal.timeout(5000)]); // return callAPIWithETag<HealthResponse>("/api/health", { signal: controller });
29-35: Scope retries to transient errors onlyAvoid retry storms on 4xx (auth, bad route). Limit to network/5xx/429.
- retry: (failureCount) => { - // Keep retrying during startup, up to 5 times - if (failureCount < 5) { - return true; - } - return false; - }, + retry: (failureCount, error: any) => { + const status = error?.status ?? error?.response?.status; + const transient = !status || status >= 500 || status === 429; + return transient && failureCount < 5; + },
41-45: Pause polling when tab is hiddenReduce background churn; React Query v5 doesn’t auto-respect visibility for intervals.
- refetchInterval: 30000, + refetchInterval: () => + typeof document !== "undefined" && document.visibilityState === "visible" + ? 30000 + : false,
5-8: Tone down quantified claim in commentUnless you have a stable benchmark, avoid “~70% savings” in code comments.
- * Uses ETag caching for bandwidth reduction (~70% savings per project docs) + * Uses ETag caching to reduce bandwidth
2-2: Avoid components → features dependency for shared HTTP utilImporting from features/... couples layout (components) to a feature. Consider relocating apiWithEtag to a shared infra/util module (e.g., src/shared/http/apiWithEtag) and update imports.
archon-ui-main/vite.config.ts (3)
326-329: Consolidate include globs to avoid drift.
Single brace-expanded glob is simpler and equivalent.- include: [ - 'src/**/*.{test,spec}.{ts,tsx}', // Tests colocated in features - 'tests/**/*.{test,spec}.{ts,tsx}' // Tests in tests directory - ], + include: ['{src,tests}/**/*.{test,spec}.{ts,tsx}'],
52-56: Avoid /api namespace collisions with the dev proxy.
Your custom SSE endpoints live under/api/*, which is also proxied to the backend. Depending on middleware order, requests may get forwarded instead of handled locally. Safer to move these to a dev-only prefix.- server.middlewares.use('/api/run-tests', (req: any, res: any) => { + server.middlewares.use('/__dev__/run-tests', (req: any, res: any) => { ... - server.middlewares.use('/api/run-tests-with-coverage', (req: any, res: any) => { + server.middlewares.use('/__dev__/run-tests-with-coverage', (req: any, res: any) => { ... - server.middlewares.use('/api/generate-coverage', (req: any, res: any) => { + server.middlewares.use('/__dev__/generate-coverage', (req: any, res: any) => {Confirm no calls in UI assume the old paths and that the proxy no longer logs attempts to forward these routes.
Also applies to: 123-128, 211-214, 293-309
89-96: ANSI-stripping regex is ineffective.
Using\\x1bin a regex literal matches a backslash, not ESC. Use\x1B.- const cleanLine = line.replace(/\\x1b\[[0-9;]*m/g, ''); + const cleanLine = line.replace(/\x1B\[[0-9;]*m/g, '');Apply in all three handlers (stderr of basic, stdout of coverage stream, stderr of coverage stream).
Also applies to: 163-169, 177-184
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (5)
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts(1 hunks)archon-ui-main/src/components/layout/types.ts(1 hunks)archon-ui-main/tsconfig.prod.json(1 hunks)archon-ui-main/vite.config.ts(2 hunks)docs/docs/agent-chat.mdx(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- docs/docs/agent-chat.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- archon-ui-main/src/components/layout/types.ts
🧰 Additional context used
📓 Path-based instructions (3)
archon-ui-main/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/**/*.{ts,tsx}: Use TanStack Query for all data fetching; avoid prop drilling for server data
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selection
Service method naming conventions: get[Resource]sByProject, get[Resource], create[Resource], update[Resource], delete[Resource]
Task status values must be the canonical DB strings: 'todo', 'doing', 'review', 'done' (no UI mapping)
Enable and honor TypeScript strict mode (no implicit any)
archon-ui-main/src/**/*.{ts,tsx}: Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selections
Do not introduce Socket.IO; polling is the update mechanism
Files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
archon-ui-main/src/components/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Legacy UI lives under src/components; continue using ESLint React rules there (not Biome)
Only add legacy components under src/components (not features)
Files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce WebSocket-based updates; architecture mandates HTTP polling with ETag caching
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}: Never return None/null to signal failure; raise an exception (or reject) with details
Do not annotate comments with LEGACY, CHANGED, or REMOVED; write comments that document current functionality only
Files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Add new feature components under src/features/[feature]/components, types under types, services under services, hooks under hooks
Applied to files:
archon-ui-main/tsconfig.prod.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/components/**/*.{ts,tsx} : Only add legacy components under src/components (not features)
Applied to files:
archon-ui-main/tsconfig.prod.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
Applied to files:
archon-ui-main/tsconfig.prod.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx,js,jsx,css,json} : Run Biome and address diagnostics only within /src/features (biome:ai, biome:ai-fix workflow)
Applied to files:
archon-ui-main/tsconfig.prod.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Enable and honor TypeScript strict mode (no implicit any)
Applied to files:
archon-ui-main/tsconfig.prod.json
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/services/**/*.ts : Use Vite proxy for API calls in development; ensure service URLs align with proxy config
Applied to files:
archon-ui-main/tsconfig.prod.jsonarchon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use provided hooks for polling and mutations: usePolling, useDatabaseMutation, useProjectMutation
Applied to files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
Applied to files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Applied to files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-08-28T13:07:24.810Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.810Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.
Applied to files:
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Vite proxy and HTTP polling (no WebSockets) for updates in the UI
Applied to files:
archon-ui-main/vite.config.ts
📚 Learning: 2025-09-04T16:30:05.187Z
Learnt from: stevepresley
PR: coleam00/Archon#573
File: archon-ui-main/src/config/api.ts:15-25
Timestamp: 2025-09-04T16:30:05.187Z
Learning: Archon UI API config: Prefer lazy getters getApiFullUrl() and getWsUrl() over module-load constants to avoid SSR/test crashes. Avoid CommonJS exports patterns (Object.defineProperty(exports,…)) in ESM. Add typeof window guards with VITE_API_URL fallback inside getApiUrl()/getWebSocketUrl() when SSR safety is required.
Applied to files:
archon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Place feature code by vertical slice: components/, hooks/, services/, types/ within src/features/[feature]/
Applied to files:
archon-ui-main/vite.config.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/projects/tasks/**/*.{ts,tsx} : Place task-related frontend code under features/projects/tasks as a sub-feature
Applied to files:
archon-ui-main/vite.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Results Summary
🔇 Additional comments (4)
archon-ui-main/tsconfig.prod.json (1)
1-2: Prod tsconfig extend looks correct.Extends base config; strictness/options should inherit as intended.
archon-ui-main/src/components/layout/hooks/useBackendHealth.ts (2)
10-46: Overall: solid React Query integration and polling configGood use of keying, timeouts, and periodic refetch consistent with the migration goals.
22-26: No changes needed: callAPIWithETag handles ETag caching and forwards AbortSignal
The implementation spreadsoptions(includingsignal) into thefetchcall and addsIf-None-Matchfor GET requests, then returns cached data on 304 responses.archon-ui-main/vite.config.ts (1)
335-335: Exclude config globs: LGTM.
Covers common tool configs; keeps discovery clean.
| { | ||
| "extends": "./tsconfig.json", | ||
| "exclude": [ | ||
| "**/*.test.ts", | ||
| "**/*.test.tsx", | ||
| "**/*.spec.ts", | ||
| "**/*.spec.tsx", | ||
| "**/__tests__/**", | ||
| "**/tests/**", | ||
| "src/features/testing/**", | ||
| "test/**", | ||
| "tests/**", | ||
| "coverage/**" | ||
| ] | ||
| } No newline at end of file |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify Docker/CI use of this config.
AI summary notes .dockerignore might ignore tsconfig.prod.json. Confirm your containerized build doesn’t need this file; otherwise remove it from .dockerignore or copy it explicitly.
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== .dockerignore lines mentioning tsconfig.prod.json (if any) =="
if [ -f archon-ui-main/.dockerignore ]; then
rg -n 'tsconfig\.prod\.json' -n archon-ui-main/.dockerignore || echo "No matches"
else
echo "No .dockerignore found at archon-ui-main/.dockerignore"
fi
echo "== Files referencing tsconfig.prod.json (e.g., build scripts) =="
rg -nP 'tsconfig\.prod\.json' -C2 || true
echo "== Sanity: ensure env declarations exist and are NOT excluded =="
fd -a -t f -e d.ts | rg -n 'env\.d\.ts|vite-env\.d\.ts' -n || true
jq '.exclude' archon-ui-main/tsconfig.prod.jsonLength of output: 952
Remove tsconfig.prod.json from .dockerignore or explicitly COPY it in your Docker/CI builds
- archon-ui-main/.dockerignore (line 55) currently ignores tsconfig.prod.json, so it won’t be included in your container build context.
- No other scripts reference tsconfig.prod.json—ensure your Dockerfile or CI pipeline pulls in this file when building.
🤖 Prompt for AI Agents
In archon-ui-main/tsconfig.prod.json lines 1-15: the review notes that
tsconfig.prod.json is ignored by .dockerignore so it won't be present in build
context; either remove tsconfig.prod.json from archon-ui-main/.dockerignore (so
it’s included automatically) or explicitly add a COPY command in your Dockerfile
(or ensure your CI pipeline uploads the file) to include tsconfig.prod.json into
the image/build artifacts; update the Dockerfile/CI accordingly and verify no
build steps fail due to the missing file.
| globals: true, | ||
| environment: 'jsdom', | ||
| setupFiles: './test/setup.ts', | ||
| setupFiles: './tests/setup.ts', |
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Setup file relocation looks good; verify path exists.
Ensure ./tests/setup.ts is present and loads in Vitest.
Run:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
test -f tests/setup.ts && echo "OK: tests/setup.ts exists" || { echo "Missing tests/setup.ts"; exit 1; }
rg -n -C2 'vi\.mock\(|beforeAll\(|afterAll\(|expect\.extend\(' tests/setup.ts || trueLength of output: 108
Invalid setupFiles path; file missing
The setupFiles option points to ./tests/setup.ts, but tests/setup.ts doesn’t exist—add the file or correct the path.
🤖 Prompt for AI Agents
In archon-ui-main/vite.config.ts around line 324, the vitest setupFiles path
points to './tests/setup.ts' which doesn't exist; either create the missing
tests/setup.ts file (exporting any required globals/mocks and TypeScript setup)
at that relative location, or change the setupFiles value to the correct
existing path (e.g., './test/setup.ts' or './src/tests/setup.ts') and update any
tsconfig/vite path resolution if needed so vitest can resolve the file.
- Add new /features/mcp with TanStack Query integration - Components: McpClientList, McpStatusBar, McpConfigSection - Services: mcpApi with ETag caching - Hooks: useMcpStatus, useMcpConfig, useMcpClients, useMcpSessionInfo - Views: McpView with error boundary wrapper - Full TypeScript types for MCP protocol Part of TanStack Query migration phase 2. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Remove deprecated mcpServerService.ts (237 lines) - Remove unused useMCPQueries.ts hooks (77 lines) - Simplify MCPPage.tsx to use new feature architecture - Export useSmartPolling from ui/hooks for MCP feature - Add Python MCP API routes for backend integration This completes the MCP migration to TanStack Query with: - ETag caching for 70% bandwidth reduction - Smart polling with visibility awareness - Vertical slice architecture - Full TypeScript type safety 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (19)
archon-ui-main/src/features/mcp/types/mcp.ts (4)
15-29: Normalize client_type vs SupportedIDE; avoid two vocabulariesThe TitleCase client_type values ("Claude","Windsurf","KiRo", etc.) don’t align with SupportedIDE’s lowercase slugs ("claudecode","windsurf","kiro", etc.). This will cause fragile comparisons/mapping bugs across UI and services.
Recommendation:
- Pick one canonical enum (prefer slugs), and normalize API payloads at the boundary (adapter/transform).
- Or add a central mapping util (clientType -> ide slug) and use it everywhere consumers compare these fields.
Do you want me to add a small mapping util under src/features/mcp/lib with tests?Also applies to: 38-46
9-13: Narrow transport to known literalsAvoid plain string; encode allowed transports to catch typos at compile time.
Apply:
export interface McpServerConfig { - transport: string; + transport: "stdio" | "tcp" | "http" | "sse" | "unknown"; host: string; port: number; model?: string; }
4-5: Document time units/format (prevent downstream confusion)Clarify seconds vs ms and timestamp format (ISO-8601). This avoids UI math/formatting bugs.
Apply:
export interface McpServerStatus { status: "running" | "starting" | "stopped" | "stopping"; - uptime: number | null; + /** Seconds since process start; null if unknown */ + uptime: number | null; logs: string[]; } export interface McpClient { session_id: string; @@ - connected_at: string; - last_activity: string; + /** ISO-8601 timestamp */ + connected_at: string; + /** ISO-8601 timestamp */ + last_activity: string; status: "active" | "idle"; } @@ export interface McpSessionInfo { active_sessions: number; - session_timeout: number; - server_uptime_seconds?: number; + /** Seconds */ + session_timeout: number; + /** Seconds */ + server_uptime_seconds?: number; clients?: McpClient[]; }Also applies to: 26-27, 33-35
38-40: Tighten comment to describe intentMake the comment actionable and future-proof.
Apply:
-// we actually support all ides and mcp clients +// IDEs supported by the UI flows; map inbound MCP client identifiers to these via a normalization util.archon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsx (1)
1-15: Auto-reset errors on route changes (optional)If FeatureErrorBoundary wraps react-error-boundary, pass resetKeys so navigating back to MCP resets state.
Apply:
import { QueryErrorResetBoundary } from "@tanstack/react-query"; import { FeatureErrorBoundary } from "../../ui/components"; import { McpView } from "./McpView"; +import { useLocation } from "react-router-dom"; export const McpViewWithBoundary = () => { - return ( + const location = useLocation(); + return ( <QueryErrorResetBoundary> {({ reset }) => ( - <FeatureErrorBoundary featureName="MCP Dashboard" onReset={reset}> + <FeatureErrorBoundary + featureName="MCP Dashboard" + onReset={reset} + resetKeys={[location.key]} + > <McpView /> </FeatureErrorBoundary> )} </QueryErrorResetBoundary> ); };archon-ui-main/src/features/mcp/views/McpView.tsx (2)
18-26: Hoist animation variants to module scope.Avoid re-allocating these objects on every render; minor perf/readability win.
- // Animation variants - const containerVariants = { ... }; - const itemVariants = { ... }; - const titleVariants = { ... }; +// Move above component: +const containerVariants = { /* unchanged */ }; +const itemVariants = { /* unchanged */ }; +const titleVariants = { /* unchanged */ };Also applies to: 28-38, 40-50
90-92: Pass dynamic server/transport labels to status bar (pairs with McpStatusBar change).Shows real host/port and transport instead of static text.
- <McpStatusBar status={status} sessionInfo={sessionInfo} /> + <McpStatusBar + status={status} + sessionInfo={sessionInfo} + serverLabel={`${config?.host ?? "localhost"}:${config?.port ?? 8051}`} + transportLabel={config?.transport ?? "streamable-http"} + />archon-ui-main/src/features/mcp/components/McpStatusBar.tsx (4)
17-27: Edge case: show days starting at 24h.Use
>= 24so exactly 24h renders as1d 0h ….- if (hours > 24) { + if (hours >= 24) {
29-41: Status nuance: differentiate “starting/stopping” from “stopped”.Use a warning/yellow style for transitional states; keep red for stopped.
- const getStatusIcon = () => { - if (status.status === 'running') { - return <CheckCircle className="w-4 h-4 text-green-500" />; - } - return <AlertCircle className="w-4 h-4 text-red-500" />; - }; + const getStatusIcon = () => { + if (status.status === "running") return <CheckCircle className="w-4 h-4 text-green-500" />; + if (status.status === "starting" || status.status === "stopping") return <Clock className="w-4 h-4 text-yellow-500" />; + return <AlertCircle className="w-4 h-4 text-red-500" />; + }; - const getStatusColor = () => { - if (status.status === 'running') { - return 'text-green-500 shadow-[0_0_10px_rgba(34,197,94,0.5)]'; - } - return 'text-red-500'; - }; + const getStatusColor = () => { + if (status.status === "running") return "text-green-500 shadow-[0_0_10px_rgba(34,197,94,0.5)]"; + if (status.status === "starting" || status.status === "stopping") return "text-yellow-500"; + return "text-red-500"; + };
6-10: Avoid hard-coded server port/transport; accept dynamic labels.Expose optional
serverLabelandtransportLabelprops and render them if provided.interface McpStatusBarProps { status: McpServerStatus; sessionInfo?: McpSessionInfo; className?: string; + serverLabel?: string; + transportLabel?: string; }- <span className="text-zinc-400">MCP</span> - <span className="text-white">8051</span> + <span className="text-zinc-400">MCP</span> + <span className="text-white">{serverLabel ?? "8051"}</span>- <span className="text-zinc-400">TRANSPORT</span> - <span className="text-cyan-400">HTTP/SSE</span> + <span className="text-zinc-400">TRANSPORT</span> + <span className="text-cyan-400">{transportLabel ?? "HTTP"}</span>Follow-up: see McpView call site change in its review comment.
Also applies to: 74-79, 96-99
1-3: Style nit: use double quotes per Biome config for features.Run Biome fix to normalize quotes/imports.
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (1)
34-44: Consider aligning polling with guidance (optional).If you want crisper UI while active: status at ~2s, clients/sessions at ~7–10s. Current values are acceptable.
Also applies to: 46-56
archon-ui-main/src/features/mcp/components/McpClientList.tsx (3)
12-21: Type clientIcons against McpClient['client_type'] for exhaustiveness.Prevents missing icons if the union expands; removes need for runtime fallback.
-const clientIcons: Record<string, string> = { +const clientIcons: Record<McpClient["client_type"], string> = { @@ - <span className="text-2xl">{clientIcons[client.client_type] || '❓'}</span> + <span className="text-2xl">{clientIcons[client.client_type]}</span>Also applies to: 81-81
83-85: Improve light/dark contrast for the client type label.Avoid always-white text in light mode.
- <p className="font-medium text-white">{client.client_type}</p> + <p className="font-medium text-gray-800 dark:text-white">{client.client_type}</p> - <p className="text-xs text-zinc-400">Session: {client.session_id.slice(0, 8)}</p> + <p className="text-xs text-zinc-400"> + Session: {client.session_id.slice(0, 8)} + {client.session_id.length > 8 ? "…" : ""} + </p>
1-21: Format McpClientList.tsx with Biome
Normalize quotes to double quotes and add trailing commas by running:pnpm biome:ai-fix --write archon-ui-main/src/features/mcp/components/McpClientList.tsxarchon-ui-main/src/features/mcp/services/mcpApi.ts (1)
29-34: Align default transport with generated configs.Your config generators use plain HTTP; consider matching the fallback to avoid confusion.
- transport: "streamable-http", + transport: "http",archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (3)
225-229: Controlled Tabs: remove redundant defaultValue.When using a controlled
value,defaultValueis ignored.- <Tabs - defaultValue="claudecode" - value={selectedIDE} - onValueChange={(value) => setSelectedIDE(value as SupportedIDE)} - > + <Tabs value={selectedIDE} onValueChange={(value) => setSelectedIDE(value as SupportedIDE)}>
188-209: Handle clipboard promise rejections to prevent silent failures.Add try/catch and user feedback for clipboard operations.
- const handleCopyConfig = () => { - const configText = ideConfigurations[selectedIDE].configGenerator(config); - navigator.clipboard.writeText(configText); - showToast("Configuration copied to clipboard", "success"); - }; + const handleCopyConfig = async () => { + const text = ideConfigurations[selectedIDE].configGenerator(config); + try { + await navigator.clipboard.writeText(text); + showToast("Configuration copied to clipboard", "success"); + } catch { + showToast("Failed to copy configuration", "error"); + } + }; @@ - const handleClaudeCodeCommand = () => { - const command = `claude mcp add --transport http archon http://${config.host}:${config.port}/mcp`; - navigator.clipboard.writeText(command); - showToast("Command copied to clipboard", "success"); - }; + const handleClaudeCodeCommand = async () => { + const command = `claude mcp add --transport http archon http://${config.host}:${config.port}/mcp`; + try { + await navigator.clipboard.writeText(command); + showToast("Command copied to clipboard", "success"); + } catch { + showToast("Failed to copy command", "error"); + } + };
260-267: DRY: reuse the same Claude command string for display and copy.Avoid divergence between rendered snippet and copied command.
+ const claudeCommand = `claude mcp add --transport http archon http://${config.host}:${config.port}/mcp`; @@ - <code className="text-sm font-mono text-cyan-600 dark:text-cyan-400"> - claude mcp add --transport http archon http://{config.host}:{config.port}/mcp - </code> + <code className="text-sm font-mono text-cyan-600 dark:text-cyan-400">{claudeCommand}</code> @@ - const handleClaudeCodeCommand = async () => { - const command = `claude mcp add --transport http archon http://${config.host}:${config.port}/mcp`; - try { - await navigator.clipboard.writeText(command); + const handleClaudeCodeCommand = async () => { + try { + await navigator.clipboard.writeText(claudeCommand); showToast("Command copied to clipboard", "success"); } catch { showToast("Failed to copy command", "error"); } };Also applies to: 205-209
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (18)
archon-ui-main/src/features/mcp/components/McpClientList.tsx(1 hunks)archon-ui-main/src/features/mcp/components/McpConfigSection.tsx(1 hunks)archon-ui-main/src/features/mcp/components/McpStatusBar.tsx(1 hunks)archon-ui-main/src/features/mcp/components/index.ts(1 hunks)archon-ui-main/src/features/mcp/hooks/index.ts(1 hunks)archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts(1 hunks)archon-ui-main/src/features/mcp/index.ts(1 hunks)archon-ui-main/src/features/mcp/services/index.ts(1 hunks)archon-ui-main/src/features/mcp/services/mcpApi.ts(1 hunks)archon-ui-main/src/features/mcp/types/index.ts(1 hunks)archon-ui-main/src/features/mcp/types/mcp.ts(1 hunks)archon-ui-main/src/features/mcp/views/McpView.tsx(1 hunks)archon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsx(1 hunks)archon-ui-main/src/features/ui/hooks/index.ts(1 hunks)archon-ui-main/src/hooks/useMCPQueries.ts(0 hunks)archon-ui-main/src/pages/MCPPage.tsx(1 hunks)archon-ui-main/src/services/mcpServerService.ts(0 hunks)python/src/server/api_routes/mcp_api.py(1 hunks)
💤 Files with no reviewable changes (2)
- archon-ui-main/src/hooks/useMCPQueries.ts
- archon-ui-main/src/services/mcpServerService.ts
✅ Files skipped from review due to trivial changes (1)
- archon-ui-main/src/features/mcp/services/index.ts
🧰 Additional context used
📓 Path-based instructions (9)
archon-ui-main/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/**/*.{ts,tsx}: Use TanStack Query for all data fetching; avoid prop drilling for server data
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selection
Service method naming conventions: get[Resource]sByProject, get[Resource], create[Resource], update[Resource], delete[Resource]
Task status values must be the canonical DB strings: 'todo', 'doing', 'review', 'done' (no UI mapping)
Enable and honor TypeScript strict mode (no implicit any)
archon-ui-main/src/**/*.{ts,tsx}: Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selections
Do not introduce Socket.IO; polling is the update mechanism
Files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsxarchon-ui-main/src/features/mcp/views/McpView.tsxarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/types/mcp.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.tsarchon-ui-main/src/features/mcp/components/McpStatusBar.tsxarchon-ui-main/src/features/mcp/components/McpConfigSection.tsxarchon-ui-main/src/features/mcp/services/mcpApi.tsarchon-ui-main/src/features/mcp/components/McpClientList.tsxarchon-ui-main/src/pages/MCPPage.tsx
archon-ui-main/src/features/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/features/**/*.{ts,tsx}: Follow query key factory pattern for TanStack Query (all/lists/detail etc.)
Use useSmartPolling for visibility-aware polling; target 1–2s for active, 5–10s for background data
Implement optimistic updates with rollback in mutations (cancel, snapshot, set, restore)
Place feature code by vertical slice: components/, hooks/, services/, types/ within src/features/[feature]/
Frontend styling should follow Tron-inspired glassmorphism with Tailwind classes
Use Biome style in features: 120-character lines, double quotes, trailing commas
Use Vite proxy and HTTP polling (no WebSockets) for updates in the UI
Add new feature components under src/features/[feature]/components, types under types, services under services, hooks under hooks
Use dedicated polling hooks: useSmartPolling, useCrawlProgressPolling, and useProjectTasks for periodic updates
archon-ui-main/src/features/**/*.{ts,tsx}: Use provided hooks for polling and mutations: usePolling, useDatabaseMutation, useProjectMutation
New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
Use TanStack Query for all data fetching in features
Avoid prop drilling; use TanStack Query and context/providers
Use Radix UI (@radix-ui/react-*) for primitives in features; custom components remain in legacy components folder
Prefer Framer Motion sparingly; animations should be minimal
Files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsxarchon-ui-main/src/features/mcp/views/McpView.tsxarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/types/mcp.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.tsarchon-ui-main/src/features/mcp/components/McpStatusBar.tsxarchon-ui-main/src/features/mcp/components/McpConfigSection.tsxarchon-ui-main/src/features/mcp/services/mcpApi.tsarchon-ui-main/src/features/mcp/components/McpClientList.tsx
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce WebSocket-based updates; architecture mandates HTTP polling with ETag caching
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}: Never return None/null to signal failure; raise an exception (or reject) with details
Do not annotate comments with LEGACY, CHANGED, or REMOVED; write comments that document current functionality only
Files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsxarchon-ui-main/src/features/mcp/views/McpView.tsxarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/types/mcp.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.tsarchon-ui-main/src/features/mcp/components/McpStatusBar.tsxarchon-ui-main/src/features/mcp/components/McpConfigSection.tsxpython/src/server/api_routes/mcp_api.pyarchon-ui-main/src/features/mcp/services/mcpApi.tsarchon-ui-main/src/features/mcp/components/McpClientList.tsxarchon-ui-main/src/pages/MCPPage.tsx
archon-ui-main/src/features/**/*.{ts,tsx,css}
📄 CodeRabbit inference engine (AGENTS.md)
Apply Tron-inspired glassmorphism styling with Tailwind CSS to features components
Files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsxarchon-ui-main/src/features/mcp/views/McpView.tsxarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/types/mcp.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.tsarchon-ui-main/src/features/mcp/components/McpStatusBar.tsxarchon-ui-main/src/features/mcp/components/McpConfigSection.tsxarchon-ui-main/src/features/mcp/services/mcpApi.tsarchon-ui-main/src/features/mcp/components/McpClientList.tsx
archon-ui-main/src/features/**/*.{ts,tsx,js,jsx,css,json}
📄 CodeRabbit inference engine (AGENTS.md)
Run Biome and address diagnostics only within /src/features (biome:ai, biome:ai-fix workflow)
Files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsxarchon-ui-main/src/features/mcp/views/McpView.tsxarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/types/mcp.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.tsarchon-ui-main/src/features/mcp/components/McpStatusBar.tsxarchon-ui-main/src/features/mcp/components/McpConfigSection.tsxarchon-ui-main/src/features/mcp/services/mcpApi.tsarchon-ui-main/src/features/mcp/components/McpClientList.tsx
python/src/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/**/*.py: Fail fast on service startup failures (credentials, DB, or any service init) and crash with a clear error
Treat missing configuration (env vars/invalid settings) as fatal; abort startup
Do not mask database connection failures; surface them immediately
Authentication/authorization failures must halt the operation and be visible
Never accept corrupted/invalid data; let Pydantic raise and abort writes
If a critical dependency (required service) is unavailable, fail immediately
Reject data that would corrupt state (e.g., zero embeddings, null FKs, malformed JSON) rather than storing it
In batch/background/WebSocket-like event processing, continue processing but log detailed errors; do not crash the whole worker
On per-item failures during processing, skip the item entirely and do not persist partial/corrupted data; record error details
External API calls: retry with exponential backoff; on exhaustion, fail with a clear message naming the service and reason
Error messages must include operation context, relevant IDs/URLs/data, and preserve full stack traces (logging with exc_info=True)
Use specific exception types instead of catching generic Exception
Never return None/null to indicate failure; raise an exception with details
For batch operations, always report both success count and a detailed failure list
Target Python 3.12 and adhere to 120-character line length
Keep code lint-clean with Ruff (errors, warnings, unused imports)
Maintain static typing with MyPy across the backend
python/src/**/*.py: On service startup failures (missing creds, DB, or uninitialized services), crash fast with a clear error
Treat missing/invalid environment configuration as fatal and abort startup
Do not hide database connection failures; let them bubble up and fail fast
Authentication/authorization failures must halt the operation and be visible
Never accept or write corrupted data (e.g., zero embeddings, null FKs, malformed JSON)
If critical dependencies are unav...
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/api_routes/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/server/api_routes/**/*.py: Follow route -> service -> database layering for FastAPI endpoints
Add new API routes under python/src/server/api_routes and include routers in python/src/server/main.pyImplement new API endpoints under python/src/server/api_routes and include router in python/src/server/main.py
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Define and use specific exception classes and FastAPI exception handlers that return rich JSON errors
Files:
python/src/server/api_routes/mcp_api.py
archon-ui-main/src/pages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Legacy components should be composed within pages under src/pages
Files:
archon-ui-main/src/pages/MCPPage.tsx
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Avoid prop drilling; use TanStack Query and context/providers
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Add new feature components under src/features/[feature]/components, types under types, services under services, hooks under hooks
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/types/index.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use provided hooks for polling and mutations: usePolling, useDatabaseMutation, useProjectMutation
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/hooks/index.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : New UI should live under src/features using Radix UI primitives from src/features/ui/primitives
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/types/index.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use Radix UI (radix-ui/react-*) for primitives in features; custom components remain in legacy components folder
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/ui/primitives/**/*.{ts,tsx} : Use Radix UI primitives from src/features/ui/primitives for base UI elements
Applied to files:
archon-ui-main/src/features/ui/hooks/index.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/components/**/*.{ts,tsx} : Only add legacy components under src/components (not features)
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.tsarchon-ui-main/src/features/mcp/types/index.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use dedicated polling hooks: useSmartPolling, useCrawlProgressPolling, and useProjectTasks for periodic updates
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use useSmartPolling for visibility-aware polling; target 1–2s for active, 5–10s for background data
Applied to files:
archon-ui-main/src/features/ui/hooks/index.tsarchon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/services/**/*.ts : Update corresponding frontend service modules when backend endpoints change
Applied to files:
archon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/types/index.tsarchon-ui-main/src/features/mcp/services/mcpApi.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Place feature code by vertical slice: components/, hooks/, services/, types/ within src/features/[feature]/
Applied to files:
archon-ui-main/src/features/mcp/components/index.tsarchon-ui-main/src/features/mcp/index.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Enable and honor TypeScript strict mode (no implicit any)
Applied to files:
archon-ui-main/src/features/mcp/types/index.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Follow query key factory pattern for TanStack Query (all/lists/detail etc.)
Applied to files:
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Applied to files:
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
Applied to files:
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/**/*.{ts,tsx} : Use TanStack Query for all data fetching; avoid prop drilling for server data
Applied to files:
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to python/src/server/api_routes/**/*.py : Implement new API endpoints under python/src/server/api_routes and include router in python/src/server/main.py
Applied to files:
python/src/server/api_routes/mcp_api.py
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/pages/**/*.{ts,tsx} : Legacy components should be composed within pages under src/pages
Applied to files:
archon-ui-main/src/pages/MCPPage.tsx
🧬 Code graph analysis (8)
archon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsx (2)
archon-ui-main/src/features/mcp/index.ts (2)
McpViewWithBoundary(6-6)McpView(5-5)archon-ui-main/src/features/mcp/views/McpView.tsx (1)
McpView(8-110)
archon-ui-main/src/features/mcp/views/McpView.tsx (5)
archon-ui-main/src/features/mcp/index.ts (1)
McpView(5-5)archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (4)
useMcpStatus(14-24)useMcpConfig(26-32)useMcpClients(34-44)useMcpSessionInfo(46-56)archon-ui-main/src/features/mcp/components/McpStatusBar.tsx (1)
McpStatusBar(12-101)archon-ui-main/src/features/mcp/components/McpClientList.tsx (1)
McpClientList(23-108)archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (1)
McpConfigSection(169-298)
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts (2)
archon-ui-main/src/features/ui/hooks/useSmartPolling.ts (1)
useSmartPolling(8-66)archon-ui-main/src/features/mcp/services/mcpApi.ts (1)
mcpApi(9-59)
archon-ui-main/src/features/mcp/components/McpStatusBar.tsx (2)
archon-ui-main/src/features/mcp/types/mcp.ts (2)
McpServerStatus(2-6)McpSessionInfo(31-36)archon-ui-main/src/features/ui/primitives/styles.ts (2)
cn(139-141)glassmorphism(12-100)
archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (4)
archon-ui-main/src/features/mcp/types/mcp.ts (3)
McpServerConfig(8-13)McpServerStatus(2-6)SupportedIDE(39-46)archon-ui-main/src/features/ui/primitives/styles.ts (2)
cn(139-141)glassmorphism(12-100)archon-ui-main/src/features/ui/primitives/tabs.tsx (4)
Tabs(6-6)TabsList(9-18)TabsTrigger(22-86)TabsContent(90-102)archon-ui-main/src/features/ui/primitives/button.tsx (1)
Button(11-115)
python/src/server/api_routes/mcp_api.py (2)
python/src/server/config/logfire_config.py (2)
safe_span(151-172)safe_set_attribute(193-206)python/src/mcp_server/mcp_server.py (1)
session_info(338-371)
archon-ui-main/src/features/mcp/services/mcpApi.ts (2)
archon-ui-main/src/features/mcp/types/mcp.ts (4)
McpServerStatus(2-6)McpServerConfig(8-13)McpSessionInfo(31-36)McpClient(15-29)archon-ui-main/src/features/projects/shared/apiWithEtag.ts (1)
callAPIWithETag(29-138)
archon-ui-main/src/features/mcp/components/McpClientList.tsx (2)
archon-ui-main/src/features/mcp/types/mcp.ts (1)
McpClient(15-29)archon-ui-main/src/features/ui/primitives/styles.ts (2)
cn(139-141)glassmorphism(12-100)
🔇 Additional comments (10)
archon-ui-main/src/features/ui/hooks/index.ts (1)
3-3: Ignore default export suggestion
useToast.tsonly provides named exports (e.g.,export function useToast()), so there is no default to forward.
export * from "./useToast";correctly re-exportsuseToast.Likely an incorrect or invalid review comment.
python/src/server/api_routes/mcp_api.py (1)
776-804: Preserve stack traces on errors; type the /sessions response; verify router registrationApply within this hunk:
-@router.get("/sessions") -async def get_mcp_sessions(): +@router.get("/sessions", response_model=McpSessionsResponse) +async def get_mcp_sessions() -> McpSessionsResponse: @@ - except Exception as e: - api_logger.error(f"Failed to get MCP sessions - error={str(e)}") - safe_set_attribute(span, "error", str(e)) - raise HTTPException(status_code=500, detail=str(e)) + except Exception as e: + api_logger.error("Failed to get MCP sessions", exc_info=True) + safe_set_attribute(span, "error", str(e)) + raise HTTPException(status_code=500, detail={"error": str(e)})Add this model alongside other Pydantic schemas:
class McpSessionsResponse(BaseModel): active_sessions: int session_timeout: int server_uptime_seconds: int | None = NoneManual verification: I didn’t find any
include_router(...mcp_api.router)call—ensuremcp_api.routeris registered in your FastAPI app so these endpoints are exposed.archon-ui-main/src/features/mcp/types/index.ts (1)
1-1: LGTM — simple barrel exportMatches feature slicing and keeps public type surface tidy.
archon-ui-main/src/features/mcp/hooks/index.ts (1)
1-1: LGTM — hooks barrelKeeps MCP hooks import ergonomics consistent with other features.
archon-ui-main/src/features/mcp/views/McpViewWithBoundary.tsx (1)
5-15: LGTM — boundary correctly wires to QueryErrorResetBoundaryWrapper pattern is sound; onReset is passed through.
archon-ui-main/src/features/mcp/components/index.ts (1)
1-3: LGTM — component barrelConsistent with feature slicing and public API exposure.
archon-ui-main/src/features/mcp/index.ts (1)
1-6: Barrel API looks good and aligns with vertical-slice organization.Centralized exports from components/hooks/services/types plus explicit views keep imports stable.
archon-ui-main/src/pages/MCPPage.tsx (1)
1-5: Thin page wrapper LGTM.Delegating to McpViewWithBoundary is the right direction for pages composition.
archon-ui-main/src/features/mcp/components/McpClientList.tsx (1)
2-2: Ignore removal ofcompoundStyles—it’s exported inarchon-ui-main/src/features/ui/primitives/styles.ts(line 103) and the import is valid.Likely an incorrect or invalid review comment.
archon-ui-main/src/features/mcp/components/McpConfigSection.tsx (1)
194-203: Confirmed Cursor deeplink scheme matches official docs. No changes needed.
| const formatDuration = (connectedAt: string): string => { | ||
| const now = new Date(); | ||
| const connected = new Date(connectedAt); | ||
| const seconds = Math.floor((now.getTime() - connected.getTime()) / 1000); | ||
|
|
||
| if (seconds < 60) return `${seconds}s`; | ||
| if (seconds < 3600) return `${Math.floor(seconds / 60)}m`; | ||
| return `${Math.floor(seconds / 3600)}h ${Math.floor((seconds % 3600) / 60)}m`; | ||
| }; |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Harden date formatting for invalid/future timestamps.
Guard against unparsable dates and future clock skew; avoids NaN or negative displays.
const formatDuration = (connectedAt: string): string => {
const now = new Date();
const connected = new Date(connectedAt);
- const seconds = Math.floor((now.getTime() - connected.getTime()) / 1000);
+ if (Number.isNaN(connected.getTime())) return "—";
+ const seconds = Math.max(0, Math.floor((now.getTime() - connected.getTime()) / 1000));
@@
const formatLastActivity = (lastActivity: string): string => {
const now = new Date();
const activity = new Date(lastActivity);
- const seconds = Math.floor((now.getTime() - activity.getTime()) / 1000);
+ if (Number.isNaN(activity.getTime())) return "Idle";
+ const seconds = Math.max(0, Math.floor((now.getTime() - activity.getTime()) / 1000));Also applies to: 37-46
🤖 Prompt for AI Agents
In archon-ui-main/src/features/mcp/components/McpClientList.tsx around lines
27-35 (also apply same changes to lines 37-46), the duration formatter must
guard against unparsable dates and future timestamps: parse the connectedAt
string into a Date, check connected.getTime() for NaN and treat unparsable
values as 0 seconds (or return a safe placeholder like "0s"), clamp any future
timestamp (connected > now) to 0 seconds to avoid negative durations, then
compute seconds and format as before; ensure the function returns a string in
all cases.
There was a problem hiding this comment.
@Wirasm, understood! I'll skip the date formatting hardening suggestion. Thanks for the feedback.
🐰
╭─────╮
( ◕ ◕ )
╰─┬─┬─╯
│ │
⌐■-■
🧠 Learnings used
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Avoid prop drilling; use TanStack Query and context/providers
| @@ -0,0 +1 @@ | |||
| export * from "./useMcpQueries"; No newline at end of file | |||
There was a problem hiding this comment.
💡 Verification agent
🧩 Analysis chain
Verify polling + key factory usage in useMcpQueries
Ensure we follow the query key factory and visibility-aware polling hooks per guidelines (useSmartPolling; 1–2s active, 5–10s bg).
Run:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Confirm key factory and hooks exist
rg -n -C2 'export const mcpKeys' archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts || echo "Missing mcpKeys factory"
rg -n -C2 'useSmartPolling|usePolling' archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts || echo "No visibility-aware polling hook found"
# Confirm exported hook names used by McpView
rg -n -C2 '\buseMcp(Status|Config|Clients|SessionInfo)\b' archon-ui-main/src/features/mcp/hooks/useMcpQueries.tsLength of output: 1507
Align polling intervals in useMcpQueries
useSmartPolling is imported and used in useMcpStatus/useMcpClients/useMcpSessionInfo, but the 5 000 ms / 10 000 ms args don’t meet the 1–2 s active / 5–10 s background guideline—update to something like useSmartPolling(2000, 8000). Wrap useMcpConfig in useSmartPolling as well if its data needs periodic refresh.
🤖 Prompt for AI Agents
In archon-ui-main/src/features/mcp/hooks/index.ts around line 1, update the
polling intervals used across the MCP hooks to follow the 1–2s active / 5–10s
background guideline: change any useSmartPolling(5000, 10000) or
useSmartPolling(10000, 5000) calls in useMcpStatus, useMcpClients, and
useMcpSessionInfo to useSmartPolling(2000, 8000); additionally, if useMcpConfig
needs periodic refresh, wrap its fetch logic in useSmartPolling(2000, 8000) as
well so all MCP hooks use aligned intervals.
| return useQuery({ | ||
| queryKey: mcpKeys.status(), | ||
| queryFn: () => mcpApi.getStatus(), | ||
| refetchInterval, | ||
| refetchOnWindowFocus: false, | ||
| staleTime: 3000, | ||
| }); | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Opt queries into error boundaries to avoid silent failure loops.
This ensures status fetch errors are surfaced to McpViewWithBoundary instead of causing an endless spinner.
return useQuery({
queryKey: mcpKeys.status(),
queryFn: () => mcpApi.getStatus(),
refetchInterval,
refetchOnWindowFocus: false,
staleTime: 3000,
+ useErrorBoundary: true,
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| return useQuery({ | |
| queryKey: mcpKeys.status(), | |
| queryFn: () => mcpApi.getStatus(), | |
| refetchInterval, | |
| refetchOnWindowFocus: false, | |
| staleTime: 3000, | |
| }); | |
| } | |
| return useQuery({ | |
| queryKey: mcpKeys.status(), | |
| queryFn: () => mcpApi.getStatus(), | |
| refetchInterval, | |
| refetchOnWindowFocus: false, | |
| staleTime: 3000, | |
| useErrorBoundary: true, | |
| }); | |
| } |
🤖 Prompt for AI Agents
In archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts around lines 17 to 24,
the mcp status query currently swallows errors causing a silent spinner; enable
React Query error boundaries by adding the useErrorBoundary option (e.g. set
useErrorBoundary: true or a predicate returning true) to the useQuery call so
that errors are thrown to McpViewWithBoundary instead of being retried/silently
handled.
| if (statusLoading || !status) { | ||
| return ( | ||
| <div className="flex items-center justify-center min-h-[400px]"> | ||
| <Loader className="animate-spin text-gray-500" size={32} /> | ||
| </div> | ||
| ); | ||
| } |
There was a problem hiding this comment.
🛠️ Refactor suggestion
Bug: infinite spinner on fetch error (error never surfaced to boundary).
If the status query errors, isLoading becomes false and status is undefined, so this branch keeps rendering the spinner forever. Also, React Query errors aren’t thrown to the ErrorBoundary unless useErrorBoundary: true is set.
Fix by opting the status query into error boundaries (preferred), or handle isError here.
Apply in useMcpQueries.ts:
export function useMcpStatus() {
const { refetchInterval } = useSmartPolling(5000); // 5 second polling
return useQuery({
queryKey: mcpKeys.status(),
queryFn: () => mcpApi.getStatus(),
refetchInterval,
refetchOnWindowFocus: false,
staleTime: 3000,
+ useErrorBoundary: true,
});
}Optionally, guard here if you don’t adopt useErrorBoundary:
- if (statusLoading || !status) {
+ if (statusLoading) {
return (/* spinner */);
}
+ // Optionally show an error UI when isError === true🤖 Prompt for AI Agents
In archon-ui-main/src/features/mcp/views/McpView.tsx around lines 52-58, the
spinner can hang forever when the status query errors because status is
undefined and the error isn't thrown to the ErrorBoundary; update the status
query in useMcpQueries.ts to opt into error boundaries by setting
useErrorBoundary: true (preferred) or alternatively return and surface
isError/isErrorMessage so McpView can render an error state or re-throw the
error to the boundary; if you don’t enable useErrorBoundary, add a guard in this
McpView branch that checks isError and renders an error message (or throws)
instead of always rendering the loader.
| @router.get("/clients") | ||
| async def get_mcp_clients(): | ||
| """Get connected MCP clients with type detection.""" | ||
| with safe_span("api_mcp_clients") as span: | ||
| safe_set_attribute(span, "endpoint", "/api/mcp/clients") | ||
| safe_set_attribute(span, "method", "GET") | ||
|
|
||
| try: | ||
| # TODO: Implement real client detection in the future | ||
| # For now, return mock data | ||
| api_logger.debug("Getting MCP clients - returning mock data") | ||
|
|
||
| return { | ||
| "clients": [], | ||
| "total": 0, | ||
| "message": "Client detection not yet implemented" | ||
| } | ||
| except Exception as e: | ||
| api_logger.error(f"Failed to get MCP clients - error={str(e)}") | ||
| safe_set_attribute(span, "error", str(e)) | ||
| return { | ||
| "clients": [], | ||
| "total": 0, | ||
| "error": str(e) | ||
| } | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion
Standardize error handling and add typed response model for /clients.
- Don’t return ad-hoc error dicts; raise HTTPException with a JSON detail and log with exc_info=True to preserve stack traces (per backend guidelines).
- Add response_model and explicit return type to keep mypy/FastAPI schemas consistent.
Apply within this hunk:
-@router.get("/clients")
-async def get_mcp_clients():
+@router.get("/clients", response_model=McpClientsResponse)
+async def get_mcp_clients() -> McpClientsResponse:
@@
- except Exception as e:
- api_logger.error(f"Failed to get MCP clients - error={str(e)}")
- safe_set_attribute(span, "error", str(e))
- return {
- "clients": [],
- "total": 0,
- "error": str(e)
- }
+ except Exception as e:
+ api_logger.error("Failed to get MCP clients", exc_info=True)
+ safe_set_attribute(span, "error", str(e))
+ raise HTTPException(status_code=500, detail={"error": str(e)})Add these models near other Pydantic models in this file:
class McpClientsResponse(BaseModel):
clients: list[dict[str, Any]]
total: int
message: str | None = None🤖 Prompt for AI Agents
In python/src/server/api_routes/mcp_api.py around lines 749-774, replace the
ad-hoc dict responses and plain exception handling with a typed Pydantic
response model and standardized HTTPException usage: add the McpClientsResponse
model near the other BaseModel definitions (import Any and BaseModel), update
the @router.get(...) to include response_model=McpClientsResponse and annotate
the function return type as McpClientsResponse, keep the mock-success return
structured to match the model, and in the except block log the error with
api_logger.error(..., exc_info=True) and raise
fastapi.HTTPException(status_code=500, detail={"clients": [], "total": 0,
"error": str(e)}) (ensure HTTPException is imported from fastapi and status if
needed) while preserving the existing tracing span attribute updates.
- Fix backend API to return correct "streamable-http" transport mode - Update frontend to dynamically display transport type from config - Remove unused MCP functions (startMCPServer, stopMCPServer, getMCPServerStatus) - Clean up unused MCPServerResponse interface - Update log messages to show accurate transport mode - Complete aggressive MCP cleanup with 75% code reduction (617 lines removed) Backend changes: - python/src/server/api_routes/mcp_api.py: Fix transport and logs - Reduced from 818 to 201 lines while preserving all functionality Frontend changes: - McpStatusBar: Dynamic transport display based on config - McpView: Pass config to status bar component - api.ts: Remove unused MCP management functions All MCP tools tested and verified working after cleanup. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove Docker container management functionality - Remove start/stop/restart endpoints - Simplify to status and config endpoints only - Container is now managed entirely via docker-compose
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
archon-ui-main/src/services/api.ts (2)
85-92: Fix header merge order and FormData handling to avoid accidental header clobbering.Placing
...optionsafter theheadersobject can overwrite the merged headers entirely. Also, defaultingContent-Type: application/jsonbreaks FormData unless explicitly overridden per call site. Make it robust and automatic.- const response = await fetch(url, { - headers: { - 'Content-Type': 'application/json', - ...options.headers, - }, - ...options, - }); + const isFormData = options.body instanceof FormData; + const mergedHeaders: HeadersInit = { + Accept: 'application/json', + ...(options.headers ?? {}), + ...(isFormData ? {} : { 'Content-Type': 'application/json' }), + }; + const response = await fetch(url, { + ...options, + headers: mergedHeaders, + });
63-76: Constrain retries to retryable conditions; avoid retrying 4xx and non-idempotent POSTs.Current logic retries everything, which can amplify side effects (e.g., starting multiple crawls) and mask client errors.
-export async function retry<T>(fn: () => Promise<T>, retries = 3, delay = 500): Promise<T> { +export async function retry<T>( + fn: () => Promise<T>, + retries = 3, + delay = 500, + isRetryable: (err: unknown) => boolean = (err) => { + // Network errors or explicit HttpError with 5xx + return (err as any)?.name === 'TypeError' || (typeof (err as any)?.status === 'number' && (err as any).status >= 500); + } +): Promise<T> { let lastError; for (let i = 0; i < retries; i++) { try { return await fn(); } catch (err) { lastError = err; - if (i < retries - 1) { + if (i < retries - 1 && isRetryable(err)) { await new Promise(res => setTimeout(res, delay * Math.pow(2, i))); } } } throw lastError; }Optionally, emit a custom HttpError from apiRequest to expose
statuscleanly.python/src/server/api_routes/mcp_api.py (1)
100-133: Bug: invalid logger kwarg causes runtime TypeError.
api_logger.error(..., error=str(e))passes an unsupported kwarg. Useexc_info=True.- except Exception as e: - api_logger.error("Failed to get MCP configuration", error=str(e)) + except Exception as e: + api_logger.error("Failed to get MCP configuration", exc_info=True) safe_set_attribute(span, "error", str(e)) raise HTTPException(status_code=500, detail={"error": str(e)})Optional: add a response_model for config for mypy/FastAPI schema stability.
♻️ Duplicate comments (1)
python/src/server/api_routes/mcp_api.py (1)
135-159: /clients should return typed model and raise on failure (don’t 200 with error body).Current code swallows exceptions and returns a success 200 with an
errorfield, breaking error semantics and frontend expectations.-@router.get("/clients") -async def get_mcp_clients(): +@router.get("/clients", response_model=McpClientsResponse) +async def get_mcp_clients() -> "McpClientsResponse": @@ - return { - "clients": [], - "total": 0 - } + return {"clients": [], "total": 0, "message": None} except Exception as e: - api_logger.error(f"Failed to get MCP clients - error={str(e)}") + api_logger.error("Failed to get MCP clients", exc_info=True) safe_set_attribute(span, "error", str(e)) - return { - "clients": [], - "total": 0, - "error": str(e) - } + raise HTTPException(status_code=500, detail={"error": str(e)})Add the response model near other models:
from pydantic import BaseModel class McpClientsResponse(BaseModel): clients: list[dict[str, Any]] total: int message: str | None = None
🧹 Nitpick comments (3)
archon-ui-main/src/services/api.ts (1)
145-159: Simplify upload: after fixing apiRequest header logic, remove the empty headers override.Let apiRequest detect FormData and avoid setting Content-Type automatically.
- return retry(() => apiRequest<UploadResponse>('/documents/upload', { - method: 'POST', - body: formData, - headers: {}, // Let browser set Content-Type for FormData - })); + return retry(() => apiRequest<UploadResponse>('/documents/upload', { + method: 'POST', + body: formData, + }));python/src/server/api_routes/mcp_api.py (2)
71-88: Standardize error response and include stack traces.Use structured detail and exc_info=True.
- except Exception as e: - api_logger.error(f"MCP server status API failed - error={str(e)}") + except Exception as e: + api_logger.error("MCP server status API failed", exc_info=True) safe_set_attribute(span, "error", str(e)) - raise HTTPException(status_code=500, detail=str(e)) + raise HTTPException(status_code=500, detail={"error": str(e)})
161-189: Add a typed response model for /sessions and align error handling.Improves schema docs, mypy guarantees, and consistency.
-@router.get("/sessions") -async def get_mcp_sessions(): +@router.get("/sessions", response_model=McpSessionsResponse) +async def get_mcp_sessions() -> "McpSessionsResponse": @@ - return session_info + return session_info # matches McpSessionsResponse except Exception as e: - api_logger.error(f"Failed to get MCP sessions - error={str(e)}") + api_logger.error("Failed to get MCP sessions", exc_info=True) safe_set_attribute(span, "error", str(e)) - raise HTTPException(status_code=500, detail=str(e)) + raise HTTPException(status_code=500, detail={"error": str(e)})Add model:
class McpSessionsResponse(BaseModel): active_sessions: int session_timeout: int server_uptime_seconds: int | None = None
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
archon-ui-main/src/features/mcp/components/McpStatusBar.tsx(1 hunks)archon-ui-main/src/features/mcp/views/McpView.tsx(1 hunks)archon-ui-main/src/services/api.ts(1 hunks)python/src/server/api_routes/mcp_api.py(3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- archon-ui-main/src/features/mcp/views/McpView.tsx
- archon-ui-main/src/features/mcp/components/McpStatusBar.tsx
🧰 Additional context used
📓 Path-based instructions (6)
archon-ui-main/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
archon-ui-main/src/**/*.{ts,tsx}: Use TanStack Query for all data fetching; avoid prop drilling for server data
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selection
Service method naming conventions: get[Resource]sByProject, get[Resource], create[Resource], update[Resource], delete[Resource]
Task status values must be the canonical DB strings: 'todo', 'doing', 'review', 'done' (no UI mapping)
Enable and honor TypeScript strict mode (no implicit any)
archon-ui-main/src/**/*.{ts,tsx}: Frontend uses HTTP polling (not Socket.IO/WebSockets) for updates; use provided polling hooks
State naming: is[Action]ing for loading, [resource]Error for errors, selected[Resource] for selections
Do not introduce Socket.IO; polling is the update mechanism
Files:
archon-ui-main/src/services/api.ts
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce WebSocket-based updates; architecture mandates HTTP polling with ETag caching
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}: Never return None/null to signal failure; raise an exception (or reject) with details
Do not annotate comments with LEGACY, CHANGED, or REMOVED; write comments that document current functionality only
Files:
archon-ui-main/src/services/api.tspython/src/server/api_routes/mcp_api.py
archon-ui-main/src/services/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
archon-ui-main/src/services/**/*.ts: Frontend service method naming: get[Resource]sByProject(projectId), getResource, createResource, update[Resource](id, updates), deleteResource
Update corresponding frontend service modules when backend endpoints change
Use Vite proxy for API calls in development; ensure service URLs align with proxy config
Files:
archon-ui-main/src/services/api.ts
python/src/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/**/*.py: Fail fast on service startup failures (credentials, DB, or any service init) and crash with a clear error
Treat missing configuration (env vars/invalid settings) as fatal; abort startup
Do not mask database connection failures; surface them immediately
Authentication/authorization failures must halt the operation and be visible
Never accept corrupted/invalid data; let Pydantic raise and abort writes
If a critical dependency (required service) is unavailable, fail immediately
Reject data that would corrupt state (e.g., zero embeddings, null FKs, malformed JSON) rather than storing it
In batch/background/WebSocket-like event processing, continue processing but log detailed errors; do not crash the whole worker
On per-item failures during processing, skip the item entirely and do not persist partial/corrupted data; record error details
External API calls: retry with exponential backoff; on exhaustion, fail with a clear message naming the service and reason
Error messages must include operation context, relevant IDs/URLs/data, and preserve full stack traces (logging with exc_info=True)
Use specific exception types instead of catching generic Exception
Never return None/null to indicate failure; raise an exception with details
For batch operations, always report both success count and a detailed failure list
Target Python 3.12 and adhere to 120-character line length
Keep code lint-clean with Ruff (errors, warnings, unused imports)
Maintain static typing with MyPy across the backend
python/src/**/*.py: On service startup failures (missing creds, DB, or uninitialized services), crash fast with a clear error
Treat missing/invalid environment configuration as fatal and abort startup
Do not hide database connection failures; let them bubble up and fail fast
Authentication/authorization failures must halt the operation and be visible
Never accept or write corrupted data (e.g., zero embeddings, null FKs, malformed JSON)
If critical dependencies are unav...
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/api_routes/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/server/api_routes/**/*.py: Follow route -> service -> database layering for FastAPI endpoints
Add new API routes under python/src/server/api_routes and include routers in python/src/server/main.pyImplement new API endpoints under python/src/server/api_routes and include router in python/src/server/main.py
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Define and use specific exception classes and FastAPI exception handlers that return rich JSON errors
Files:
python/src/server/api_routes/mcp_api.py
🧠 Learnings (3)
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/services/**/*.ts : Update corresponding frontend service modules when backend endpoints change
Applied to files:
archon-ui-main/src/services/api.ts
📚 Learning: 2025-08-28T13:07:24.810Z
Learnt from: Wirasm
PR: coleam00/Archon#514
File: archon-ui-main/src/services/crawlProgressService.ts:35-39
Timestamp: 2025-08-28T13:07:24.810Z
Learning: The crawlProgressService.ts in the Archon codebase should be deprecated in favor of the existing useCrawlProgressPolling hook from usePolling.ts, which already includes ETag support, 304 handling, tab visibility detection, and proper React lifecycle integration. This consolidation reduces code duplication and improves performance.
Applied to files:
archon-ui-main/src/services/api.ts
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to python/src/server/api_routes/**/*.py : Implement new API endpoints under python/src/server/api_routes and include router in python/src/server/main.py
Applied to files:
python/src/server/api_routes/mcp_api.py
🧬 Code graph analysis (1)
python/src/server/api_routes/mcp_api.py (2)
python/src/server/config/logfire_config.py (2)
safe_set_attribute(193-206)safe_span(151-172)python/src/mcp_server/mcp_server.py (1)
session_info(338-371)
🔇 Additional comments (5)
archon-ui-main/src/services/api.ts (3)
2-2: Doc update looks good.No issues with the shortened description.
78-115: No changes needed: ETag flows usecallAPIWithETag
All endpoints requiring 304-aware caching invokecallAPIWithETag(inshared/apiWithEtag.ts), which handles 304 responses and serves cached data. The genericapiRequestis only used for non-ETag requests, so no additional 304 handling is required here.
1-165: No lingering MCP server functions found – searches forstartMCPServer,stopMCPServer, andgetMCPServerStatusreturned no matches in the frontend codebase.python/src/server/api_routes/mcp_api.py (2)
191-202: Health endpoint looks good.Concise, stable response with tracing tags. No changes requested.
1-20: Resolved: mcp_router registration confirmedmcp_router is included in python/src/server/main.py (line 197).
- Add MCP feature with TanStack Query hooks and services - Create useMcpQueries hook with smart polling for status/config - Implement mcpApi service with streamable-http transport - Add MCP page component with real-time updates - Export MCP hooks from features/ui for global access - Fix logging bug in mcp_api.py (invalid error kwarg) - Update docker command to v2 syntax (docker compose) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
python/src/server/api_routes/mcp_api.py (1)
135-159: Standardize /clients: typed response + raise on failure (not ad-hoc dict).
Same point as earlier review; log with exc_info and use response_model.-@router.get("/clients") -async def get_mcp_clients(): +@router.get("/clients", response_model=McpClientsResponse) +async def get_mcp_clients() -> McpClientsResponse: @@ - return { - "clients": [], - "total": 0 - } + return McpClientsResponse(clients=[], total=0) @@ - except Exception as e: - api_logger.error(f"Failed to get MCP clients - error={str(e)}") + except Exception as e: + api_logger.error("Failed to get MCP clients", exc_info=True) safe_set_attribute(span, "error", str(e)) - return { - "clients": [], - "total": 0, - "error": str(e) - } + raise HTTPException(status_code=500, detail={"error": str(e)})
🧹 Nitpick comments (7)
python/src/server/api_routes/mcp_api.py (7)
8-16: Add pydantic and Literal imports to enable typed response models.
This supports mypy/ FastAPI schema generation.- from typing import Any + from typing import Any, Literal @@ -from fastapi import APIRouter, HTTPException +from fastapi import APIRouter, HTTPException +from pydantic import BaseModel
18-20: Define response models for all endpoints.
Keeps schemas stable, improves typing, and aligns with backend guidelines.# Add below router = APIRouter(...) class ContainerStatusResponse(BaseModel): status: Literal["running", "stopped", "not_found", "error"] uptime: int | None = None logs: list[str] container_status: str message: str | None = None error: str | None = None class McpConfigResponse(BaseModel): host: str port: int transport: Literal["streamable-http"] model_choice: str class McpClientsResponse(BaseModel): clients: list[dict[str, Any]] total: int message: str | None = None class McpSessionsResponse(BaseModel): active_sessions: int session_timeout: int server_uptime_seconds: int | None = None class HealthResponse(BaseModel): status: Literal["healthy"] service: str
21-68: Close Docker client and make container name configurable.
Prevents resource leaks and eases ops overrides.-def get_container_status() -> dict[str, Any]: +def get_container_status() -> dict[str, Any]: - try: - docker_client = docker.from_env() - container = docker_client.containers.get("archon-mcp") + docker_client = None + try: + docker_client = docker.from_env() + container_name = os.getenv("ARCHON_MCP_CONTAINER_NAME", "archon-mcp") + container = docker_client.containers.get(container_name) @@ - except Exception as e: - api_logger.error("Failed to get container status", exc_info=True) + except Exception as e: + api_logger.error("Failed to get container status", exc_info=True) return { "status": "error", "uptime": None, "logs": [], "container_status": "error", "error": str(e) } + finally: + if docker_client is not None: + try: + docker_client.close() + except Exception: + pass
71-88: Standardize error handling and add a response model to /status.
Include traceback, return structured error detail, and type the response.-@router.get("/status") -async def get_status(): +@router.get("/status", response_model=ContainerStatusResponse) +async def get_status() -> ContainerStatusResponse: @@ - except Exception as e: - api_logger.error(f"MCP server status API failed - error={str(e)}") + except Exception as e: + api_logger.error("MCP server status API failed", exc_info=True) safe_set_attribute(span, "error", str(e)) - raise HTTPException(status_code=500, detail=str(e)) + raise HTTPException(status_code=500, detail={"error": str(e)})
90-133: Type the /config response and avoid hard-coding the transport in span.
Also keep structured errors (already good).-@router.get("/config") -async def get_mcp_config(): +@router.get("/config", response_model=McpConfigResponse) +async def get_mcp_config() -> McpConfigResponse: @@ - safe_set_attribute(span, "transport", "streamable-http") + safe_set_attribute(span, "transport", config["transport"])
161-189: Type /sessions response and normalize error handling.
Keep schema stable and include traceback on failures.-@router.get("/sessions") -async def get_mcp_sessions(): +@router.get("/sessions", response_model=McpSessionsResponse) +async def get_mcp_sessions() -> McpSessionsResponse: @@ - session_info = { - "active_sessions": 0, # TODO: Implement real session tracking - "session_timeout": 3600, # 1 hour default - } + session_info = McpSessionsResponse( + active_sessions=0, # TODO: Implement real session tracking + session_timeout=3600, + ) @@ - if status.get("status") == "running" and status.get("uptime"): - session_info["server_uptime_seconds"] = status["uptime"] + if status.get("status") == "running" and status.get("uptime"): + session_info.server_uptime_seconds = status["uptime"] @@ - return session_info + return session_info @@ - except Exception as e: - api_logger.error(f"Failed to get MCP sessions - error={str(e)}") + except Exception as e: + api_logger.error("Failed to get MCP sessions", exc_info=True) safe_set_attribute(span, "error", str(e)) - raise HTTPException(status_code=500, detail=str(e)) + raise HTTPException(status_code=500, detail={"error": str(e)})
191-202: Add a response model to /health for schema consistency.
Minor consistency win; no behavior change.-@router.get("/health") -async def mcp_health(): +@router.get("/health", response_model=HealthResponse) +async def mcp_health() -> HealthResponse: @@ - result = {"status": "healthy", "service": "mcp"} + result = HealthResponse(status="healthy", service="mcp")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts(1 hunks)archon-ui-main/src/features/mcp/services/mcpApi.ts(1 hunks)python/src/server/api_routes/mcp_api.py(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- archon-ui-main/src/features/mcp/services/mcpApi.ts
- archon-ui-main/src/features/mcp/hooks/useMcpQueries.ts
🧰 Additional context used
📓 Path-based instructions (4)
python/src/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/**/*.py: Fail fast on service startup failures (credentials, DB, or any service init) and crash with a clear error
Treat missing configuration (env vars/invalid settings) as fatal; abort startup
Do not mask database connection failures; surface them immediately
Authentication/authorization failures must halt the operation and be visible
Never accept corrupted/invalid data; let Pydantic raise and abort writes
If a critical dependency (required service) is unavailable, fail immediately
Reject data that would corrupt state (e.g., zero embeddings, null FKs, malformed JSON) rather than storing it
In batch/background/WebSocket-like event processing, continue processing but log detailed errors; do not crash the whole worker
On per-item failures during processing, skip the item entirely and do not persist partial/corrupted data; record error details
External API calls: retry with exponential backoff; on exhaustion, fail with a clear message naming the service and reason
Error messages must include operation context, relevant IDs/URLs/data, and preserve full stack traces (logging with exc_info=True)
Use specific exception types instead of catching generic Exception
Never return None/null to indicate failure; raise an exception with details
For batch operations, always report both success count and a detailed failure list
Target Python 3.12 and adhere to 120-character line length
Keep code lint-clean with Ruff (errors, warnings, unused imports)
Maintain static typing with MyPy across the backend
python/src/**/*.py: On service startup failures (missing creds, DB, or uninitialized services), crash fast with a clear error
Treat missing/invalid environment configuration as fatal and abort startup
Do not hide database connection failures; let them bubble up and fail fast
Authentication/authorization failures must halt the operation and be visible
Never accept or write corrupted data (e.g., zero embeddings, null FKs, malformed JSON)
If critical dependencies are unav...
Files:
python/src/server/api_routes/mcp_api.py
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not introduce WebSocket-based updates; architecture mandates HTTP polling with ETag caching
{archon-ui-main/src/**/*.{ts,tsx},python/src/**/*.py}: Never return None/null to signal failure; raise an exception (or reject) with details
Do not annotate comments with LEGACY, CHANGED, or REMOVED; write comments that document current functionality only
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/api_routes/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
python/src/server/api_routes/**/*.py: Follow route -> service -> database layering for FastAPI endpoints
Add new API routes under python/src/server/api_routes and include routers in python/src/server/main.pyImplement new API endpoints under python/src/server/api_routes and include router in python/src/server/main.py
Files:
python/src/server/api_routes/mcp_api.py
python/src/server/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Define and use specific exception classes and FastAPI exception handlers that return rich JSON errors
Files:
python/src/server/api_routes/mcp_api.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
🧬 Code graph analysis (1)
python/src/server/api_routes/mcp_api.py (1)
python/src/server/config/logfire_config.py (2)
safe_set_attribute(193-206)safe_span(151-172)
🔇 Additional comments (1)
python/src/server/api_routes/mcp_api.py (1)
4-6: Docstring alignment with container-managed lifecycle looks good.
No action.
- Remove 200+ lines of unused CSS classes (62% file size reduction) - Delete unused: glass classes, neon-dividers, card animations, screensaver animations - Remove unused knowledge-item-card and hide-scrollbar styles - Remove unused flip-card and card expansion animations - Update scrollbar-thin to match Tron theme with blue glow effects - Add gradient and glow effects to thin scrollbars for consistency - Keep only actively used styles: neon-grid, scrollbars, animation delays File reduced from 11.2KB to 4.3KB with no visual regressions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
archon-ui-main/src/index.css (2)
85-99: Reduce motion for accessibility and centralize color via tokens.Animating box-shadow is expensive; also respect
prefers-reduced-motion. Use your existing--blue-accenttoken instead of hardcoded RGBA.Apply this diff to use tokens:
- 0%, 100% { - box-shadow: 0 0 20px 10px rgba(59, 130, 246, 0.5), - 0 0 40px 20px rgba(59, 130, 246, 0.3); - } + 0%, 100% { + box-shadow: + 0 0 20px 10px hsl(var(--blue-accent) / 0.50), + 0 0 40px 20px hsl(var(--blue-accent) / 0.30); + } - 50% { - box-shadow: 0 0 30px 15px rgba(59, 130, 246, 0.7), - 0 0 60px 30px rgba(59, 130, 246, 0.4); - } + 50% { + box-shadow: + 0 0 30px 15px hsl(var(--blue-accent) / 0.70), + 0 0 60px 30px hsl(var(--blue-accent) / 0.40); + }Add this block nearby:
@media (prefers-reduced-motion: reduce) { .animate-pulse-glow { animation: none !important; } }
101-131: Firefox dark mode scrollbar color not overridden; unify color via tokens.You set
scrollbar-coloronly for light mode; Firefox in dark mode will keep the light value. Also replace RGBA literals with--blue-accent.Apply this diff:
- scrollbar-color: rgba(59, 130, 246, 0.3) transparent; + scrollbar-color: hsl(var(--blue-accent) / 0.30) transparent;- background-color: rgba(59, 130, 246, 0.3); + background-color: hsl(var(--blue-accent) / 0.30);- background-color: rgba(59, 130, 246, 0.5); + background-color: hsl(var(--blue-accent) / 0.50);- background-color: rgba(59, 130, 246, 0.4); + background-color: hsl(var(--blue-accent) / 0.40);- background-color: rgba(59, 130, 246, 0.6); + background-color: hsl(var(--blue-accent) / 0.60);Add this for Firefox dark mode:
.dark .custom-scrollbar { scrollbar-color: hsl(var(--blue-accent) / 0.45) transparent; }
🧹 Nitpick comments (1)
archon-ui-main/src/index.css (1)
133-170: Tron scrollbars: tighten transitions, add Firefox dark override, and use tokens.
- Avoid
transition: all; limit to properties you actually animate.- Provide
scrollbar-colordark override for Firefox.- Use
--blue-accentfor consistency.Apply this diff:
- scrollbar-color: rgba(59, 130, 246, 0.4) transparent; + scrollbar-color: hsl(var(--blue-accent) / 0.40) transparent;- background: linear-gradient(to bottom, rgba(59, 130, 246, 0.6), rgba(59, 130, 246, 0.3)); + background: linear-gradient( + to bottom, + hsl(var(--blue-accent) / 0.60), + hsl(var(--blue-accent) / 0.30) + );- box-shadow: 0 0 3px rgba(59, 130, 246, 0.4); - transition: all 0.2s ease; + box-shadow: 0 0 3px hsl(var(--blue-accent) / 0.40); + transition: background-color 0.2s ease, box-shadow 0.2s ease;- background: linear-gradient(to bottom, rgba(59, 130, 246, 0.8), rgba(59, 130, 246, 0.5)); + background: linear-gradient( + to bottom, + hsl(var(--blue-accent) / 0.80), + hsl(var(--blue-accent) / 0.50) + );- box-shadow: 0 0 6px rgba(59, 130, 246, 0.6), - inset 0 0 3px rgba(59, 130, 246, 0.3); + box-shadow: 0 0 6px hsl(var(--blue-accent) / 0.60), + inset 0 0 3px hsl(var(--blue-accent) / 0.30);- background: linear-gradient(to bottom, rgba(59, 130, 246, 0.5), rgba(59, 130, 246, 0.2)); + background: linear-gradient( + to bottom, + hsl(var(--blue-accent) / 0.50), + hsl(var(--blue-accent) / 0.20) + );- box-shadow: 0 0 4px rgba(59, 130, 246, 0.5); + box-shadow: 0 0 4px hsl(var(--blue-accent) / 0.50);- background: linear-gradient(to bottom, rgba(59, 130, 246, 0.7), rgba(59, 130, 246, 0.4)); + background: linear-gradient( + to bottom, + hsl(var(--blue-accent) / 0.70), + hsl(var(--blue-accent) / 0.40) + );- box-shadow: 0 0 8px rgba(59, 130, 246, 0.7), - inset 0 0 3px rgba(59, 130, 246, 0.4); + box-shadow: 0 0 8px hsl(var(--blue-accent) / 0.70), + inset 0 0 3px hsl(var(--blue-accent) / 0.40);Add this nearby:
.dark .scrollbar-thin { scrollbar-color: hsl(var(--blue-accent) / 0.50) transparent; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
archon-ui-main/src/index.css(5 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Use TanStack Query for all data fetching in features
📚 Learning: 2025-09-05T08:31:31.042Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-05T08:31:31.042Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx} : Frontend styling should follow Tron-inspired glassmorphism with Tailwind classes
Applied to files:
archon-ui-main/src/index.css
📚 Learning: 2025-09-05T08:32:31.811Z
Learnt from: CR
PR: coleam00/Archon#0
File: AGENTS.md:0-0
Timestamp: 2025-09-05T08:32:31.811Z
Learning: Applies to archon-ui-main/src/features/**/*.{ts,tsx,css} : Apply Tron-inspired glassmorphism styling with Tailwind CSS to features components
Applied to files:
archon-ui-main/src/index.css
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test Results Summary
🔇 Additional comments (2)
archon-ui-main/src/index.css (2)
33-33: Dark mode token set looks consistent with light mode.No action needed. Good parity of CSS custom properties across themes.
76-76: No-op change.Harmless whitespace-only edit.
|
@leex279 Things to test MCP server functionality New test setup and running FE tests Main layout and side menu is migrated |
- Fix neon-grid Tailwind @apply with arbitrary values (breaking build) - Convert hardcoded RGBA colors to HSL tokens using --blue-accent - Add prefers-reduced-motion accessibility support - Add Firefox dark mode scrollbar-color support - Optimize transitions to specific properties instead of 'all' 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
- Add finally block to ensure Docker client is closed - Prevents resource leak in get_container_status function - Fix linting issues (whitespace and newline) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
…ion (coleam00#588) * refactor: migrate layouts to TanStack Query and Radix UI patterns - Created new modern layout components in src/components/layout/ - Migrated from old MainLayout/SideNavigation to new system - Added BackendStatus component with proper separation of concerns - Fixed horizontal scrollbar issues in project list - Renamed old layouts folder to agent-chat for unused chat panel - Added layout directory to Biome configuration - Fixed all linting and TypeScript issues in new layout code - Uses TanStack Query for backend health monitoring - Temporarily imports old settings/credentials until full migration * test: reorganize test infrastructure with colocated tests in subdirectories - Move tests into dedicated tests/ subdirectories within each feature - Create centralized test utilities in src/features/testing/ - Update all import paths to match new structure - Configure tsconfig.prod.json to exclude test files - Remove legacy test files from old test/ directory - All 32 tests passing with proper provider wrapping * fix: use error boundary wrapper for ProjectPage - Export ProjectsViewWithBoundary from projects feature module - Update ProjectPage to use boundary-wrapped version - Provides proper error containment and recovery with TanStack Query integration * cleanup: remove unused MCP client components - Remove ToolTestingPanel, ClientCard, and MCPClients components - These were part of an unimplemented MCP clients feature - Clean up commented import in MCPPage - Preparing for proper MCP feature migration to features directory * cleanup: remove unused mcpService.ts - Remove duplicate/unused mcpService.ts (579 lines) - Keep mcpServerService.ts which is actively used by MCPPage and useMCPQueries - mcpService was never imported or used anywhere in the codebase * cleanup: remove unused mcpClientService and update deprecation comments - Remove mcpClientService.ts (445 lines) - no longer used after removing MCP client components - Update deprecation comments in mcpServerService to remove references to deleted service - This completes the MCP service cleanup * fix: correct test directory exclusion in coverage config Update coverage exclusion from 'test/' to 'tests/' to match actual project structure and ensure proper test file exclusion from coverage. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * docs: fix ArchonChatPanel import path in agent-chat.mdx Update import from deprecated layouts to agent-chat directory. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * refactor: improve backend health hook and types - Use existing ETag infrastructure in useBackendHealth for 70% bandwidth reduction - Honor React Query cancellation signals with proper timeout handling - Remove duplicate HealthResponse interface, import from shared types - Add React type import to fix potential strict TypeScript issues 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: remove .d.ts exclusion from production TypeScript config Removing **/*.d.ts exclusion to fix import.meta.env type errors in production builds. The exclusion was preventing src/env.d.ts from being included, breaking ImportMetaEnv interface definitions. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * feat: implement modern MCP feature architecture - Add new /features/mcp with TanStack Query integration - Components: McpClientList, McpStatusBar, McpConfigSection - Services: mcpApi with ETag caching - Hooks: useMcpStatus, useMcpConfig, useMcpClients, useMcpSessionInfo - Views: McpView with error boundary wrapper - Full TypeScript types for MCP protocol Part of TanStack Query migration phase 2. 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * refactor: complete MCP modernization and cleanup - Remove deprecated mcpServerService.ts (237 lines) - Remove unused useMCPQueries.ts hooks (77 lines) - Simplify MCPPage.tsx to use new feature architecture - Export useSmartPolling from ui/hooks for MCP feature - Add Python MCP API routes for backend integration This completes the MCP migration to TanStack Query with: - ETag caching for 70% bandwidth reduction - Smart polling with visibility awareness - Vertical slice architecture - Full TypeScript type safety 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: correct MCP transport mode display and complete cleanup - Fix backend API to return correct "streamable-http" transport mode - Update frontend to dynamically display transport type from config - Remove unused MCP functions (startMCPServer, stopMCPServer, getMCPServerStatus) - Clean up unused MCPServerResponse interface - Update log messages to show accurate transport mode - Complete aggressive MCP cleanup with 75% code reduction (617 lines removed) Backend changes: - python/src/server/api_routes/mcp_api.py: Fix transport and logs - Reduced from 818 to 201 lines while preserving all functionality Frontend changes: - McpStatusBar: Dynamic transport display based on config - McpView: Pass config to status bar component - api.ts: Remove unused MCP management functions All MCP tools tested and verified working after cleanup. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * simplify MCP API to status-only endpoints - Remove Docker container management functionality - Remove start/stop/restart endpoints - Simplify to status and config endpoints only - Container is now managed entirely via docker-compose * feat: complete MCP feature migration to TanStack Query - Add MCP feature with TanStack Query hooks and services - Create useMcpQueries hook with smart polling for status/config - Implement mcpApi service with streamable-http transport - Add MCP page component with real-time updates - Export MCP hooks from features/ui for global access - Fix logging bug in mcp_api.py (invalid error kwarg) - Update docker command to v2 syntax (docker compose) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: clean up unused CSS and unify Tron-themed scrollbars - Remove 200+ lines of unused CSS classes (62% file size reduction) - Delete unused: glass classes, neon-dividers, card animations, screensaver animations - Remove unused knowledge-item-card and hide-scrollbar styles - Remove unused flip-card and card expansion animations - Update scrollbar-thin to match Tron theme with blue glow effects - Add gradient and glow effects to thin scrollbars for consistency - Keep only actively used styles: neon-grid, scrollbars, animation delays File reduced from 11.2KB to 4.3KB with no visual regressions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: address CodeRabbit CSS review feedback - Fix neon-grid Tailwind @apply with arbitrary values (breaking build) - Convert hardcoded RGBA colors to HSL tokens using --blue-accent - Add prefers-reduced-motion accessibility support - Add Firefox dark mode scrollbar-color support - Optimize transitions to specific properties instead of 'all' 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> * fix: properly close Docker client to prevent resource leak - Add finally block to ensure Docker client is closed - Prevents resource leak in get_container_status function - Fix linting issues (whitespace and newline) 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
…ow (#588) createWorktreeForIssue was 125 lines of dead code superseded by WorktreeProvider. getDefaultBranch silently returned "master" when neither origin/HEAD nor origin/main existed, violating fail-fast. Changes: - Delete createWorktreeForIssue from worktree.ts and its export - Replace getDefaultBranch "master" fallback with actionable throw - Remove all createWorktreeForIssue tests from git.test.ts - Delete skipped PR review worktree tests from adapter.test.ts - Remove unused spy in command-handler.test.ts - Clean up unused imports (dirname, mkdirAsync) from worktree.ts Fixes #588
…ow (coleam00#588) createWorktreeForIssue was 125 lines of dead code superseded by WorktreeProvider. getDefaultBranch silently returned "master" when neither origin/HEAD nor origin/main existed, violating fail-fast. Changes: - Delete createWorktreeForIssue from worktree.ts and its export - Replace getDefaultBranch "master" fallback with actionable throw - Remove all createWorktreeForIssue tests from git.test.ts - Delete skipped PR review worktree tests from adapter.test.ts - Remove unused spy in command-handler.test.ts - Clean up unused imports (dirname, mkdirAsync) from worktree.ts Fixes coleam00#588
…ow (coleam00#588) createWorktreeForIssue was 125 lines of dead code superseded by WorktreeProvider. getDefaultBranch silently returned "master" when neither origin/HEAD nor origin/main existed, violating fail-fast. Changes: - Delete createWorktreeForIssue from worktree.ts and its export - Replace getDefaultBranch "master" fallback with actionable throw - Remove all createWorktreeForIssue tests from git.test.ts - Delete skipped PR review worktree tests from adapter.test.ts - Remove unused spy in command-handler.test.ts - Clean up unused imports (dirname, mkdirAsync) from worktree.ts Fixes coleam00#588
Summary
Complete TanStack Query migration phase 2 with aggressive modernization and cleanup of MCP infrastructure. This PR removes all deprecated code, modernizes the MCP feature with vertical slice architecture, and significantly reduces codebase complexity.
Changes Made
Frontend Modernization
/src/features/mcp/) with vertical slicesAggressive Cleanup
mcpServerService.ts- unused Docker managementuseMCPQueries.ts- broken hooks with TypeScript errorsmcpClientService.ts- duplicate functionalityClientCard,MCPClients,ToolTestingPanelapi.ts: Removed unused MCP functions and typesBackend Simplification
mcp_api.pyfrom 818 to 201 lines (75% reduction):MCPServerManagerclass (450+ lines)/start,/stop,/restart,/tools, POST/configBug Fixes (from CodeRabbit review)
Type of Change
Affected Services
Testing
Test Evidence
Checklist
Breaking Changes
None - all changes are internal refactoring. The MCP API endpoints remain unchanged for external consumers.
Additional Notes
Performance Improvements
Architecture Benefits
Commits Included (12)
9404bf4refactor: complete MCP modernization and cleanupf355c42feat: implement modern MCP feature architecture84f470ffix: remove .d.ts exclusion from production TypeScript config1687d70refactor: improve backend health hook and types02cc372docs: fix ArchonChatPanel import path4d9f53cfix: correct test directory exclusionbfdc2fdcleanup: remove unused mcpClientService6b50877cleanup: remove unused mcpService.ts5dc7a8bcleanup: remove unused MCP client components1dcecadfix: use error boundary wrapper for ProjectPage5bcee1atest: reorganize test infrastructure6f88689refactor: migrate layouts to TanStack QueryThis completes the TanStack Query migration phase 2, delivering a cleaner, more maintainable codebase with significant performance improvements.
Summary by CodeRabbit
New Features
Refactor
Tests
Documentation
Chores