Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ GITEA_ALLOWED_USERS=
# GITEA_BOT_MENTION=archon

# Server
PORT=3000
# PORT=3090 # Default: 3090. Uncomment to override — must match between server and Vite proxy.
# HOST=0.0.0.0 # Bind address (default: 0.0.0.0). Set to 127.0.0.1 to restrict to localhost only.

# Cloud Deployment (for --profile cloud with Caddy reverse proxy)
Expand Down
2 changes: 1 addition & 1 deletion deploy/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TELEGRAM_BOT_TOKEN=123456789:ABC...
# ============================================
# Optional
# ============================================
PORT=3000
PORT=3000 # Docker deployment default (the included compose/Caddy configs target :3000). For local dev (no Docker), omit PORT — server and Vite proxy both default to 3090.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Does Docker Compose env_file support inline # comments on the same line as KEY=VALUE, and in which version was this added?

💡 Result:

No, Docker Compose env_file does not support inline # comments on the same line as KEY=VALUE. env_file files are parsed as raw KEY=VALUE pairs by the Docker CLI, which only supports line comments starting with #, not inline comments. This matches the behavior of docker run --env-file, and changing it would break backward compatibility. Inline comments (e.g., KEY=VALUE # comment) are supported in the Compose CLI's .env file (used for variable interpolation in compose.yaml), but not in env_file. This distinction has been consistent, as confirmed in official docs and GitHub issues. The syntax rules for .env files explicitly describe inline comments with a space before # for unquoted values, but env_file uses a simpler parser without this feature.

Citations:


🏁 Script executed:

fd -type f -name "docker-compose.yml" -o -name "docker-compose.yaml" | head -20

Repository: coleam00/Archon

Length of output: 229


🏁 Script executed:

if git ls-files | grep -E "(docker-compose|compose)" | head -20; then :; fi

Repository: coleam00/Archon

Length of output: 182


🏁 Script executed:

cat -n deploy/docker-compose.yml | head -100

Repository: coleam00/Archon

Length of output: 1780


Inline comments on PORT=3000 will break Docker Compose env_file parsing.

Docker Compose's env_file parser does not support inline comments—the entire text after = is treated as the value, so a line like PORT=3000 # Docker deployment default... results in PORT being set to 3000 # Docker deployment default... instead of 3000. This breaks the ${PORT:-3000}:${PORT:-3000} port mapping and the http://localhost:${PORT:-3000}/api/health healthcheck. Move the guidance onto its own comment line:

🔒 Proposed fix
-PORT=3000  # Docker deployment default (the included compose/Caddy configs target :3000). For local dev (no Docker), omit PORT — server and Vite proxy both default to 3090.
+# Docker deployment default (the included compose/Caddy configs target :3000).
+# For local dev (no Docker), omit PORT — server and Vite proxy both default to 3090.
+PORT=3000
📝 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
PORT=3000 # Docker deployment default (the included compose/Caddy configs target :3000). For local dev (no Docker), omit PORT — server and Vite proxy both default to 3090.
# Docker deployment default (the included compose/Caddy configs target :3000).
# For local dev (no Docker), omit PORT — server and Vite proxy both default to 3090.
PORT=3000
🧰 Tools
🪛 dotenv-linter (4.0.0)

[warning] 49-49: [ValueWithoutQuotes] This value needs to be surrounded in quotes

(ValueWithoutQuotes)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy/.env.example` at line 49, The PORT line in the .env example contains
an inline comment which will be interpreted as part of the value by Docker
Compose; change the env line to a plain assignment "PORT=3000" (no trailing
comment) and move the explanatory guidance into its own comment line above
(e.g., "# Docker deployment default (compose/Caddy target :3000). For local dev
omit PORT — server and Vite proxy default to 3090."). Ensure references that
rely on this value such as the docker-compose port mapping
"${PORT:-3000}:${PORT:-3000}" and the healthcheck URL
"http://localhost:${PORT:-3000}/api/health" will receive a clean numeric PORT
value.

# TELEGRAM_STREAMING_MODE=stream
# DISCORD_STREAMING_MODE=batch

Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/commands/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ CODEX_ACCOUNT_ID=account1
expect(content).toContain('# Using SQLite (default)');
expect(content).toContain('CLAUDE_USE_GLOBAL_AUTH=true');
expect(content).toContain('DEFAULT_AI_ASSISTANT=claude');
expect(content).toContain('PORT=3000');
// PORT is intentionally commented out — server and Vite both default to 3090 when unset (#1152).
expect(content).toContain('# PORT=3090');
expect(content).not.toMatch(/^PORT=/m);
expect(content).not.toContain('DATABASE_URL=');
});

Expand Down
8 changes: 6 additions & 2 deletions packages/cli/src/commands/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1290,8 +1290,12 @@ export function generateEnvContent(config: SetupConfig): string {
}

// Server
// PORT is intentionally omitted: both the Hono server (packages/core/src/utils/port-allocation.ts)
// and the Vite dev proxy (packages/web/vite.config.ts) default to 3090 when unset, which keeps
// them in sync. Writing a fixed PORT here risked a mismatch if ~/.archon/.env leaks a PORT that
// the Vite proxy (which only reads repo-local .env) never sees — see #1152.
lines.push('# Server');
lines.push('PORT=3000');
lines.push('# PORT=3090 # Default: 3090. Uncomment to override.');
lines.push('');

// Concurrency
Expand Down Expand Up @@ -1769,7 +1773,7 @@ export async function setupCommand(options: SetupOptions): Promise<void> {
// Additional options note
note(
'Other settings you can customize in ~/.archon/.env:\n' +
' - PORT (default: 3000)\n' +
' - PORT (default: 3090)\n' +
' - MAX_CONCURRENT_CONVERSATIONS (default: 10)\n' +
' - *_STREAMING_MODE (stream | batch per platform)\n\n' +
'These defaults work well for most users.',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils/port-allocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function calculatePortOffset(path: string): number {
* Get the port for the Hono server
* - If PORT env var is set: use it (explicit override, validated)
* - If running in worktree: auto-allocate deterministic port based on path hash
* - Otherwise: use default 3000
* - Otherwise: use default 3090 (matches the Vite proxy fallback in packages/web/vite.config.ts)
*
* Note: Exits process with code 1 if PORT env var is set but invalid (not 1-65535)
*/
Expand Down
Loading