Skip to content

Add improved development environment with backend in Docker and front…#330

Closed
zakstam wants to merge 13 commits intocoleam00:mainfrom
zakstam:improve-dev-environment
Closed

Add improved development environment with backend in Docker and front…#330
zakstam wants to merge 13 commits intocoleam00:mainfrom
zakstam:improve-dev-environment

Conversation

@zakstam
Copy link
Copy Markdown

@zakstam zakstam commented Aug 19, 2025

Summary

Improves the development experience by creating a hybrid setup where Python backend services run in Docker while the frontend runs locally, providing instant HMR and
faster iteration cycles.

Changes Made

  • Created dev.bat script that orchestrates the development environment startup
  • Added docker-compose.backend.yml for running only backend services in Docker
  • Updated frontend configuration to support local development with Docker backend
  • Fixed environment variable handling to use sensible defaults

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Affected Services

  • Frontend (React UI)
  • Server (FastAPI backend)
  • MCP Server (Model Context Protocol)
  • Agents (PydanticAI service)
  • Database (migrations/schema)
  • Docker/Infrastructure
  • Documentation site

Testing

  • All existing tests pass
  • Added new tests for new functionality
  • Manually tested affected user flows
  • Docker builds succeed for all services

Test Evidence

# Started development environment
.\dev.bat
# Backend services started successfully in Docker
# Frontend started locally on port 3737 with working HMR
# API proxy from frontend to backend working correctly

Checklist

- My code follows the service architecture patterns
- If using an AI coding assistant, I used the CLAUDE.md rules
- I have added tests that prove my fix/feature works
- All new and existing tests pass locally
- My changes generate no new warnings
- I have updated relevant documentation
- I have verified no regressions in existing features

Breaking Changes

None - This adds a new development workflow option without affecting the existing docker-compose setup.

Additional Notes

Benefits of this approach:

- Instant HMR: Frontend changes reflect immediately without Docker filesystem overhead
- Faster startup: Frontend starts in ~2 seconds vs 30+ seconds in Docker
- Better debugging: Native browser DevTools work seamlessly
- Reduced resource usage: No need to run frontend container

Usage:

Simply run .\dev.bat instead of docker-compose up. The script will:
1. Stop any running production containers to avoid port conflicts
2. Start backend services in Docker (with Python hot-reload)
3. Launch frontend locally in a new window
4. Provide the same ports as production (3737 for frontend, 8181 for API)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- New Features
- Unified Make-based workflow: make dev, dev-docker, stop, install, check, test, lint, clean.
- Configurable UI port (default 3737) and safer default API port (8181) when unset.
- Docker Compose profiles for selective startup; environment validation script.

- Bug Fixes
- More reliable MCP container detection and status handling.
- Improved Docker environment detection; aligned frontend dev port.

- Documentation
- README revamped with Make quick-start, prerequisites, port/hostname config, and troubleshooting.

- Tests
- Updated for new env vars and MCP client singleton API.

- Chores
- Standardized container names, ports, healthchecks; ignore /logs; streamlined UI Docker CMD.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

…end locally

- Created dev.bat script to run backend services in Docker and frontend locally
- Added docker-compose.backend.yml for backend-only Docker setup
- Updated package.json to run frontend on port 3737
- Fixed api.ts to use default port 8181 instead of throwing error
- Script automatically stops production containers to avoid port conflicts
- Provides instant HMR for frontend development
@zakstam
Copy link
Copy Markdown
Author

zakstam commented Aug 19, 2025

@coleam00 I would appreciate it if this is merged as soon as possible 🙏. There are no breaking changes.

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Aug 20, 2025

@zaksnet Thanks for this contribution! I really appreciate the work you put into setting up the development environment and its something that was on my list of things to do as well.

To keep things consistent across the project, we're standardizing on Makefiles for environment setup. Would you be open to converting this to a Makefile, or would you prefer if I handle the conversion? I can provide a starting template if that would help if needed

@zakstam
Copy link
Copy Markdown
Author

zakstam commented Aug 21, 2025

Sounds good @Wirasm, for as long as it solves the problem I'm in for it! Make files sound like a reasonable choice. I will work on an initial implementation.

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Aug 21, 2025

@zaksnet sounds good, when you have made the change from bat to make i will quickly test it and merge this in!

… for cross-platform support and enhanced commands
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 21, 2025

Walkthrough

Introduces a root Makefile with development/testing targets, adopts Docker Compose profiles, updates frontend ports/env handling, adds an environment validation script, revises README to a Make-centered workflow, adjusts UI API URL resolution and Vite Docker detection/port config, updates frontend Dockerfile, tweaks UI error text, adds /logs to .gitignore, and makes MCP container resolution dynamic.

Changes

Cohort / File(s) Summary
Dev workflow orchestration
Makefile, check-env.js, docker-compose.yml, README.md
Adds Make targets (install/check/dev/dev-docker/stop/test/lint/clean). Introduces Compose profiles (backend/frontend/full), standardizes container names, sets frontend port to 3737 with envs, and documents new workflows and prerequisites. Adds env validation script.
Frontend config & runtime
archon-ui-main/src/config/api.ts, archon-ui-main/vite.config.ts, archon-ui-main/Dockerfile
API URL now uses VITE_ARCHON_SERVER_PORT with default 8181 and info log. Vite detects Docker via /.dockerenv and makes UI port configurable (default 3737). Dockerfile exposes 3737 and runs npm run dev (host/port in package.json).
Frontend tests & copy
archon-ui-main/test/config/api.test.ts, archon-ui-main/src/components/BackendStartupError.tsx
Updates tests for new port env var and defaulting; switches MCP client tests to singleton mcpClientService. Adjusts user-facing copy to new container naming.
Backend MCP robustness
python/src/server/api_routes/mcp_api.py
Adds dynamic MCP container resolution with _resolve_container, removes fixed name, improves status handling across container lifecycle changes.
Repo hygiene
.gitignore
Ignores /logs/.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant MK as Makefile
  participant DC as docker-compose
  participant FE as Frontend (Vite)
  participant BE as Backend Services

  rect rgb(245,248,255)
  note over Dev,MK: Hybrid Mode (make dev)
  Dev->>MK: make check
  MK->>MK: run node check-env.js
  MK->>DC: compose --profile backend up -d
  MK->>FE: npm run dev (port=ARCHON_UI_PORT||3737)
  FE->>BE: Proxy API to archon-server:<VITE_ARCHON_SERVER_PORT||8181>
  end

  rect rgb(244,253,245)
  note over Dev,MK: Full Docker Mode (make dev-docker)
  Dev->>MK: make dev-docker
  MK->>DC: compose --profile full up -d
  DC->>FE: frontend on 3737
  DC->>BE: backend services up
  FE->>BE: API calls via service network
  end
Loading
sequenceDiagram
  autonumber
  participant API as MCPServerManager
  participant DOCK as Docker API
  participant MCP as archon-mcp (container)

  note over API: Initialization / Status Check
  API->>API: _resolve_container()
  API->>DOCK: find container "archon-mcp"
  alt found
    DOCK-->>API: container ref
    API->>API: cache name/ref
  else not found
    DOCK-->>API: none
    API-->>API: container=None, status=not_found
  end

  note over API,MCP: On status request
  API->>API: _get_container_status()
  alt ref missing or NotFound
    API->>API: _resolve_container() retry
  end
  API-->>API: return stable status + container_status
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

In burrows of Make I twitch my nose,
Compose profiles blossom where the service grows.
Ports hop to 3737, neat and spry,
MCP found even when containers fly.
Env checks thump a steady drum—
With logs ignored, I nibble, “dev, here I come!” 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@zakstam
Copy link
Copy Markdown
Author

zakstam commented Aug 21, 2025

I have tested this with windows and wsl (ubuntu) and everything works @Wirasm

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
README.md (1)

264-315: Document VITE_ variables required by the UI when ports/hostname change in hybrid mode.*

Users who change ARCHON_SERVER_PORT/HOST in the root .env need to mirror that to the UI (Vite) in hybrid dev. Without it, the UI will still default to 8181.

Append this note under “Configuring Custom Ports & Hostname”:

+> Note for Hybrid Development (frontend local, backend in Docker)
+>
+> If you change backend host/port in the root `.env`, also create/update `archon-ui-main/.env` so the UI can reach the backend:
+>
+> ```bash
+> # archon-ui-main/.env
+> VITE_API_URL= http://$HOST:$ARCHON_SERVER_PORT        # strongest override
+> # or, if you prefer constructing from window.location with a custom port:
+> VITE_ARCHON_SERVER_PORT=$ARCHON_SERVER_PORT
+> # optional host override (rarely needed; defaults to window.location.hostname)
+> VITE_ARCHON_SERVER_HOST=$HOST
+> ```
+>
+> Alternatively, keep UI calls relative to `/api` and configure a Vite dev proxy to the backend.

I can add a short “Troubleshooting: UI can’t reach API on custom port” section if you want.

🧹 Nitpick comments (12)
archon-ui-main/package.json (1)

7-7: Dev server change is fine; consider using the local vite binary and env-driven port/host.

  • Using --host without a value binds to 0.0.0.0, which is likely intended for LAN testing. Good.
  • Minor: prefer the local vite binary over npx vite to avoid version drift and the npx spawn overhead.
  • Optional: the README advertises configurable UI ports via .env, but this hardcodes 3737. Either pass the port from Make (recommended—see Makefile comment) or read it in vite.config.ts.

Apply either of these diffs:

Option A — use local vite:

-    "dev": "npx vite --port 3737 --host",
+    "dev": "vite --port 3737 --host",

Option B — keep script minimal and move configurability to vite.config.ts (recommended for cross‑platform):

  • In vite.config.ts (new or existing), load env and set server host/port:
// vite.config.ts
import { defineConfig, loadEnv } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig(({ mode }) => {
  const env = loadEnv(mode, process.cwd(), '');
  const port = Number(env.ARCHON_UI_PORT || 3737);
  const host = env.HOST ? env.HOST : true; // true -> 0.0.0.0
  return {
    plugins: [react()],
    server: { port, host },
  };
});

