Skip to content

Revert/2025 08 25 network config#475

Closed
Superesty wants to merge 35 commits intocoleam00:mainfrom
Superesty:revert/2025-08-25-network-config
Closed

Revert/2025 08 25 network config#475
Superesty wants to merge 35 commits intocoleam00:mainfrom
Superesty:revert/2025-08-25-network-config

Conversation

@Superesty
Copy link
Copy Markdown

@Superesty Superesty commented Aug 25, 2025

Pull Request

Summary

Changes Made

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

# Example: python -m pytest tests/
# Example: cd archon-ui-main && npm run test

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

Additional Notes

Summary by CodeRabbit

  • New Features

    • Production-ready UI build and Docker image.
    • Dynamic CORS and Socket.IO origin handling based on environment/domain.
    • MCP endpoint resolution via proxy in production and full URL in development.
    • Enhanced dev server proxies (API, WebSocket, MCP) and allowed host configuration.
  • Bug Fixes

    • Resolved domain, SSL, CORS, and WebSocket connectivity issues.
    • Fixed Python import path/startup reliability and internal service authentication.
    • Improved internal network allowlisting for containerized deployments.
  • Documentation

    • Added comprehensive Coolify deployment guides, environment templates, DNS/SSL guidance, and troubleshooting steps.

…files para establecer el directorio de trabajo y la ruta de Python
…gregar configuración de nginx; crear archivo de configuración de Vite para producción
…roducción y desarrollo, incluyendo manejo de hosts permitidos y comandos de inicio condicionales.
…or de desarrollo y habilitar el proxy interno en Docker.
…ación de Vite para mejorar la compatibilidad en entornos de desarrollo y producción.
…l entorno de desarrollo y producción, incluyendo validaciones y ajustes en la API interna para permitir el acceso desde redes Docker específicas.
…endencias en Docker Compose para asegurar la salud de los servicios.
…ar la gestión del proxy en Vite para entornos Docker.
…minar la variable VITE_API_URL en Docker Compose.
… Docker y aclarar el uso de VITE_API_URL en el desarrollo local.
…files para establecer el directorio de trabajo y la ruta de Python
…gregar configuración de nginx; crear archivo de configuración de Vite para producción
…roducción y desarrollo, incluyendo manejo de hosts permitidos y comandos de inicio condicionales.
…or de desarrollo y habilitar el proxy interno en Docker.
…ación de Vite para mejorar la compatibilidad en entornos de desarrollo y producción.
…l entorno de desarrollo y producción, incluyendo validaciones y ajustes en la API interna para permitir el acceso desde redes Docker específicas.
…endencias en Docker Compose para asegurar la salud de los servicios.
…ar la gestión del proxy en Vite para entornos Docker.
Copilot AI review requested due to automatic review settings August 25, 2025 12:16
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Aug 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR restructures deployment and runtime configuration for Archon V2: adds Coolify-focused deployment docs and production UI build configs, removes the legacy .env.example, adjusts docker-compose and Dockerfiles, updates Vite configs and proxies, switches MCP URL resolution in the UI, and tightens backend internal-access and dynamic CORS/Socket.IO origin handling.

Changes

Cohort / File(s) Summary
Deployment docs & env artifacts
COOLIFY_DEPLOYMENT.md, DEPLOY_SUMMARY.md, anthropic_env.txt, .env.example
Adds comprehensive Coolify deployment guides and env schemas; introduces Anthropic env vars file; removes legacy .env.example minimal config block.
Frontend Vite configs & client wiring
archon-ui-main/vite.config.ts, archon-ui-main/vite.config.prod.ts, archon-ui-main/vite.config.simple.ts, archon-ui-main/vite.config.ts.backup, archon-ui-main/src/services/mcpClientService.ts
Simplifies Vite config, adds production and simplified variants, integrates Vitest config, extends proxies (/socket.io, /mcp), sets allowed hosts, and alters MCP URL resolution (relative /mcp in prod, full URL in dev). Adds backup of prior advanced config.
Frontend Docker
archon-ui-main/Dockerfile, archon-ui-main/Dockerfile.production
Clarifies dev-server intent in Dockerfile comment; adds production Dockerfile to build and serve Vite preview on port 3737.
Compose orchestration
docker-compose.yml
Updates service commands/env (DOMAIN, PROD), removes dev bind-mounts, standardizes frontend VITE_API_URL, adds Coolify labels, and adjusts server start command.
Python service Dockerfiles
python/Dockerfile.server, python/Dockerfile.mcp, python/Dockerfile.agents
Ensures WORKDIR /app and sets PYTHONPATH=/app at startup; switches to shell-form commands that cd /app before launching services.
Backend internal access & CORS
python/src/server/api_routes/internal_api.py, python/src/server/main.py, python/src/server/socketio_app.py
Expands internal IP checks, allows internal header-based access, adds service-host allowances; adds dynamic CORS origins based on DOMAIN/PROD; updates Socket.IO CORS origins similarly.
Agents runtime tweaks
python/src/agents/server.py, python/src/agents/document_agent.py
Adds X-Internal-Service: archon-agents header to internal creds fetch; removes result_type=DocumentOperation from document agent init.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Frontend (Vite)
  participant Proxy as Vite Dev Proxy / Coolify
  participant API as FastAPI Server
  participant MCP as MCP Service
  participant SIO as Socket.IO Server

  Note over UI,API: Development
  UI->>Proxy: /api/* HTTP
  Proxy->>API: Forward to http://archon-server:8181
  UI->>Proxy: /socket.io WS
  Proxy->>SIO: WS upgrade -> http://archon-server:8181
  UI->>Proxy: /mcp HTTP
  Proxy->>MCP: Forward to http://archon-mcp:8051

  Note over UI,API: Production (Coolify)
  UI->>API: /api/* (direct over domain, SSL by Coolify)
  UI->>SIO: /socket.io (domain, CORS per DOMAIN/PROD)
  UI->>API: /mcp (relative path proxied by server/proxy)
Loading
sequenceDiagram
  autonumber
  participant Agents as archon-agents
  participant Server as FastAPI Internal API
  participant Guard as Internal Access Guard

  Agents->>Server: GET /internal/credentials/agents<br/>Headers: X-Internal-Service: archon-agents
  Server->>Guard: is_internal_request(request)
  alt Header or allowed internal IP/host
    Guard-->>Server: allow
    Server-->>Agents: 200 credentials
  else Not internal
    Guard-->>Server: deny (warn)
    Server-->>Agents: 403
  end
Loading
sequenceDiagram
  autonumber
  participant Env as ENV (DOMAIN, PROD)
  participant App as FastAPI Startup
  participant SIO as Socket.IO Init

  Env-->>App: DOMAIN, PROD
  App->>App: get_allowed_origins()
  App-->>App: allow_origins list (domain-specific or "*")
  App->>SIO: get_cors_origins()
  SIO-->>SIO: cors_allowed_origins (domain list or "*")
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

In Coolify’s breeze my servers hop,
Ports align—no bind-mount flop.
CORS now bows to DOMAIN’s tune,
Sockets sing beneath the moon.
MCP paths grow short and sweet,
Rabbits ship—production complete. 🐇🚀

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent 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 6a1b030 and c85ad4c.

📒 Files selected for processing (20)
  • .env.example (0 hunks)
  • COOLIFY_DEPLOYMENT.md (1 hunks)
  • DEPLOY_SUMMARY.md (1 hunks)
  • anthropic_env.txt (1 hunks)
  • archon-ui-main/Dockerfile (1 hunks)
  • archon-ui-main/Dockerfile.production (1 hunks)
  • archon-ui-main/src/services/mcpClientService.ts (2 hunks)
  • archon-ui-main/vite.config.prod.ts (1 hunks)
  • archon-ui-main/vite.config.simple.ts (1 hunks)
  • archon-ui-main/vite.config.ts (2 hunks)
  • archon-ui-main/vite.config.ts.backup (1 hunks)
  • docker-compose.yml (5 hunks)
  • python/Dockerfile.agents (1 hunks)
  • python/Dockerfile.mcp (1 hunks)
  • python/Dockerfile.server (1 hunks)
  • python/src/agents/document_agent.py (0 hunks)
  • python/src/agents/server.py (1 hunks)
  • python/src/server/api_routes/internal_api.py (2 hunks)
  • python/src/server/main.py (1 hunks)
  • python/src/server/socketio_app.py (1 hunks)
✨ 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request appears to be reverting or modifying network configuration changes, updating CORS settings, Docker configurations, and deployment setups. The changes primarily focus on making the application ready for production deployment with proper domain configuration and environment-specific settings.

Key Changes:

  • CORS Configuration: Added dynamic CORS origin handling based on domain and production mode
  • Docker Configuration: Updated Dockerfiles and docker-compose.yml for production deployment
  • Network Setup: Enhanced internal service communication with proper IP range handling

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
python/src/server/socketio_app.py Added dynamic CORS origins function for Socket.IO based on environment
python/src/server/main.py Added dynamic allowed origins function for FastAPI CORS middleware
python/src/server/api_routes/internal_api.py Enhanced internal request validation with broader IP ranges and service headers
python/src/agents/server.py Added internal service header to credentials fetch requests
python/src/agents/document_agent.py Removed result_type parameter from agent configuration
python/Dockerfile.server Updated working directory and Python path configuration
python/Dockerfile.mcp Updated command to use proper working directory and Python path
python/Dockerfile.agents Updated command to use proper working directory and Python path
docker-compose.yml Removed development volume mounts, added production environment variables
archon-ui-main/vite.config.ts Simplified Vite configuration, removed complex test runner middleware
archon-ui-main/src/services/mcpClientService.ts Updated MCP URL handling for production vs development environments
archon-ui-main/Dockerfile Updated comment for Docker dev server usage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +18 to +20
def get_cors_origins():
"""Get CORS origins for Socket.IO based on environment"""
import os
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

Move the import statement to the top of the file to follow Python import conventions. Imports should be at module level, not inside functions.

Suggested change
def get_cors_origins():
"""Get CORS origins for Socket.IO based on environment"""
import os

Copilot uses AI. Check for mistakes.
Comment thread python/src/server/main.py
Comment on lines +181 to +183
def get_allowed_origins():
"""Get allowed origins for CORS based on environment"""
import os
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

Move the import statement to the top of the file to follow Python import conventions. Imports should be at module level, not inside functions.

Suggested change
def get_allowed_origins():
"""Get allowed origins for CORS based on environment"""
import os

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +23
// Add your specific domain
allowedHosts.push('archon.cogitia.com.es', 'www.archon.cogitia.com.es');
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

Hard-coded domain 'archon.cogitia.com.es' should be configurable through environment variables instead of being hard-coded in the configuration file.

Suggested change
// Add your specific domain
allowedHosts.push('archon.cogitia.com.es', 'www.archon.cogitia.com.es');
// Add your specific domain(s) via environment variable(s)
if (env.ARCHON_ALLOWED_DOMAIN) {
allowedHosts.push(env.ARCHON_ALLOWED_DOMAIN, `www.${env.ARCHON_ALLOWED_DOMAIN}`);
}
if (process.env.ARCHON_ALLOWED_DOMAIN) {
allowedHosts.push(process.env.ARCHON_ALLOWED_DOMAIN, `www.${process.env.ARCHON_ALLOWED_DOMAIN}`);
}

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +60
'/mcp': {
target: `http://archon-mcp:8051`,
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

The MCP port is hard-coded as '8051'. Consider using the environment variable from the define section or making it configurable.

Suggested change
'/mcp': {
target: `http://archon-mcp:8051`,
target: `http://archon-mcp:${mcpPort}`,

Copilot uses AI. Check for mistakes.
Comment thread anthropic_env.txt
Comment on lines +1 to +2
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-HYg4GalckauGx5GAPVmZWTNOv92cq3FW2ENegZOluen3jG7H"
Copy link

Copilot AI Aug 25, 2025

Choose a reason for hiding this comment

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

API authentication token is exposed in plain text. This file should not be committed to version control as it contains sensitive credentials.

Suggested change
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="sk-HYg4GalckauGx5GAPVmZWTNOv92cq3FW2ENegZOluen3jG7H"
# WARNING: Do not commit real API tokens to version control!
# Set your ANTHROPIC_AUTH_TOKEN in your local environment or a secure secrets manager.
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="<YOUR_ANTHROPIC_AUTH_TOKEN>"

Copilot uses AI. Check for mistakes.
@Superesty Superesty closed this by deleting the head repository Aug 25, 2025
POWERFULMOVES added a commit to POWERFULMOVES/PMOVES-Archon that referenced this pull request Feb 12, 2026
…_yarn/CATACLYSM_STUDIOS_INC/PMOVES-PROVISIONS/docker-stacks/jellyfin-ai/api-gateway/npm_and_yarn-2b901f0e0d

chore(deps): bump qs from 6.13.0 to 6.14.1 in /CATACLYSM_STUDIOS_INC/PMOVES-PROVISIONS/docker-stacks/jellyfin-ai/api-gateway in the npm_and_yarn group across 1 directory
coleam00 added a commit that referenced this pull request Apr 7, 2026
…#475) (#480)

Fixes four interconnected issues with workflow dispatch in the Web UI:

1. **Conversation history preserved after workflow dispatch**: Replace early
   `break` in handleStreamMode/handleBatchMode with `commandDetected` flag
   that silences further output but keeps consuming the generator until the
   SDK's `result` message (with sessionId) arrives.

2. **Workflow cancel now works**: Pass `parent_conversation_id` at workflow
   run creation time (not after completion). Update `getActiveWorkflowRun`
   to check both `conversation_id` and `parent_conversation_id`. Add
   between-step and between-iteration cancellation checks in executor.
   Wire `AbortController` through assistant clients to terminate in-flight
   AI subprocess calls on cancel.

3. **UI streaming stalls fixed**: When `workflow_status: completed/failed/
   cancelled` SSE event arrives, call `onLockChange(false)` to clear all
   `isStreaming` flags on messages.

4. **Router prompt improved**: Update orchestrator prompt to place
   `/invoke-workflow` as the last line of the response and add guidance
   for ambiguous vs clear intent routing.

5. **Duplicate tool call display fixed**: Add `{ category: 'tool_call_formatted' }`
   metadata to direct chat tool call messages so the web adapter skips the
   raw text SSE event (matching the existing workflow executor pattern).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Tyone88 pushed a commit to Tyone88/Archon that referenced this pull request Apr 16, 2026
…coleam00#475) (coleam00#480)

Fixes four interconnected issues with workflow dispatch in the Web UI:

1. **Conversation history preserved after workflow dispatch**: Replace early
   `break` in handleStreamMode/handleBatchMode with `commandDetected` flag
   that silences further output but keeps consuming the generator until the
   SDK's `result` message (with sessionId) arrives.

2. **Workflow cancel now works**: Pass `parent_conversation_id` at workflow
   run creation time (not after completion). Update `getActiveWorkflowRun`
   to check both `conversation_id` and `parent_conversation_id`. Add
   between-step and between-iteration cancellation checks in executor.
   Wire `AbortController` through assistant clients to terminate in-flight
   AI subprocess calls on cancel.

3. **UI streaming stalls fixed**: When `workflow_status: completed/failed/
   cancelled` SSE event arrives, call `onLockChange(false)` to clear all
   `isStreaming` flags on messages.

4. **Router prompt improved**: Update orchestrator prompt to place
   `/invoke-workflow` as the last line of the response and add guidance
   for ambiguous vs clear intent routing.

5. **Duplicate tool call display fixed**: Add `{ category: 'tool_call_formatted' }`
   metadata to direct chat tool call messages so the web adapter skips the
   raw text SSE event (matching the existing workflow executor pattern).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…coleam00#475) (coleam00#480)

Fixes four interconnected issues with workflow dispatch in the Web UI:

1. **Conversation history preserved after workflow dispatch**: Replace early
   `break` in handleStreamMode/handleBatchMode with `commandDetected` flag
   that silences further output but keeps consuming the generator until the
   SDK's `result` message (with sessionId) arrives.

2. **Workflow cancel now works**: Pass `parent_conversation_id` at workflow
   run creation time (not after completion). Update `getActiveWorkflowRun`
   to check both `conversation_id` and `parent_conversation_id`. Add
   between-step and between-iteration cancellation checks in executor.
   Wire `AbortController` through assistant clients to terminate in-flight
   AI subprocess calls on cancel.

3. **UI streaming stalls fixed**: When `workflow_status: completed/failed/
   cancelled` SSE event arrives, call `onLockChange(false)` to clear all
   `isStreaming` flags on messages.

4. **Router prompt improved**: Update orchestrator prompt to place
   `/invoke-workflow` as the last line of the response and add guidance
   for ambiguous vs clear intent routing.

5. **Duplicate tool call display fixed**: Add `{ category: 'tool_call_formatted' }`
   metadata to direct chat tool call messages so the web adapter skips the
   raw text SSE event (matching the existing workflow executor pattern).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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