Then you can simplify the script to:

-    "dev": "npx vite --port 3737 --host",
+    "dev": "vite",
archon-ui-main/src/config/api.ts (1)

23-26: Allow host override via VITE_ARCHON_SERVER_HOST and update documentation

To ensure full configurability of the API URL (especially in hybrid or non-default setups), let’s add an optional host override in getApiUrl() and clearly document all VITE-prefixed environment variables in the README.

• archon-ui-main/src/config/api.ts
– Replace the hard-coded window.location.hostname with an override from VITE_ARCHON_SERVER_HOST.
• README.md
– Under “Configuration” (or wherever you describe environment variables), add a note that if users deviate from the defaults (port 8181 or current host), they must define one of:
• VITE_API_URL
• VITE_ARCHON_SERVER_PORT
• VITE_ARCHON_SERVER_HOST
in archon-ui-main/.env.

Suggested code change in src/config/api.ts:

   // Fallback: build URL from current host
   const protocol = window.location.protocol;
-  const host = window.location.hostname;
+  const host = import.meta.env.VITE_ARCHON_SERVER_HOST || window.location.hostname;
   // Try VITE_ prefixed env var first, then fallback to default
   const port = import.meta.env.VITE_ARCHON_SERVER_PORT || '8181';
   
   return `${protocol}//${host}:${port}`;
docker-compose.backend.yml (3)

31-34: Mounting the Docker socket in the server container is a large attack surface.

Binding /var/run/docker.sock grants root-equivalent control over the host Docker daemon. If hot-reload is your only goal, it isn’t needed—uvicorn --reload with mounted source is sufficient.

Apply this diff to drop the socket mount:

     volumes:
-      - /var/run/docker.sock:/var/run/docker.sock
       - ./python/src:/app/src  # Hot reload for Python
       - ./python/tests:/app/tests

If you still need it for a specific dev workflow, gate it behind an env flag:

     volumes:
-      - /var/run/docker.sock:/var/run/docker.sock
+      - ${MOUNT_DOCKER_SOCK:-}:/var/run/docker.sock

…and document MOUNT_DOCKER_SOCK=/var/run/docker.sock only for trusted machines.


35-40: Healthcheck is fine; consider more generous start_period for first build.

Initial dependency download + migration may exceed 20s on cold builds. Bumping start_period to ~45–60s reduces false negatives.

-      start_period: 20s
+      start_period: 60s

107-109: Add trailing newline at EOF to appease linters.

YAML linter flagged “no new line character at the end of file.”

README.md (2)

76-88: Keep “Agents” status consistent (Compose already includes it).

Docs say “Agents (coming soon!)” but docker-compose.backend.yml defines and starts backend-agents. Align the wording.

-   - **Agents (coming soon!)**: AI operations and streaming (Port: 8052)
+   - **Agents**: AI operations and streaming (Port: 8052)

96-108: Quick Command Reference rendering issues and minor grammar nits.

The table renders correctly but the grammar lints stem from missing punctuation before/after the table in some Markdown renderers. Adding blank lines above/below tables typically resolves noisy linters.

Makefile (5)

4-4: Declare missing PHONY targets and add a conventional ‘all’ target.

  • restart and pattern targets like logs-% should be PHONY.
  • Conventional all target helps tooling.
    This also addresses the checkmake warnings.
-.PHONY: help dev dev-hybrid dev-docker prod build test clean clean-confirm deep-clean deep-clean-confirm stop logs status install check-env
+.PHONY: \
+  all help \
+  dev dev-hybrid dev-docker prod build \
+  test test-frontend test-backend test-coverage \
+  clean clean-confirm deep-clean deep-clean-confirm \
+  stop stop-prod logs logs-% status restart \
+  install check-frontend-deps check-env \
+  backend frontend \
+  lint-frontend lint-backend typecheck format pre-commit \
+  health watch-backend watch-mcp watch-agents \
+  shell-backend shell-mcp migrate backup-db
+
+all: help

81-87: Use env-aware UI URL in messages.

Reflect .env overrides in the output.

-	@echo "UI available at: http://localhost:3737"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "UI available at: http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"

Apply similarly in the prod target.


111-127: Backend tests rely on ‘uv’; add a soft check or fallback for new contributors.

A quick guard improves DX on machines without uv.

 test-backend:
 	@echo "Running backend tests..."
-	@cd python && uv run pytest
+	@cd python && (command -v uv >/dev/null 2>&1 && uv run pytest || python -m pytest)

192-198: Status output: use env-aware UI URL.

-	@echo "Check http://localhost:3737 for frontend status"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "Check http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737} for frontend status"

224-230: Health endpoint hints: print env-aware URLs for copy-paste.

-	@echo "API Server: http://localhost:8181/health"
-	@echo "MCP Server: http://localhost:8051/health"
-	@echo "Agents Service: http://localhost:8052/health"
-	@echo "Frontend: http://localhost:3737"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "API Server:     http://$${HOST:-localhost}:$${ARCHON_SERVER_PORT:-8181}/health"; \
+	echo "MCP Server:     http://$${HOST:-localhost}:$${ARCHON_MCP_PORT:-8051}/health"; \
+	echo "Agents Service: http://$${HOST:-localhost}:$${ARCHON_AGENTS_PORT:-8052}/health"; \
+	echo "Frontend:       http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b5e5cdd and 85957c1.

📒 Files selected for processing (5)
  • Makefile (1 hunks)
  • README.md (5 hunks)
  • archon-ui-main/package.json (1 hunks)
  • archon-ui-main/src/config/api.ts (1 hunks)
  • docker-compose.backend.yml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}

📄 CodeRabbit inference engine (CLAUDE.md)

{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}: Remove dead code immediately; do not keep legacy/unused functions
Avoid comments that reference change history (e.g., LEGACY, CHANGED, REMOVED); keep comments focused on current functionality

Files:

  • archon-ui-main/src/config/api.ts
🧠 Learnings (1)
📚 Learning: 2025-08-21T11:22:33.541Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-21T11:22:33.541Z
Learning: Applies to .env : Require SUPABASE_URL and SUPABASE_SERVICE_KEY in the .env file; optionally OPENAI_API_KEY, LOGFIRE_TOKEN, LOG_LEVEL

Applied to files:

  • README.md
🪛 YAMLlint (1.37.1)
docker-compose.backend.yml

[error] 109-109: no new line character at the end of file

(new-line-at-end-of-file)

🪛 markdownlint-cli2 (0.17.2)
README.md

46-46: Link fragments should be valid

(MD051, link-fragments)

🪛 LanguageTool
README.md

[grammar] ~83-~83: There might be a mistake here.
Context: ...starts all core microservices in Docker: - Server: Core API and business logic (P...

(QB_NEW_EN)


[grammar] ~96-~96: There might be a mistake here.
Context: ... website ### 🚀 Quick Command Reference | Command | Description | |---------|----...

(QB_NEW_EN)


[grammar] ~98-~98: There might be a mistake here.
Context: ...and Reference | Command | Description | |---------|-------------| | make dev |...

(QB_NEW_EN)


[grammar] ~99-~99: There might be a mistake here.
Context: ... Description | |---------|-------------| | make dev | Start hybrid dev environm...

(QB_NEW_EN)


[grammar] ~100-~100: There might be a mistake here.
Context: ...nt (backend in Docker, frontend local) | | make prod | Start production environ...

(QB_NEW_EN)


[grammar] ~101-~101: There might be a mistake here.
Context: ...production environment (all in Docker) | | make install | Install all dependenc...

(QB_NEW_EN)


[grammar] ~102-~102: There might be a mistake here.
Context: ...ke install| Install all dependencies | |make test| Run all tests | |make ...

(QB_NEW_EN)


[grammar] ~103-~103: There might be a mistake here.
Context: ...encies | | make test | Run all tests | | make stop | Stop all services | | `m...

(QB_NEW_EN)


[grammar] ~104-~104: There might be a mistake here.
Context: ...ts | | make stop | Stop all services | | make logs | View service logs | | `m...

(QB_NEW_EN)


[grammar] ~105-~105: There might be a mistake here.
Context: ...es | | make logs | View service logs | | make status | Check service status |...

(QB_NEW_EN)


[grammar] ~106-~106: There might be a mistake here.
Context: ...| make status | Check service status | | make help | Show all available comma...

(QB_NEW_EN)


[grammar] ~135-~135: There might be a mistake here.
Context: ...ing.

## 🛠️ Installing Make Make is required for the development work...

(QB_NEW_EN)


[grammar] ~338-~338: There might be a mistake here.
Context: ...nt Modes #### Hybrid Mode (Recommended) Best for active development with instant...

(QB_NEW_EN)


[grammar] ~349-~349: There might be a mistake here.
Context: ...t Docker rebuilds #### Full Docker Mode For testing production-like environment:...

(QB_NEW_EN)


[grammar] ~357-~357: There might be a mistake here.
Context: ...es rebuild) #### Manual Service Control Start individual services: ```bash make ...

(QB_NEW_EN)

🪛 checkmake (0.2.2)
Makefile

[warning] 200-200: Target "restart" should be declared PHONY.

(phonydeclared)


[warning] 7-7: Target body for "help" exceeds allowed length of 5 (27).

(maxbodylength)


[warning] 136-136: Target body for "clean" exceeds allowed length of 5 (14).

(maxbodylength)


[warning] 4-4: Missing required phony target "all"

(minphony)

🔇 Additional comments (3)
README.md (1)

318-334: Great developer UX section. Minor polish: cross-reference “make help” earlier.

The Quick Commands list is clear and matches the Makefile. No action required—just noting the good alignment.

Makefile (2)

98-103: Nice: defensive downing of both compose projects before dev.

This avoids stale networks/ports. No change requested.


200-201: Declare restart as PHONY (and it’s a handy alias).

Change already covered by the PHONY expansion above. No further action.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread README.md
…update test commands for frontend and backend
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (2)
README.md (2)

42-47: Add Node.js and Python/uv to prerequisites.

The workflow runs the frontend locally with npm and installs backend deps with uv. Please list these explicitly to prevent setup failures.

Apply this diff to extend Prerequisites:

 ### Prerequisites
 - [Docker Desktop](https://www.docker.com/products/docker-desktop/)
 - [Supabase](https://supabase.com/) account (free tier or local Supabase both work)
 - [OpenAI API key](https://platform.openai.com/api-keys) (Gemini and Ollama are supported too!)
 - [Make](https://www.gnu.org/software/make/) (see [Installing Make](#installing-make) below)
+- [Node.js 18+ and npm](https://nodejs.org/) (frontend dev server, tests, lint)
+- [Python 3.11+](https://www.python.org/) and [uv](https://github.com/astral-sh/uv) (backend tests/linting locally; optional in Hybrid Mode)

83-90: Doc-code mismatch in Hybrid Mode: .env ports aren’t applied to the local frontend

The README states that “Ports are configurable in your .env as well,” but the dev-hybrid Makefile target (Makefile:55–58) only starts the backend via Docker and doesn’t export the ARCHON_SERVER_HOST or ARCHON_SERVER_PORT (as VITE_ARCHON_SERVER_HOST / VITE_ARCHON_SERVER_PORT) into Vite. As a result, changing those variables in .env has no effect on the frontend during local development, contradicting the documentation (README.md:83–90).

Locations to address:

  • Makefile (lines 55–58): no export VITE_ARCHON_SERVER_HOST / VITE_ARCHON_SERVER_PORT before running Vite
  • README.md (lines 83–90): claims ports are configurable in Hybrid Mode

Options for fixing:

  • Wire through env vars: Modify dev-hybrid to export the VITE-prefixed variables, e.g.:
     dev-hybrid: stop-prod check-env check-frontend-deps
     	@echo "Starting hybrid development environment..."
     	@echo "Backend services in Docker, Frontend running locally"
  • @export VITE_ARCHON_SERVER_HOST=$${ARCHON_SERVER_HOST}
    
  • @export VITE_ARCHON_SERVER_PORT=$${ARCHON_SERVER_PORT}
    @docker-compose -p archon-backend -f docker-compose.backend.yml up -d --build
    
  • Amend the docs: Clarify in README.md that custom ports only apply when all services—including the UI—run in Docker (e.g. under make dev-docker), and Hybrid Mode uses the default host/port.

Please let me know which approach you’d like implemented, or if you’d prefer a combination of both.

♻️ Duplicate comments (2)
README.md (1)

366-378: Replace subdirectory commands with top-level Make targets.

To keep UX consistent and avoid requiring users to cd into subfolders, prefer Make targets you already expose. The optional direct commands can stay as alternates.

 # Frontend tests
 make test-frontend
-cd archon-ui-main && npm run test:coverage
+make test-coverage   # (Frontend coverage)
@@
 # Backend tests
 make test-backend
-# (Optional) run directly via uv
-cd python && uv run pytest
+# (Optional) run directly via uv)
+# cd python && uv run pytest
Makefile (1)

55-77: Hybrid dev: honor env-configured ports and pass them to Vite.

Make the console output and frontend launch reflect .env overrides; export VITE_* so the UI hits the right API.

 dev-hybrid: stop-prod check-env check-frontend-deps
 	@echo "Starting hybrid development environment..."
 	@echo "Backend services in Docker, Frontend running locally"
 	@docker-compose -p archon-backend -f docker-compose.backend.yml up -d --build
 	@echo ""
 	@echo "====================================================="
 	@echo "Development Environment Ready!"
 	@echo "====================================================="
 	@echo ""
 	@echo "Backend Services in Docker:"
-	@echo "  API Server:     http://localhost:8181"
-	@echo "  MCP Server:     http://localhost:8051"
-	@echo "  Agents Service: http://localhost:8052"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "  API Server:     http://$${HOST:-localhost}:$${ARCHON_SERVER_PORT:-8181}"; \
+	echo "  MCP Server:     http://$${HOST:-localhost}:$${ARCHON_MCP_PORT:-8051}"; \
+	echo "  Agents Service: http://$${HOST:-localhost}:$${ARCHON_AGENTS_PORT:-8052}";
 	@echo ""
 	@echo "Starting frontend server..."
 	@echo ""
 	@echo "Commands (in another terminal):"
 	@echo "  make logs       - View all logs"
 	@echo "  make stop       - Stop everything"
 	@echo "  make status     - Check service status"
 	@echo ""
-	@cd archon-ui-main && npm run dev
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	cd archon-ui-main && \
+	VITE_ARCHON_SERVER_HOST=$${HOST:-localhost} \
+	VITE_ARCHON_SERVER_PORT=$${ARCHON_SERVER_PORT:-8181} \
+	npm run dev
🧹 Nitpick comments (9)
README.md (3)

96-108: Tweak Quick Command table to include coverage and clarity.

Since a top-level test-coverage target exists (frontend), add it here to keep guidance consistent.

 | `make test` | Run all tests |
+| `make test-coverage` | Frontend tests with coverage |
 | `make stop` | Stop all services |

311-315: Prefer Make targets for consistency.

You already provide a restart target. Recommend referencing it here so users don’t mix raw docker-compose with Make.

-1. Restart Docker containers: `docker-compose down && docker-compose up -d`
+1. Restart services: `make restart`

135-166: Install instructions: add Node and uv installation pointers.

You have great Make install steps. Add brief pointers for Node and uv to match the new prerequisites and reduce friction on Windows/WSL.

 ### Windows
 ```bash
 # Option 1: Using Chocolatey
 choco install make
+# Install Node.js
+choco install nodejs-lts
+# Install uv (optional for hybrid; useful for backend tests/lint)
+powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"
 
 # Option 2: Using Scoop
 scoop install make
+scoop install nodejs-lts
+# uv via PowerShell:
+powershell -Command "irm https://astral.sh/uv/install.ps1 | iex"
 
 # Option 3: Using WSL2
 wsl --install
 # Then in WSL: sudo apt-get install make
+# And: sudo apt-get install -y nodejs npm python3 python3-pip
+# uv: curl -LsSf https://astral.sh/uv/install.sh | sh

</blockquote></details>
<details>
<summary>Makefile (6)</summary><blockquote>

`4-4`: **Declare missing PHONY targets (and add “all” alias).**

Several targets aren’t listed, and tools warn about minphony/all/restart. Adding these reduces surprising rebuilds when files named like targets exist.


```diff
-.PHONY: help dev dev-hybrid dev-docker prod build test clean clean-confirm deep-clean deep-clean-confirm stop logs status install check-env
+.PHONY: \
+  all help \
+  dev dev-hybrid dev-docker prod backend frontend \
+  build install check-env stop stop-prod restart \
+  test test-frontend test-backend test-coverage \
+  logs logs-% status health watch-backend watch-mcp watch-agents \
+  lint-frontend lint-backend typecheck format pre-commit \
+  clean clean-confirm deep-clean deep-clean-confirm \
+  shell-backend shell-mcp migrate backup-db
+
+all: help

79-91: Full Docker messaging: make it env-aware (UI port).

If ARCHON_UI_PORT is changed, the printed URL is wrong.

 dev-docker:
@@
-	@echo "UI available at: http://localhost:3737"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "UI available at: http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"
@@
 prod:
@@
-	@echo "UI available at: http://localhost:3737"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "UI available at: http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"

196-202: Status message: avoid hardcoded UI port.

Keep the output consistent with .env overrides.

-	@echo "Check http://localhost:3737 for frontend status"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "Check http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737} for frontend status"

228-234: Health URLs: use configured host/ports.

This aligns the health target with the doc promise that ports are configurable.

 health:
 	@echo "Checking service health..."
-	@echo "API Server: http://localhost:8181/health"
-	@echo "MCP Server: http://localhost:8051/health"
-	@echo "Agents Service: http://localhost:8052/health"
-	@echo "Frontend: http://localhost:3737"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "API Server: http://$${HOST:-localhost}:$${ARCHON_SERVER_PORT:-8181}/health"; \
+	echo "MCP Server: http://$${HOST:-localhost}:$${ARCHON_MCP_PORT:-8051}/health"; \
+	echo "Agents Service: http://$${HOST:-localhost}:$${ARCHON_AGENTS_PORT:-8052}/health"; \
+	echo "Frontend: http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"

187-194: Nice: logs/logs-% targets for backend.

Targets are straightforward and scoped to the backend compose project. Consider documenting that UI logs aren’t included here when running full Docker mode.


114-126: Tests wiring looks good; consider adding backend coverage target.

You have a frontend coverage target; if backend coverage is desired, add a companion for pytest-cov and reference it in README.

 # Run backend tests
 test-backend:
 	@echo "Running backend tests..."
 	@cd python && uv run pytest
+
+# Run backend tests with coverage (requires pytest-cov in backend deps)
+test-backend-coverage:
+	@echo "Running backend tests with coverage..."
+	@cd python && uv run pytest --cov=src --cov-report=term-missing
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 85957c1 and ccd464c.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • README.md (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-21T11:22:33.541Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-21T11:22:33.541Z
Learning: Applies to .env : Require SUPABASE_URL and SUPABASE_SERVICE_KEY in the .env file; optionally OPENAI_API_KEY, LOGFIRE_TOKEN, LOG_LEVEL

Applied to files:

  • Makefile
  • README.md
📚 Learning: 2025-08-21T11:22:33.541Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-21T11:22:33.541Z
Learning: Applies to archon-ui-main/test/** : Place frontend tests under archon-ui-main/test/

Applied to files:

  • README.md
🪛 checkmake (0.2.2)
Makefile

[warning] 7-7: Target body for "help" exceeds allowed length of 5 (27).

(maxbodylength)


[warning] 140-140: Target body for "clean" exceeds allowed length of 5 (14).

(maxbodylength)


[warning] 4-4: Missing required phony target "all"

(minphony)


[warning] 204-204: Target "restart" should be declared PHONY.

(phonydeclared)

🪛 markdownlint-cli2 (0.17.2)
README.md

46-46: Link fragments should be valid

(MD051, link-fragments)

🪛 LanguageTool
README.md

[grammar] ~83-~83: There might be a mistake here.
Context: ...starts all core microservices in Docker: - Server: Core API and business logic (P...

(QB_NEW_EN)


[grammar] ~96-~96: There might be a mistake here.
Context: ... website ### 🚀 Quick Command Reference | Command | Description | |---------|----...

(QB_NEW_EN)


[grammar] ~98-~98: There might be a mistake here.
Context: ...and Reference | Command | Description | |---------|-------------| | make dev |...

(QB_NEW_EN)


[grammar] ~99-~99: There might be a mistake here.
Context: ... Description | |---------|-------------| | make dev | Start hybrid dev environm...

(QB_NEW_EN)


[grammar] ~100-~100: There might be a mistake here.
Context: ...nt (backend in Docker, frontend local) | | make prod | Start production environ...

(QB_NEW_EN)


[grammar] ~101-~101: There might be a mistake here.
Context: ...production environment (all in Docker) | | make install | Install all dependenc...

(QB_NEW_EN)


[grammar] ~102-~102: There might be a mistake here.
Context: ...ke install| Install all dependencies | |make test| Run all tests | |make ...

(QB_NEW_EN)


[grammar] ~103-~103: There might be a mistake here.
Context: ...encies | | make test | Run all tests | | make stop | Stop all services | | `m...

(QB_NEW_EN)


[grammar] ~104-~104: There might be a mistake here.
Context: ...ts | | make stop | Stop all services | | make logs | View service logs | | `m...

(QB_NEW_EN)


[grammar] ~105-~105: There might be a mistake here.
Context: ...es | | make logs | View service logs | | make status | Check service status |...

(QB_NEW_EN)


[grammar] ~106-~106: There might be a mistake here.
Context: ...| make status | Check service status | | make help | Show all available comma...

(QB_NEW_EN)


[grammar] ~135-~135: There might be a mistake here.
Context: ...ing.

## 🛠️ Installing Make Make is required for the development work...

(QB_NEW_EN)


[grammar] ~338-~338: There might be a mistake here.
Context: ...nt Modes #### Hybrid Mode (Recommended) Best for active development with instant...

(QB_NEW_EN)


[grammar] ~349-~349: There might be a mistake here.
Context: ...t Docker rebuilds #### Full Docker Mode For testing production-like environment:...

(QB_NEW_EN)


[grammar] ~357-~357: There might be a mistake here.
Context: ...es rebuild) #### Manual Service Control Start individual services: ```bash make ...

(QB_NEW_EN)

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment on lines +47 to +50
# Verify required env vars exist - using Node.js for cross-platform compatibility
check-env:
@node -e "const fs=require('fs'); if(!fs.existsSync('.env')){console.error('ERROR: .env file not found! Create one from .env.example');process.exit(1);} const env=fs.readFileSync('.env','utf8'); const missing=[]; if(!env.includes('SUPABASE_URL=')){missing.push('SUPABASE_URL');} if(!env.includes('SUPABASE_SERVICE_KEY=')){missing.push('SUPABASE_SERVICE_KEY');} if(missing.length>0){console.error('ERROR: Missing required env vars: '+missing.join(', '));process.exit(1);} console.log('Environment OK: SUPABASE_URL and SUPABASE_SERVICE_KEY found.');"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Make env check robust and fail early if Node is missing.

The current check-env passes when variables are present but empty or commented out. Also, it assumes Node is available. Tighten both.

 check-env:
-	@node -e "const fs=require('fs'); if(!fs.existsSync('.env')){console.error('ERROR: .env file not found! Create one from .env.example');process.exit(1);} const env=fs.readFileSync('.env','utf8'); const missing=[]; if(!env.includes('SUPABASE_URL=')){missing.push('SUPABASE_URL');} if(!env.includes('SUPABASE_SERVICE_KEY=')){missing.push('SUPABASE_SERVICE_KEY');} if(missing.length>0){console.error('ERROR: Missing required env vars: '+missing.join(', '));process.exit(1);} console.log('Environment OK: SUPABASE_URL and SUPABASE_SERVICE_KEY found.');"
+	@node -v >/dev/null 2>&1 || { echo "ERROR: Node.js is required for check-env. Please install Node 18+."; exit 1; }
+	@node -e "const fs=require('fs'); const path='.env'; \
+if(!fs.existsSync(path)){ console.error('ERROR: .env not found. Copy .env.example to .env'); process.exit(1);} \
+const lines=fs.readFileSync(path,'utf8').split(/\r?\n/).filter(l=>!l.trim().startsWith('#')); \
+const kv=Object.fromEntries(lines.map(l=>l.split('=').map(s=>s.trim())).filter(a=>a.length>=2)); \
+const need=['SUPABASE_URL','SUPABASE_SERVICE_KEY']; \
+const missing=need.filter(k=>!(k in kv) || !kv[k]); \
+if(missing.length){ console.error('ERROR: Missing required env vars: '+missing.join(', ')); process.exit(1);} \
+console.log('Environment OK: SUPABASE_URL and SUPABASE_SERVICE_KEY found.');"
📝 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.

Suggested change
# Verify required env vars exist - using Node.js for cross-platform compatibility
check-env:
@node -e "const fs=require('fs'); if(!fs.existsSync('.env')){console.error('ERROR: .env file not found! Create one from .env.example');process.exit(1);} const env=fs.readFileSync('.env','utf8'); const missing=[]; if(!env.includes('SUPABASE_URL=')){missing.push('SUPABASE_URL');} if(!env.includes('SUPABASE_SERVICE_KEY=')){missing.push('SUPABASE_SERVICE_KEY');} if(missing.length>0){console.error('ERROR: Missing required env vars: '+missing.join(', '));process.exit(1);} console.log('Environment OK: SUPABASE_URL and SUPABASE_SERVICE_KEY found.');"
# Verify required env vars exist - using Node.js for cross-platform compatibility
check-env:
@node -v >/dev/null 2>&1 || { echo "ERROR: Node.js is required for check-env. Please install Node 18+."; exit 1; }
@node -e "const fs=require('fs'); const path='.env'; \
if(!fs.existsSync(path)){ console.error('ERROR: .env not found. Copy .env.example to .env'); process.exit(1);} \
const lines=fs.readFileSync(path,'utf8').split(/\r?\n/).filter(l=>!l.trim().startsWith('#')); \
const kv=Object.fromEntries(lines.map(l=>l.split('=').map(s=>s.trim())).filter(a=>a.length>=2)); \
const need=['SUPABASE_URL','SUPABASE_SERVICE_KEY']; \
const missing=need.filter(k=>!(k in kv) || !kv[k]); \
if(missing.length){ console.error('ERROR: Missing required env vars: '+missing.join(', ')); process.exit(1);} \
console.log('Environment OK: SUPABASE_URL and SUPABASE_SERVICE_KEY found.');"
🤖 Prompt for AI Agents
In Makefile around lines 47 to 50, the make target check-env currently assumes
Node exists and only checks for substrings so it can miss empty or commented
variables; update the target to first verify Node is installed and fail
immediately if not, then read and parse .env robustly by ignoring comment lines
and whitespace, extracting key=value pairs, and ensuring SUPABASE_URL and
SUPABASE_SERVICE_KEY are present and have non-empty values (not just present as
commented or empty strings); on any failure emit a clear error and exit
non-zero.

This commit enhances the development workflow by replacing the separate
docker-compose.backend.yml file with Docker Compose profiles, fixing
critical service discovery issues, and adding comprehensive developer
tooling through an improved Makefile system.

Key improvements:
- Replace docker-compose.backend.yml with cleaner profile approach
- Fix service discovery by maintaining consistent container names
- Fix port mappings (3737:3737 instead of 3737:5173)
- Add make doctor for environment validation
- Fix port configuration and frontend HMR
- Improve error handling with .SHELLFLAGS in Makefile
- Add comprehensive port configuration via environment variables
- Simplify make dev-local to only run essential services
- Add logging directory creation for local development
- Document profile strategy in docker-compose.yml

These changes provide three flexible development modes:
- Hybrid mode (default): Backend in Docker, frontend local with HMR
- Docker mode: Everything in Docker for production-like testing
- Local mode: API server and UI run locally

Co-authored-by: Zak Stam <zaksnet@users.noreply.github.com>
Wirasm and others added 9 commits August 22, 2025 10:29
- Resolved Dockerfile conflict: kept our version with --host in package.json
- Resolved README conflicts: kept hybrid development mode documentation
The stop command now explicitly specifies all profiles to ensure
all containers are stopped regardless of how they were started.
- Changed 'make lint' to 'make lint-frontend' and 'make lint-backend'
- Removed non-existent 'make logs-server' command
- Added 'make watch-mcp' and 'make watch-agents' commands
- All documented make commands now match what's available in Makefile
- Create robust environment validation script (check-env.js) that properly parses .env files
- Fix Docker healthcheck port mismatch (5173 -> 3737)
- Remove hard-coded port flags from package.json to allow environment configuration
- Fix Docker detection logic using /.dockerenv instead of HOSTNAME
- Normalize container names to lowercase (archon-server, archon-mcp, etc.)
- Improve stop-local command with port-based fallback for process killing
- Fix API configuration fallback chain to include VITE_PORT
- Fix Makefile shell variable expansion using runtime evaluation
- Update .PHONY targets with comprehensive list
- Add --profile flags to Docker Compose commands in README
- Add VITE_ARCHON_SERVER_PORT to docker-compose.yml
- Add Node.js 18+ to prerequisites
- Use dynamic ports in Makefile help messages
- Add lint alias combining frontend and backend linting
- Update .env.example documentation
- Scope .gitignore logs entry to /logs/

Co-Authored-By: Claude <noreply@anthropic.com>
- Add dynamic container name resolution with three-tier strategy
- Support environment variables for custom container names
- Add service discovery labels to docker-compose services
- Update BackendStartupError with correct container name references
- Update environment variable names to use VITE_ prefix that matches production code
- Fix MCP client service tests to use singleton instance export
- Update default behavior tests to expect fallback to port 8181
- All 77 frontend tests now pass
Replace aggressive kill -9 with targeted process termination:
- Filter processes by command name (node/vite/python/uvicorn) before killing
- Use graceful SIGTERM instead of SIGKILL
- Add process verification to avoid killing Docker-related processes
- Improve logging with descriptive step messages
- Reduced Makefile from 344 lines (43 targets) to 83 lines (8 essential targets)
- Removed unnecessary environment variables (*_CONTAINER_NAME variables)
- Fixed Windows compatibility by removing Unix-specific commands
- Added security fixes to check-env.js (path validation)
- Simplified MCP container discovery to use fixed container names
- Fixed 'make stop' to properly handle Docker Compose profiles
- Updated documentation to reflect simplified workflow
- Restored original .env.example with comprehensive Supabase key documentation

This addresses all critical issues from code review:
- Cross-platform compatibility ✅
- Security vulnerabilities fixed ✅
- 81% reduction in complexity ✅
- Maintains all essential functionality ✅

All tests pass: Frontend (77/77), Backend (267/267)
- Split test command into test-fe and test-be for targeted testing
- Split lint command into lint-fe and lint-be for targeted linting
- Keep original test and lint commands that run both
- Update help text with new commands for better developer experience
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
Makefile (2)

24-28: Guard uv; offer pip fallback and clearer UX.

install fails on systems without uv. Provide a soft check and fallback to pip as previously discussed.

Apply this diff:

 install:
 	@echo "Installing dependencies..."
 	@cd archon-ui-main && npm install
-	@cd python && uv sync
+	@cd python && if command -v uv >/dev/null 2>&1; then \
+		echo "Using uv to sync Python deps..."; \
+		uv sync; \
+	else \
+		echo "WARN: 'uv' not found. Falling back to pip. (Install uv for faster, reproducible sync)"; \
+		python3 -m pip install -U pip || true; \
+		test -f requirements.txt && python3 -m pip install -r requirements.txt || echo "No requirements.txt found"; \
+	fi
 	@echo "✓ Dependencies installed"

39-46: Export backend port/host to Vite and print env-aware URLs in hybrid mode.

Hybrid dev should pass VITE_ARCHON_SERVER_PORT (and optional host) to the UI so getApiUrl() resolves correctly when ports/host are customized via .env. Echo should reflect actual values, not hardcoded defaults.

Apply this diff:

 dev: check
 	@echo "Starting hybrid development..."
 	@echo "Backend: Docker | Frontend: Local with hot reload"
-	@docker-compose --profile backend up -d --build
-	@echo "Backend running at http://localhost:8181"
+	@$(COMPOSE) --profile backend up -d --build
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "Backend running at http://$${HOST:-localhost}:$${ARCHON_SERVER_PORT:-8181}"
 	@echo "Starting frontend..."
-	@cd archon-ui-main && npm run dev
+	@cd archon-ui-main && \
+	VITE_ARCHON_SERVER_PORT=$${ARCHON_SERVER_PORT:-8181} \
+	VITE_ARCHON_SERVER_HOST=$${HOST:-} \
+	npm run dev
🧹 Nitpick comments (31)
archon-ui-main/src/components/BackendStartupError.tsx (2)

31-31: Broaden guidance: include CLI path and align naming with Make/compose backend file

Users working outside Docker Desktop will benefit from CLI instructions. Also, since this PR standardizes container names (archon-*) and introduces a backend-only compose file, the guidance should reflect:

  • the canonical container name archon-server
  • the backend-only compose file when applicable
  • the Make-based workflow (now preferred)

Apply this diff to extend the help text:

-                  Check the <span className="text-red-400 font-bold">Archon API server</span> container logs in Docker Desktop for detailed error information.
+                  Check the <span className="text-red-400 font-bold">Archon API server</span> logs for detailed error information.
+                  <span className="ml-1">You can use Docker Desktop or the CLI.</span>
-                  <p>3. Look for the Archon server container (typically named <span className="text-red-400 font-semibold">archon-server</span> or similar)</p>
+                  <p>3. Look for the Archon server container (typically named <span className="text-red-400 font-semibold">archon-server</span>)</p>
+                  <p className="mt-2">CLI alternatives:</p>
+                  <code className="block p-2 bg-black/70 rounded text-red-100 font-mono text-xs">
+                    docker compose logs -f archon-server
+                  </code>
+                  <code className="block mt-1 p-2 bg-black/70 rounded text-red-100 font-mono text-xs">
+                    docker compose -f docker-compose.backend.yml logs -f archon-server
+                  </code>

Also applies to: 36-36


49-56: Offer Make-based recovery path to match the new workflow

This PR moves dev orchestration to a Makefile. Mirror that here so newcomers follow the standardized path first, with compose as a fallback.

If your Makefile defines targets for recreating backend services, consider:

-                <code className="block mt-2 p-2 bg-black/70 rounded text-red-100 font-mono text-sm">
-                  docker compose down && docker compose up -d
-                </code>
+                <div className="space-y-1">
+                  <code className="block mt-2 p-2 bg-black/70 rounded text-red-100 font-mono text-sm">
+                    make backend-recreate
+                  </code>
+                  <p className="text-red-300 text-xs">or, using Docker Compose directly:</p>
+                  <code className="block p-2 bg-black/70 rounded text-red-100 font-mono text-sm">
+                    docker compose -f docker-compose.backend.yml down && docker compose -f docker-compose.backend.yml up -d
+                  </code>
+                </div>

Please confirm the exact Make target names; if different, I can tailor the snippet.

archon-ui-main/Dockerfile (1)

21-25: Update Dockerfile to Node 20 LTS, clarify port/host source, and run as non-root

• Upgrade the base image from Node 18 (EOL) to Node 20 LTS for ongoing security patches and ecosystem support
• Clarify that the exposed port comes from vite.config.ts (default 3737), not package.json
• Drop root privileges by switching to the built-in node user before starting the server

File: archon-ui-main/Dockerfile

-FROM node:18-alpine
+FROM node:20-alpine

-# Expose the port configured in package.json (3737)
-EXPOSE 3737
+# Expose the port used by Vite (configured in vite.config.ts, default 3737)
+EXPOSE 3737

-# Start Vite dev server (already configured with --port 3737 --host in package.json)
-CMD ["npm", "run", "dev"]
+# Drop privileges for runtime
+USER node
+# Start Vite dev server (host/port are configured in vite.config.ts)
+CMD ["npm", "run", "dev"]
archon-ui-main/vite.config.ts (2)

18-18: Docker detection: add a resilient fallback or allow explicit override

Relying only on DOCKER_ENV or /.dockerenv may miss certain runtimes (some container runtimes omit /.dockerenv). Consider allowing an explicit override or adding a lightweight cgroup check.

-import { existsSync, mkdirSync } from 'fs';
+import { existsSync, mkdirSync, readFileSync } from 'fs';
@@
-  const isDocker = process.env.DOCKER_ENV === 'true' || existsSync('/.dockerenv');
+  const isDocker =
+    process.env.DOCKER_ENV === 'true' ||
+    existsSync('/.dockerenv') ||
+    (() => {
+      try {
+        if (process.platform === 'win32') return false;
+        const c = readFileSync('/proc/1/cgroup', 'utf8');
+        return /docker|containerd|kubepods/.test(c);
+      } catch {
+        return false;
+      }
+    })();

Please validate in your Docker Compose dev container that DOCKER_ENV=true is set; that should make detection deterministic.


281-281: Port parsing: guard against NaN and octal quirks

parseInt without a radix can behave oddly, and NaN should fall back cleanly.

-      port: parseInt(process.env.ARCHON_UI_PORT || env.ARCHON_UI_PORT || '3737'), // Use configurable port
+      port: Number(process.env.ARCHON_UI_PORT ?? env.ARCHON_UI_PORT) || 3737, // Use configurable port
check-env.js (5)

11-14: Harden path check: use path.relative to avoid false positives (Windows, symlinks)

startsWith(projectRoot) can misbehave on case-insensitive filesystems and with symlinks. Use path.relative for a robust containment check.

-if (!envPath.startsWith(projectRoot)) {
+const rel = path.relative(projectRoot, envPath);
+if (rel.startsWith('..') || path.isAbsolute(rel)) {
   console.error('Security error: Invalid .env path');
   process.exit(1);
 }

18-21: Cross-platform copy hint

Windows users may not have cp. Offer an alternative or point to the Makefile target if present.

-  console.error('Copy .env.example to .env and add your credentials:');
-  console.error('  cp .env.example .env');
+  console.error('Copy .env.example to .env and add your credentials:');
+  console.error(process.platform === 'win32'
+    ? '  copy .env.example .env   (PowerShell: Copy-Item .env.example .env)'
+    : '  cp .env.example .env');
+  console.error('Or run: make init (if available)');

28-37: .env parsing: accept “export VAR=…” and trim inline comments

Some teams include export prefixes or end-of-line comments. Small parsing tweaks improve robustness.

-envContent.split('\n').forEach(line => {
+envContent.split('\n').forEach(line => {
   const trimmed = line.trim();
   if (!trimmed || trimmed.startsWith('#')) return;
-  
-  const [key, ...valueParts] = trimmed.split('=');
+  const sanitized = trimmed.replace(/^export\s+/, '');
+  // Drop inline comments not within quotes
+  const withoutInline = sanitized.replace(/\s+#.*$/, '');
+  const [key, ...valueParts] = withoutInline.split('=');
   if (key) {
     const value = valueParts.join('=').trim().replace(/^["']|["']$/g, '');
     envVars[key.trim()] = value;
   }
 });

56-64: Tighten URL validation with scheme check

Ensure https scheme for SUPABASE_URL to avoid accidental http usage.

 try {
-  new URL(envVars['SUPABASE_URL']);
+  const u = new URL(envVars['SUPABASE_URL']);
+  if (u.protocol !== 'https:') {
+    throw new Error('SUPABASE_URL must use https');
+  }
 } catch (e) {
   console.error('ERROR: SUPABASE_URL is not a valid URL');
   console.error(`  Found: ${envVars['SUPABASE_URL']}`);
   console.error('  Expected format: https://your-project.supabase.co');
   process.exit(1);
 }

66-71: Consider a stronger key sanity check

If feasible, guard against clearly invalid keys (e.g., service anon keys) to catch a common misconfig earlier.

-if (envVars['SUPABASE_SERVICE_KEY'].length < 10) {
+const svcKey = envVars['SUPABASE_SERVICE_KEY'];
+if (!svcKey || svcKey.length < 10 || /anon/i.test(svcKey)) {
   console.error('ERROR: SUPABASE_SERVICE_KEY appears to be invalid (too short)');
   console.error('  Please check your Supabase project settings');
   process.exit(1);
 }
python/src/server/api_routes/mcp_api.py (4)

65-80: Container “resolution” is still hard-coded; allow env override and label/name fallback

Despite the method name, this only fetches archon-mcp. Make it resilient:

  • Allow override via env ARCHON_MCP_CONTAINER_NAME.
  • Fallback to matching by name prefix or compose labels to survive renames.
 def _resolve_container(self):
-    """Simple container resolution - just use fixed name."""
-    if not self.docker_client:
-        return None
-    
-    try:
-        # Simple: Just look for the fixed container name
-        container = self.docker_client.containers.get("archon-mcp")
-        self.container_name = "archon-mcp"
-        mcp_logger.info("Found MCP container")
-        return container
-    except NotFound:
-        mcp_logger.warning("MCP container not found - is it running?")
-        self.container_name = "archon-mcp"
-        return None
+    """Resolve MCP container by explicit env name, then by common patterns."""
+    if not self.docker_client:
+        return None
+    import os
+    target = os.getenv("ARCHON_MCP_CONTAINER_NAME", "archon-mcp")
+    try:
+        container = self.docker_client.containers.get(target)
+        self.container_name = target
+        mcp_logger.info(f"Found MCP container: name={self.container_name}")
+        return container
+    except NotFound:
+        # Fallback: try common patterns (compose service or name contains)
+        try:
+            for c in self.docker_client.containers.list(all=True):
+                names = (c.name,) + tuple(getattr(c, "names", []) or ())
+                labels = c.labels or {}
+                if (
+                    any(target in n for n in names) or
+                    labels.get("com.docker.compose.service") == target or
+                    labels.get("io.archon.role") == "mcp"
+                ):
+                    self.container_name = c.name
+                    mcp_logger.info(f"Resolved MCP container via fallback: name={self.container_name}")
+                    return c
+        except Exception as e:
+            mcp_logger.warning(f"Error scanning containers for MCP: {e}")
+    mcp_logger.warning(f"MCP container not found (target={target}) - is it running?")
+    self.container_name = target
+    return None

Note: add an env var to docker-compose so override is easy.


85-88: Preserve stack traces in logs

Use exc_info=True so failures during Docker client init aren’t opaque.

-        except Exception as e:
-            mcp_logger.error(f"Failed to initialize Docker client: {str(e)}")
+        except Exception as e:
+            mcp_logger.error(f"Failed to initialize Docker client: {e}", exc_info=True)
             self.docker_client = None

439-487: Log reader robustness: handle container recreation mid-stream

Minor: if the container is recreated, the cached self.container may go stale. On StopIteration/error, try one re-resolve to resume tails without manual user action.

         except StopIteration:
-            break
+            # Try to re-resolve once (container may have been recreated)
+            try:
+                self.container = self._resolve_container()
+                if self.container:
+                    log_generator = self.container.logs(stream=True, follow=True, tail=20)
+                    continue
+            except Exception:
+                pass
+            break

167-175: Use Docker Compose v2 syntax in the user-facing error message

Update the CLI hint in python/src/server/api_routes/mcp_api.py to use the v2 “docker compose” command:

  • File: python/src/server/api_routes/mcp_api.py, line 174
    -                    "message": f"MCP container {self.container_name} not found. Run docker-compose up -d archon-mcp",
    +                    "message": f"MCP container {self.container_name} not found. Run: docker compose up -d archon-mcp",

While this PR touches only the Python API route, a quick scan (rg -nP 'docker-?compose') shows other references in your docs and Makefile. You may choose to batch-update those in a follow-up for full consistency.

archon-ui-main/test/config/api.test.ts (5)

44-64: Good coverage for default port behavior; consider asserting the fallback log.

Test correctly verifies the 8181 default when no port envs are present. Optionally, assert the console.info fallback message to guard regressions in developer feedback.

Apply this diff to validate the log:

 it('should use default port 8181 when no port environment variables are set in development', async () => {
+  const infoSpy = vi.spyOn(console, 'info').mockImplementation(() => {});
   // Development mode without any port variables
@@
   const { getApiUrl } = await import('../../src/config/api');
 
   expect(getApiUrl()).toBe('http://localhost:8181');
+  expect(infoSpy).toHaveBeenCalledWith('[Archon] Using default ARCHON_SERVER_PORT: 8181');
+  infoSpy.mockRestore();
 });

18-25: Restore global window.location between tests to avoid cross-test leaks.

afterEach restores env but not window.location; future tests reassign it, but an explicit restore is safer and avoids subtle leaks.

Apply this diff:

 beforeEach(() => {
   // Save original environment
   originalEnv = { ...import.meta.env };
+  // Snapshot original window.location
+  (globalThis as any).__origLocation = window.location;
 
   // Clear the module cache to ensure fresh imports
   vi.resetModules();
 });
 
 afterEach(() => {
   // Restore original environment
@@
   Object.assign(import.meta.env, originalEnv);
+  // Restore original window.location
+  if ((globalThis as any).__origLocation) {
+    Object.defineProperty(window, 'location', {
+      value: (globalThis as any).__origLocation,
+      writable: true,
+    });
+    delete (globalThis as any).__origLocation;
+  }
 });

138-166: Add negative/edge cases to port validation loop.

Currently validates common numeric ports only. Add a few edge cases to harden behavior (stringy inputs, leading zeros, out-of-range). Even if getApiUrl() doesn’t enforce numeric ports, tests can assert that it at least returns a well-formed URL or document intended behavior.

Example additions:

 const testCases = [
   { port: '80', expected: 'http://localhost:80' },
@@
   { port: '65535', expected: 'http://localhost:65535' },
+  // Edge cases
+  { port: '0008181', expected: 'http://localhost:0008181' }, // stringly input preserved
+  { port: 'not-a-port', expected: 'http://localhost:not-a-port' }, // current behavior: no validation
+  // If you choose to validate, update expected and add validation in getApiUrl()
 ];

If you plan to enforce numeric range in getApiUrl(), I can provide a small validator and migrate these expectations accordingly.


184-191: Consolidate error assertion for missing ARCHON_MCP_PORT.

Two separate calls assert different substrings. Prefer a single call that asserts both substrings to avoid double execution and to improve clarity.

Apply this diff:

-  await expect(mcpClientService.createArchonClient()).rejects.toThrow('ARCHON_MCP_PORT environment variable is required');
-  await expect(mcpClientService.createArchonClient()).rejects.toThrow('Default value: 8051');
+  await expect(mcpClientService.createArchonClient()).rejects.toThrow(/ARCHON_MCP_PORT environment variable is required[\s\S]*Default value: 8051/);

193-205: Align MCP test with new API URL logic and clean up fetch mocking.

  • getApiUrl() now keys on VITE_ARCHON_SERVER_PORT; setting ARCHON_SERVER_PORT here has no effect in the browser build. Set VITE_ARCHON_SERVER_PORT to match the scenario.
  • Use a spy for fetch and restore it after the test to avoid leaking mocks into other tests.

Apply this diff:

 it('should use ARCHON_MCP_PORT when set', async () => {
   (import.meta.env as any).ARCHON_MCP_PORT = '9051';
-  (import.meta.env as any).ARCHON_SERVER_PORT = '8181';
+  (import.meta.env as any).VITE_ARCHON_SERVER_PORT = '8181';
@@
-  // Mock the API call
-  global.fetch = vi.fn().mockResolvedValue({
+  // Mock the API call
+  const fetchSpy = vi.spyOn(global, 'fetch' as any).mockResolvedValue({
     ok: true,
     json: async () => ({
       id: 'test-id',
       name: 'Archon',
       transport_type: 'http',
       connection_status: 'connected'
     })
   } as any);
@@
   try {
     await mcpClientService.createArchonClient();
@@
   } catch (error) {
@@
   }
+  fetchSpy.mockRestore();
 });

Optionally, also assert the full base URL using getApiUrl() to catch future port/host regressions.

Also applies to: 206-216, 217-236

Makefile (3)

48-54: Make full-Docker output env-aware and use detected Compose CLI.

Avoid hardcoded ports so docs and output remain truthful when .env changes.

Apply this diff:

 dev-docker: check
 	@echo "Starting full Docker environment..."
-	@docker-compose --profile full up -d --build
+	@$(COMPOSE) --profile full up -d --build
 	@echo "✓ All services running"
-	@echo "Frontend: http://localhost:3737"
-	@echo "API: http://localhost:8181"
+	@set -a; [ -f .env ] && . ./.env; set +a; \
+	echo "Frontend: http://$${HOST:-localhost}:$${ARCHON_UI_PORT:-3737}"; \
+	echo "API:      http://$${HOST:-localhost}:$${ARCHON_SERVER_PORT:-8181}"

56-60: Simplify stop to bring everything down regardless of profile.

Multiple --profile flags are unnecessary for down. Also use the detected COMPOSE CLI.

Apply this diff:

 stop:
 	@echo "Stopping all services..."
-	@docker-compose --profile backend --profile frontend --profile full down
+	@$(COMPOSE) down
 	@echo "✓ Services stopped"

1-6: Satisfy checkmake “minphony” by adding an ‘all’ alias and keep help default.

Not critical, but easy to appease the linter.

Apply this diff:

-.PHONY: help dev dev-docker stop test test-fe test-be lint lint-fe lint-be clean install check
+.PHONY: all help dev dev-docker stop test test-fe test-be lint lint-fe lint-be clean install check
+all: help

Also applies to: 99-99

docker-compose.yml (3)

3-3: Remove trailing spaces to satisfy yamllint.

There’s trailing whitespace on Line 3.

Apply this diff:

-# - "frontend": Starts only the frontend UI service  
+# - "frontend": Starts only the frontend UI service

35-37: Security note: Docker socket mount grants root-equivalent host access.

Mounting /var/run/docker.sock is powerful; acceptable for local dev, but avoid in production or gate behind an opt-in flag/profile.

If you expect users to run “full” beyond dev, consider:

  • Ship a separate profile (e.g., mcp-docker-sock) or
  • Document the risk prominently in README under Troubleshooting/Deployment.

21-31: Optional: Add restart policies for a smoother dev experience.

Not required, but restart: unless-stopped improves resilience during local Docker restarts.

Example:

 services:
   archon-server:
@@
     ports:
       - "${ARCHON_SERVER_PORT:-8181}:${ARCHON_SERVER_PORT:-8181}"
+    restart: unless-stopped
@@
   archon-mcp:
@@
     ports:
       - "${ARCHON_MCP_PORT:-8051}:${ARCHON_MCP_PORT:-8051}"
+    restart: unless-stopped
@@
   archon-agents:
@@
     ports:
       - "${ARCHON_AGENTS_PORT:-8052}:${ARCHON_AGENTS_PORT:-8052}"
+    restart: unless-stopped
@@
   frontend:
@@
     ports:
       - "${ARCHON_UI_PORT:-3737}:3737"
+    restart: unless-stopped

Also applies to: 76-90, 121-130, 151-157

README.md (6)

71-71: Fix Windows-style path separator.

Use forward slashes for cross-platform clarity.

Apply this diff:

-OPTIONAL: If you want to enable the reranking RAG strategy, uncomment lines 20-22 in `python\requirements.server.txt`. This will significantly increase the size of the Archon Server container which is why it's off by default.
+OPTIONAL: If you want to enable the reranking RAG strategy, uncomment lines 20-22 in `python/requirements.server.txt`. This will significantly increase the size of the Archon Server container which is why it's off by default.

75-86: Recommend running make check before starting services; reflect both Compose CLIs.

Small UX win: surface environment/tooling issues up front. Also, prefer “docker compose” (v2) while keeping the current command as an alternative.

Apply this diff:

 4. **Start Services** (choose one):
 
-   **Full Docker Mode (Recommended for Normal Archon Usage)**
+   **Full Docker Mode (Recommended for Normal Archon Usage)**
+   First, verify your environment:
+   ```bash
+   make check
+   ```
 
    ```bash
-   docker-compose --profile full up --build -d
+   docker compose --profile full up --build -d
    # or
    make dev-docker
    ```

126-128: Prefer “docker compose” (v2) in reset instructions.

Stays current with modern Docker tooling.

Apply this diff:

-   docker-compose --profile full up -d
+   docker compose --profile full up -d

138-156: Stabilize the “Installing Make” anchor to satisfy MD lint.

The MD linter flagged invalid fragments. Adding an explicit HTML anchor guarantees the heading slug regardless of emoji handling.

Apply this diff:

-## 🛠️ Installing Make
+<a id="installing-make"></a>
+## 🛠️ Installing Make

382-390: Prefer “docker compose logs” and add backend/agents services to the examples.

Minor modernization and completeness.

Apply this diff:

 ```bash
-# View logs using Docker Compose directly
-docker-compose logs -f              # All services
-docker-compose logs -f archon-server # API server
-docker-compose logs -f archon-mcp    # MCP server
-docker-compose logs -f archon-ui     # Frontend
+# View logs using Docker Compose directly
+docker compose logs -f                # All services
+docker compose logs -f archon-server  # API server
+docker compose logs -f archon-mcp     # MCP server
+docker compose logs -f archon-agents  # Agents service
+docker compose logs -f archon-ui      # Frontend

---

`432-437`: **Clarify port override guidance to match frontend behavior.**

Since getApiUrl() reads VITE_ARCHON_SERVER_PORT in dev, remind users to set it alongside ARCHON_SERVER_PORT when running the UI locally.



The current text says this implicitly; consider adding a short example:

```diff
 - For custom ports, ensure both `ARCHON_SERVER_PORT` and `VITE_ARCHON_SERVER_PORT` are set
+ - For custom ports, ensure both `ARCHON_SERVER_PORT` (backend) and `VITE_ARCHON_SERVER_PORT` (frontend dev) are set, e.g.:
+   ```
+   ARCHON_SERVER_PORT=8282
+   VITE_ARCHON_SERVER_PORT=8282
+   ```
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between ccd464c and 25bfb68.

📒 Files selected for processing (11)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
  • README.md (7 hunks)
  • archon-ui-main/Dockerfile (1 hunks)
  • archon-ui-main/src/components/BackendStartupError.tsx (1 hunks)
  • archon-ui-main/src/config/api.ts (1 hunks)
  • archon-ui-main/test/config/api.test.ts (5 hunks)
  • archon-ui-main/vite.config.ts (2 hunks)
  • check-env.js (1 hunks)
  • docker-compose.yml (4 hunks)
  • python/src/server/api_routes/mcp_api.py (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .gitignore
🚧 Files skipped from review as they are similar to previous changes (1)
  • archon-ui-main/src/config/api.ts
🧰 Additional context used
📓 Path-based instructions (7)
{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}

📄 CodeRabbit inference engine (CLAUDE.md)

{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}: Remove dead code immediately; do not keep legacy/unused functions
Avoid comments that reference change history (e.g., LEGACY, CHANGED, REMOVED); keep comments focused on current functionality

Files:

  • archon-ui-main/src/components/BackendStartupError.tsx
  • python/src/server/api_routes/mcp_api.py
archon-ui-main/src/components/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place reusable UI components in archon-ui-main/src/components/

Files:

  • archon-ui-main/src/components/BackendStartupError.tsx
archon-ui-main/test/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place frontend tests under archon-ui-main/test/

Files:

  • archon-ui-main/test/config/api.test.ts
python/src/{server,mcp,agents}/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/src/{server,mcp,agents}/**/*.py: Fail fast on service startup failures, missing configuration, database connection issues, auth failures, critical dependency outages, and invalid data that would corrupt state
External API calls should use retry with exponential backoff and ultimately fail with a clear, contextual error message
Error messages must include context (operation being attempted) and relevant IDs/URLs/data for debugging
Preserve full stack traces in logs (e.g., Python logging with exc_info=True)
Use specific exception types; avoid catching broad Exception unless re-raising with context
Never signal failure by returning None/null; raise a descriptive exception instead

Files:

  • python/src/server/api_routes/mcp_api.py
python/src/server/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/src/server/**/*.py: For batch processing and background tasks, continue processing but log detailed per-item failures and return both successes and failures
Do not crash the server on a single WebSocket event failure; log the error and continue serving other clients

Files:

  • python/src/server/api_routes/mcp_api.py
python/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/**/*.py: Target Python 3.12 with a 120-character line length
Use Ruff for linting and Mypy for type checking before commit

Files:

  • python/src/server/api_routes/mcp_api.py
python/src/server/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep FastAPI application code under python/src/server/ (routes in api_routes/, services in services/, main in main.py)

Files:

  • python/src/server/api_routes/mcp_api.py
🧠 Learnings (2)
📚 Learning: 2025-08-21T11:22:33.541Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-21T11:22:33.541Z
Learning: Applies to .env : Require SUPABASE_URL and SUPABASE_SERVICE_KEY in the .env file; optionally OPENAI_API_KEY, LOGFIRE_TOKEN, LOG_LEVEL

Applied to files:

  • check-env.js
  • README.md
  • Makefile
📚 Learning: 2025-08-21T11:22:33.541Z
Learnt from: CR
PR: coleam00/Archon#0
File: CLAUDE.md:0-0
Timestamp: 2025-08-21T11:22:33.541Z
Learning: Applies to archon-ui-main/test/** : Place frontend tests under archon-ui-main/test/

Applied to files:

  • README.md
🧬 Code graph analysis (1)
archon-ui-main/test/config/api.test.ts (1)
archon-ui-main/src/config/api.ts (1)
  • getApiUrl (9-31)
🪛 markdownlint-cli2 (0.17.2)
README.md

49-49: Link fragments should be valid

(MD051, link-fragments)


426-426: Link fragments should be valid

(MD051, link-fragments)

🪛 LanguageTool
README.md

[grammar] ~85-~85: There might be a mistake here.
Context: ...starts all core microservices in Docker: - Server: Core API and business logic (P...

(QB_NEW_EN)


[grammar] ~98-~98: There might be a mistake here.
Context: ... website ### 🚀 Quick Command Reference | Command | Description ...

(QB_NEW_EN)


[grammar] ~138-~138: There might be a mistake here.
Context: ...ing.

## 🛠️ Installing Make Make is required for the development work...

(QB_NEW_EN)


[grammar] ~278-~278: There might be a mistake here.
Context: ... following ports: - archon-ui: 3737 - archon-server: 8181 - archon-mcp: ...

(QB_NEW_EN)


[grammar] ~279-~279: There might be a mistake here.
Context: ...hon-ui**: 3737 - archon-server: 8181 - archon-mcp: 8051 - archon-agents: ...

(QB_NEW_EN)


[grammar] ~280-~280: There might be a mistake here.
Context: ...on-server**: 8181 - archon-mcp: 8051 - archon-agents: 8052 - archon-docs:...

(QB_NEW_EN)


[grammar] ~281-~281: There might be a mistake here.
Context: ...on-mcp**: 8051 - archon-agents: 8052 - archon-docs: 3838 (optional) ### Chan...

(QB_NEW_EN)


[grammar] ~330-~330: There might be a mistake here.
Context: ...hostname and MCP port ## 🔧 Development ### Quick Start ```bash # Install dependenci...

(QB_NEW_EN)


[grammar] ~360-~360: There might be a mistake here.
Context: ...e - make dev-docker For all services in Docker environment: - All services run...

(QB_NEW_EN)


[grammar] ~394-~394: There might be a mistake here.
Context: ...you make changes. ## 🔍 Troubleshooting ### Common Issues and Solutions #### Port Co...

(QB_NEW_EN)


[grammar] ~452-~452: There might be a mistake here.
Context: ...'re running in hybrid mode (make dev) for best HMR experience - Backend: Chec...

(QB_NEW_EN)

🪛 checkmake (0.2.2)
Makefile

[warning] 5-5: Missing required phony target "all"

(minphony)


[warning] 7-7: Target body for "help" exceeds allowed length of 5 (14).

(maxbodylength)


[warning] 39-39: Target body for "dev" exceeds allowed length of 5 (6).

(maxbodylength)


[warning] 88-88: Target body for "clean" exceeds allowed length of 5 (9).

(maxbodylength)

🪛 YAMLlint (1.37.1)
docker-compose.yml

[error] 3-3: trailing spaces

(trailing-spaces)

🔇 Additional comments (3)
archon-ui-main/test/config/api.test.ts (2)

66-83: LGTM: honors VITE_ARCHON_SERVER_PORT in dev.

Expectation matches getApiUrl()’s new Vite env behavior.


85-102: LGTM: https + custom host scenario is covered.

Covers protocol/host composition in dev mode.

docker-compose.yml (1)

160-163: No changes required: curl is already installed in the UI image

The healthcheck in docker-compose.yml uses curl, and archon-ui-main/Dockerfile already installs it:

  • archon-ui-main/Dockerfile (line 7):
    RUN apk add --no-cache python3 make g++ git curl

Since curl is present, the existing healthcheck will work as expected.

Comment thread Makefile
Comment on lines +31 to +37
check:
@echo "Checking environment..."
@node check-env.js
@echo "Checking Docker..."
@docker --version > /dev/null 2>&1 && echo "✓ Docker installed" || echo "✗ Docker not found"
@docker-compose --version > /dev/null 2>&1 && echo "✓ Docker Compose installed" || echo "✗ Docker Compose not found"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Make “check” fail fast and support both “docker compose” and “docker-compose”.

Currently prints missing tools but continues, and only checks docker-compose. Detect either CLI and abort early if missing; also verify Node presence before running check-env.js.

Apply this diff (adds COMPOSE detection too; see next comment):

+COMPOSE ?= $(shell command -v docker-compose >/dev/null 2>&1 && echo docker-compose || echo "docker compose")
+
 # Check environment
 check:
 	@echo "Checking environment..."
-	@node check-env.js
+	@node -v >/dev/null 2>&1 || { echo "✗ Node.js not found (require Node 18+)."; exit 1; }
+	@node check-env.js
 	@echo "Checking Docker..."
-	@docker --version > /dev/null 2>&1 && echo "✓ Docker installed" || echo "✗ Docker not found"
-	@docker-compose --version > /dev/null 2>&1 && echo "✓ Docker Compose installed" || echo "✗ Docker Compose not found"
+	@docker --version > /dev/null 2>&1 || { echo "✗ Docker not found"; exit 1; }
+	@$(COMPOSE) version > /dev/null 2>&1 || { echo "✗ Docker Compose not found"; exit 1; }
+	@echo "✓ Environment OK"
📝 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.

Suggested change
check:
@echo "Checking environment..."
@node check-env.js
@echo "Checking Docker..."
@docker --version > /dev/null 2>&1 && echo "✓ Docker installed" || echo "✗ Docker not found"
@docker-compose --version > /dev/null 2>&1 && echo "✓ Docker Compose installed" || echo "✗ Docker Compose not found"
COMPOSE ?= $(shell command -v docker-compose >/dev/null 2>&1 && echo docker-compose || echo docker compose)
# Check environment
check:
@echo "Checking environment..."
@node -v >/dev/null 2>&1 || { echo "✗ Node.js not found (require Node 18+)."; exit 1; }
@node check-env.js
@echo "Checking Docker..."
@docker --version > /dev/null 2>&1 || { echo "✗ Docker not found"; exit 1; }
@$(COMPOSE) version > /dev/null 2>&1 || { echo "✗ Docker Compose not found"; exit 1; }
@echo "✓ Environment OK"
🤖 Prompt for AI Agents
In Makefile around lines 31 to 37, the "check" target currently prints missing
tools but continues and only checks for docker-compose; update it to fail fast
by first verifying Node (node --version) before running check-env.js, then
verify Docker (docker --version) and detect Docker Compose by checking for
either "docker compose" (docker compose version) or "docker-compose --version";
if any required tool is missing print a clear error and exit with non-zero
status immediately so make stops. Ensure success messages are printed when tools
are present and that the target returns non-zero on failure.

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Aug 22, 2025

Thank you for this contribution, i will close this PR and i have implemented this in #435

Closing this when the other PR is merged, i attributed your contribution and built on top of this branch @zaksnet

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Aug 22, 2025

merged #435, closing this!

@Wirasm Wirasm closed this Aug 22, 2025
POWERFULMOVES added a commit to POWERFULMOVES/PMOVES-Archon that referenced this pull request Feb 12, 2026
…0#330)

DRY fix - extracts duplicate JWT parsing logic to shared utility:

- Create lib/jwtUtils.ts with proper base64url decoding (RFC 4648)
- Update chat/send/route.ts to use shared ownerFromJwt
- Update chat/messages/route.ts to use shared ownerFromJwt
- Add component parameter for contextual error logging

The shared implementation fixes base64url encoding by replacing
'-' with '+' and '_' with '/' before decoding, and handles
padding correctly per RFC 4648.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Codex Agent <codex-agent@example.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
POWERFULMOVES pushed a commit to POWERFULMOVES/PMOVES-Archon that referenced this pull request Feb 12, 2026
- Add IDOR vulnerability details with affected routes (PR coleam00#329)
- Expand JWT base64url decoding with RFC 4648 details (PR coleam00#330)
- Add structured logging for Loki/Promtail integration (PR coleam00#331)
- Add post-refactoring cleanup pattern
- Add Observability checklist section
- Mark completed action items with PR/commit references

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
coleam00 pushed a commit that referenced this pull request Apr 7, 2026
)

* Investigate issue #330: Wire up baseBranch config

* Fix: Wire up baseBranch config option for worktree creation (#330)

worktree.baseBranch was defined in repo config but ignored by WorktreeProvider, so worktree sync always used the auto-detected default branch.

Changes:

- load repo config once during worktree creation and reuse for sync/copy

- plumb configured baseBranch through syncWorkspaceBeforeCreate and git.syncWorkspace

- update git/worktree tests to exercise configured override and fallback handling

Fixes #330

* Archive investigation for issue #330

* fix: Make configured base branch errors fatal with actionable messages

When worktree.baseBranch is configured in .archon/config.yaml and the
branch doesn't exist, users should get a clear error message explaining
how to fix it - not a silent fallback to the default branch.

Changes:
- Reorder syncWorkspace to fetch before checkout (handles remote-only branches)
- Add actionable error when configured branch not found on remote
- Add actionable error when configured branch can't be checked out
- Make WorktreeProvider re-throw configured branch errors (not non-fatal)
- Add tests for invalid configured branch scenarios
- Update docs to explain baseBranch behavior and error handling

* chore: Remove duplicate investigation artifact (already in completed/)
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…#330) (coleam00#334)

* Investigate issue coleam00#330: Wire up baseBranch config

* Fix: Wire up baseBranch config option for worktree creation (coleam00#330)

worktree.baseBranch was defined in repo config but ignored by WorktreeProvider, so worktree sync always used the auto-detected default branch.

Changes:

- load repo config once during worktree creation and reuse for sync/copy

- plumb configured baseBranch through syncWorkspaceBeforeCreate and git.syncWorkspace

- update git/worktree tests to exercise configured override and fallback handling

Fixes coleam00#330

* Archive investigation for issue coleam00#330

* fix: Make configured base branch errors fatal with actionable messages

When worktree.baseBranch is configured in .archon/config.yaml and the
branch doesn't exist, users should get a clear error message explaining
how to fix it - not a silent fallback to the default branch.

Changes:
- Reorder syncWorkspace to fetch before checkout (handles remote-only branches)
- Add actionable error when configured branch not found on remote
- Add actionable error when configured branch can't be checked out
- Make WorktreeProvider re-throw configured branch errors (not non-fatal)
- Add tests for invalid configured branch scenarios
- Update docs to explain baseBranch behavior and error handling

* chore: Remove duplicate investigation artifact (already in completed/)
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…#330) (coleam00#334)

* Investigate issue coleam00#330: Wire up baseBranch config

* Fix: Wire up baseBranch config option for worktree creation (coleam00#330)

worktree.baseBranch was defined in repo config but ignored by WorktreeProvider, so worktree sync always used the auto-detected default branch.

Changes:

- load repo config once during worktree creation and reuse for sync/copy

- plumb configured baseBranch through syncWorkspaceBeforeCreate and git.syncWorkspace

- update git/worktree tests to exercise configured override and fallback handling

Fixes coleam00#330

* Archive investigation for issue coleam00#330

* fix: Make configured base branch errors fatal with actionable messages

When worktree.baseBranch is configured in .archon/config.yaml and the
branch doesn't exist, users should get a clear error message explaining
how to fix it - not a silent fallback to the default branch.

Changes:
- Reorder syncWorkspace to fetch before checkout (handles remote-only branches)
- Add actionable error when configured branch not found on remote
- Add actionable error when configured branch can't be checked out
- Make WorktreeProvider re-throw configured branch errors (not non-fatal)
- Add tests for invalid configured branch scenarios
- Update docs to explain baseBranch behavior and error handling

* chore: Remove duplicate investigation artifact (already in completed/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants