Skip to content

fix(setup): align PORT default on 3090 across .env.example, wizard, and JSDoc (#1152)#1271

Merged
Wirasm merged 1 commit intodevfrom
fix/issue-1152-port-default-alignment
Apr 17, 2026
Merged

fix(setup): align PORT default on 3090 across .env.example, wizard, and JSDoc (#1152)#1271
Wirasm merged 1 commit intodevfrom
fix/issue-1152-port-default-alignment

Conversation

@leex279
Copy link
Copy Markdown
Collaborator

@leex279 leex279 commented Apr 17, 2026

Summary

  • Problem: Fresh installs can land in a silent port mismatch — server and Vite proxy reading different PORT sources end up on different ports. Web UI shows Failed to load conversations/projects with ECONNREFUSED in the Vite log. Reported in bug(setup): fresh install on Windows 11 leaves web UI broken — .env not created, server (:3000) and Vite proxy (:3090) default to different ports #1152.
  • Why it matters: First-run DX on a clean machine is broken with no visible error pointing at PORT. The issue's RCA landed on the wrong root cause (claimed the server defaults to 3000 in code — it actually defaults to 3090 since the Hono migration in Fix failing react tests #318). Fixing the wrong layer re-introduces the bug; see fix(web): align no-.env API proxy fallback with server default #1159 for a concrete example.
  • What changed: Drop the hardcoded PORT=3000 from the wizard-generated .env, comment it out in .env.example, fix the stale JSDoc "default 3000" in port-allocation.ts, and update the wizard's "Additional Options" note. deploy/.env.example keeps PORT=3000 (Docker compose/Caddy target it) but now carries a comment so someone copying it for local dev won't be silently misled.
  • What did NOT change (scope boundary): No change to basePort (still 3090, the current code default), no change to Vite's fallback (already 3090, correct), no change to the Hono server's dual-.env loading (repo/.env + ~/.archon/.env with override: true). The underlying asymmetry (Hono reads both, Vite reads only repo-local) is discussed but intentionally left alone — narrowing the fix to the three drift points that are safe to align.

UX Journey

Before

Fresh clone, no .env, no prior `archon setup`:
  getPort()          → 3090 (code default)
  Vite loadEnv(...)  → 3090 (fallback)
                       → match  (the issue's described break case actually works here)

After `archon setup` (which writes PORT=3000 to ~/.archon/.env):
  User                  Hono server                Vite proxy
  ────                  ───────────                ──────────
  bun run dev ─────▶    loads repo/.env (missing)
                        loads ~/.archon/.env ─▶ PORT=3000 wins
                        binds :3000
                                                   loadEnv(repo) → no PORT
                                                   fallback → :3090
                                                   proxies /api → :3090
                        listening :3000 ◀─ X ── proxies /api → :3090 (ECONNREFUSED)
  "Failed to load conversations/projects" ◀──────── API 500s

After

Fresh clone, no .env, post-fix:
  getPort()          → 3090  (code default, unchanged)
  Vite loadEnv(...)  → 3090  (fallback, unchanged)
                       → match

After `archon setup`, post-fix:
  User                  Hono server                Vite proxy
  ────                  ───────────                ──────────
  bun run dev ─────▶    loads repo/.env  [no PORT line now]
                        loads ~/.archon/.env  [no PORT line now]
                        getPort() → 3090
                        binds :3090
                                                   loadEnv(repo) → no PORT
                                                   fallback → :3090
                                                   proxies /api → :3090
                        listening :3090 ◀────────── proxies /api → :3090
  Web UI loads ◀──────── API 200

Architecture Diagram

Before

.env.example ────────── PORT=3000 ─────────┐
                                            │ (four independent
setup wizard ──── writes PORT=3000 ────────┤  "default PORT" sources,
                    into .env + ~/.archon/ │  free to drift)
                                            │
port-allocation.ts ── basePort = 3090 ─────┤
                    JSDoc says "3000"       │
                                            │
vite.config.ts ── fallback '3090' ─────────┘

After

port-allocation.ts ── basePort = 3090   (AUTHORITATIVE)
                    JSDoc says "3090"   [~]

.env.example ─────────── # PORT=3090    [~] (commented, defers to code)
setup wizard (.env)  ─── # PORT=3090    [~] (commented, defers to code)
vite.config.ts ──────── fallback '3090'     (unchanged)
deploy/.env.example ──── PORT=3000          (Docker-only, now annotated) [~]

Connection inventory:

From To Status Notes
.env.example user .env modified PORT line commented out
setup wizard generated .env (repo + ~/.archon) modified no longer writes PORT=
setup wizard "Additional Options" note modified says 3090 instead of 3000
port-allocation.ts JSDoc reader expectations modified 3000 → 3090
deploy/.env.example Docker compose/Caddy unchanged still 3000, now documented why
vite.config.ts apiPort unchanged fallback stays 3090
port-allocation.ts getPort() unchanged basePort stays 3090

Label Snapshot

  • Risk: risk: low
  • Size: size: XS
  • Scope: cli config docs
  • Module: cli:setup, core:port-allocation

Change Metadata

  • Change type: bug
  • Primary scope: cli

Linked Issue

Validation Evidence (required)

bun run type-check                  # all 10 packages pass
bun run lint --max-warnings 0       # pass
bun run format:check                # pass
bun --filter @archon/cli test       # 79 pass, 0 fail
bun --filter @archon/core test      # all pass

E2E verified on this branch (with .env temporarily removed, fresh-clone scenario):

Server log:  {"port":3090,"msg":"server_listening"}
             {"port":3090,"msg":"default_port_selected"}
Vite log:    VITE v6.4.1  ready on http://localhost:5173/

$ curl http://localhost:3090/api/health       → 200
$ curl http://localhost:5173/api/health       → 200  (proxy reached server)

Pre-existing failing test in packages/workflows/src/defaults/bundled-defaults.test.ts is unrelated — caused by an untracked .archon/workflows/defaults/archon-feedback.yaml in my local working tree, not by any change in this PR.

Security Impact (required)

  • New permissions/capabilities? No
  • New external network calls? No
  • Secrets/tokens handling changed? No
  • File system access scope changed? No

Compatibility / Migration

  • Backward compatible? Yes — existing users with PORT=3000 explicitly set in their .env keep that behavior (explicit PORT always wins at server and Vite). Only unset/new installs switch to 3090.
  • Config/env changes? Yes.env.example default commented out. Existing .env files on disk are untouched.
  • Database migration needed? No
  • Upgrade steps: none required. Users with stale ~/.archon/.env from an earlier archon setup continue to work; the explicit PORT=3000 there still takes effect. To move onto the 3090 default they can delete the PORT= line.

Human Verification (required)

  • Verified scenarios:
    • Fresh clone, no .env anywhere: server binds 3090, Vite proxies 5173 → 3090, /api/health returns 200 through the proxy.
    • @archon/cli tests pass with the updated generateEnvContent assertions.
    • Diffed the three edits against the Hono-migration commit (Fix failing react tests #318) to confirm 3090 has been the authoritative default since that change landed.
  • Edge cases checked:
    • User with explicit PORT=3000 in .env — unchanged (explicit value wins at both server and Vite).
    • User copies deploy/.env.example to repo root — now sees the comment explaining it is a Docker default.
  • What was NOT verified:
    • Full bun run validate was blocked by a pre-existing bundled-defaults drift unrelated to this change (an untracked file in my local tree); the individual validation steps all pass.
    • No Docker E2E run (out of scope — deploy/.env.example is a text-only change).

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows:
    • archon setup wizard output (.env generation) — no longer writes an explicit PORT line by default.
    • Local dev first-run on a fresh clone — now defaults cleanly on 3090.
    • .env.example read by anyone copying it as a starting point — they no longer start on 3000 unless they uncomment.
  • Potential unintended effects:
    • A user who was relying on the wizard defaulting to 3000 without noticing will now default to 3090 on new generations. Explicit users are unaffected.
  • Guardrails/monitoring for early detection:
    • The updated setup.test.ts asserts both positive (# PORT=3090 present) and negative (no uncommented PORT= line) conditions — catches any regression that reintroduces a hardcoded PORT.

Rollback Plan (required)

  • Fast rollback: git revert <merge-sha> — commit is small and self-contained.
  • Feature flags: none.
  • Observable failure symptoms: if any user reports a post-rollback port mismatch after a recent archon setup, check whether their ~/.archon/.env still has PORT=3000 written by a pre-revert wizard run.

Risks and Mitigations

  • Risk: Users with an existing stale ~/.archon/.env containing PORT=3000 (from a prior wizard run) continue to see server bind on 3000 while Vite proxies to 3090 — the original bug persists for them.

    • Mitigation: Called out explicitly in the issue follow-up and in the migration section above. A dedicated wizard migration could rewrite stale globals but would need to modify user files during a read-mostly run — not justified for this scope. The current fix stops the flow from creating new broken installs; existing broken installs can remove the PORT= line from their global .env.
  • Risk: Downstream docs might still reference :3000 as "the" default.

    • Mitigation: Scanned the repo — packages/docs-web/src/content/docs/ already documents the 3090-local / 3000-Docker split correctly (via Fix failing react tests #318 follow-ups). No further doc changes needed in this PR.

Summary by CodeRabbit

  • Chores
    • Updated default server port from 3000 to 3090. Users without explicit PORT configuration will automatically use the new default. If you previously relied on port 3000, you may need to adjust your environment configuration or explicitly set PORT=3000 in your .env file.

…nd JSDoc (#1152)

The server's getPort() fallback changed from 3000 to 3090 in the Hono
migration (#318), but .env.example, the setup wizard's generated .env,
and the JSDoc describing the fallback were not updated — leaving three
different sources of truth for "the default PORT."

When the wizard writes PORT=3000 to ~/.archon/.env (which the Hono
server loads with override: true, while Vite only reads repo-local
.env), the two processes can land on different ports silently. That
mismatch is the real mechanism behind the failure described in #1152.

- .env.example: comment out PORT, document 3090 as the default
- packages/cli/src/commands/setup.ts: wizard no longer writes PORT=3000
  into the generated .env; fix the "Additional Options" note
- packages/cli/src/commands/setup.test.ts: assert no bare PORT= line and
  the commented default is present
- packages/core/src/utils/port-allocation.ts: fix stale JSDoc "default
  3000" -> "default 3090"
- deploy/.env.example: keep Docker default at 3000 (compose/Caddy target
  that) but annotate it so users don't copy it for local dev

Single source of truth for the local-dev default is now basePort in
port-allocation.ts.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

The pull request updates the default server port from 3000 to 3090 across configuration examples, CLI setup generation, tests, and utility documentation. Changes include commented environment file entries with guidance and updated test expectations to reflect the new default behavior.

Changes

Cohort / File(s) Summary
Environment Configuration
.env.example, deploy/.env.example
Updated PORT default from 3000 to 3090. First file now uses a commented example; second file adds inline documentation explaining Docker target port versus local development behavior.
CLI Setup Generation
packages/cli/src/commands/setup.ts, packages/cli/src/commands/setup.test.ts
Updated generated .env content to emit commented # PORT=3090 with explanation and modified CLI output message. Test assertions updated to verify commented PORT line and absence of uncommented PORT assignments.
Core Utilities
packages/core/src/utils/port-allocation.ts
Updated documentation comment for getPort() fallback behavior to reflect 3090 as the default port when PORT environment variable is unset.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A port of change hops into view,
From 3000 to 3090, fresh and new,
Configs updated, tests align,
Default flows now by design,
The rabbit cheers—all systems shine!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: aligning the PORT default to 3090 across three key sources (.env.example, setup wizard, and JSDoc).
Description check ✅ Passed The description thoroughly covers all required sections with detailed explanations of the problem, its impact, what changed, scope boundaries, UX journey, architecture diagrams, validation evidence, security/compatibility analysis, and rollback plan.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-1152-port-default-alignment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@deploy/.env.example`:
- 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a04d075e-484e-43ef-b1e8-5ab9443ca7dc

📥 Commits

Reviewing files that changed from the base of the PR and between 301a139 and e2a2357.

📒 Files selected for processing (5)
  • .env.example
  • deploy/.env.example
  • packages/cli/src/commands/setup.test.ts
  • packages/cli/src/commands/setup.ts
  • packages/core/src/utils/port-allocation.ts

Comment thread deploy/.env.example
# 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.

@Wirasm
Copy link
Copy Markdown
Collaborator

Wirasm commented Apr 17, 2026

PR Review Summary (multi-agent)

Reviewed with code-reviewer, docs-impact, comment-analyzer, and code-simplifier. Scope: 12/6 line diff across 5 files. Skipped pr-test-analyzer (no new tests), silent-failure-hunter (no error handling), type-design-analyzer (no types).

Critical Issues

None.

Important Issues (2 found)

Agent Issue Location
comment-analyzer Multi-line comment block references issue #1152 and embeds two hardcoded file paths (packages/core/src/utils/port-allocation.ts, packages/web/vite.config.ts). CLAUDE.md explicitly forbids: "Don't reference the current task, fix, or callers… they belong in the PR description and rot as the codebase evolves." Paths will silently go stale if either file moves. packages/cli/src/commands/setup.ts:1293-1296
comment-analyzer Test comment ends with (#1152) — same rule violation. packages/cli/src/commands/setup.test.ts:152

Suggested replacement for setup.ts:1293-1296:

// PORT is intentionally omitted so both the server and Vite proxy independently default
// to 3090, keeping them in sync regardless of which .env files each process reads.

Suggestions (4 found)

Agent Suggestion Location
code-reviewer Inline comment on PORT=3000 line is ~120 chars — inconsistent with the rest of the file which uses block comments above keys. Move to block comment for readability. deploy/.env.example:49
code-simplifier Collapse the two test assertions into one anchored regex: expect(content).toMatch(/^# PORT=3090/m). The ^# anchor already excludes an uncommented PORT= line. packages/cli/src/commands/setup.test.ts:153-154
code-simplifier The trailing # Default: 3090. Uncomment to override. on the emitted line duplicates the block comment directly above it. Consider lines.push('# PORT=3090');. packages/cli/src/commands/setup.ts:1301
comment-analyzer JSDoc parenthetical (matches the Vite proxy fallback in packages/web/vite.config.ts) carries a fragile path. Prefer (must stay in sync with the Vite dev proxy fallback). packages/core/src/utils/port-allocation.ts:33

Strengths

  • Fix correctly targets the root cause — removing the hardcoded PORT= from wizard output and .env.example lets both Hono server and Vite proxy independently default to 3090.
  • Fully backward-compatible — users with explicit PORT= set are unaffected.
  • Test guards both positive (# PORT=3090 present) and negative (no uncommented PORT=) regression.
  • deploy/.env.example correctly retains PORT=3000 for Docker (compose/Caddy target :3000) — scope discipline preserved.

Documentation Issues

None — independent scan of README.md, CLAUDE.md, and packages/docs-web/src/content/docs/** confirms the 3090-local / 3000-Docker split is already documented correctly. The PR author's claim verified.

Verdict

NEEDS MINOR FIXES — the CLAUDE.md comment-rule violations (two #1152 references + two embedded paths) should be cleaned up before merge. The simplification suggestions are nice-to-haves, not blockers. The underlying fix is correct.

Recommended Actions

  1. Trim setup.ts:1293-1296 comment — drop #1152 and the two hardcoded paths.
  2. Trim setup.test.ts:152 comment — drop (#1152).
  3. Optional: collapse the test assertion pair and drop the redundant inline comment on the emitted PORT line.
  4. Optional: reflow the long inline comment in deploy/.env.example:49 as a block comment above the key.

Wirasm added a commit that referenced this pull request Apr 17, 2026
Applies the CLAUDE.md comment rule ("don't embed paths/callers that rot
as the codebase evolves") flagged by the PR #1271 review to the Pi
provider's inline comments.

Three spots in the merged Pi code embed `packages/.../provider.ts:N-M`
line ranges pointing at the Claude and Codex providers. These ranges
will drift the moment those files change — the Claude auth-merge
pattern's line numbers are already off-by-a-few in some local branches.

Keep the conceptual cross-reference ("mirrors Claude's process-env +
request-env merge pattern", "matches the Codex provider's fallback
pattern for the same condition") — that's the load-bearing part of the
comment — drop the fragile line numbers and file paths.

Same treatment for the upstream Pi auth-storage.ts:424-485 reference,
which points at a specific line range in a moving dependency.

No behavior change; comment-only refactor.
Wirasm added a commit that referenced this pull request Apr 17, 2026
…nts (#1275)

Applies the CLAUDE.md comment rule ("don't embed paths/callers that rot
as the codebase evolves") flagged by the PR #1271 review to the Pi
provider's inline comments.

Three spots in the merged Pi code embed `packages/.../provider.ts:N-M`
line ranges pointing at the Claude and Codex providers. These ranges
will drift the moment those files change — the Claude auth-merge
pattern's line numbers are already off-by-a-few in some local branches.

Keep the conceptual cross-reference ("mirrors Claude's process-env +
request-env merge pattern", "matches the Codex provider's fallback
pattern for the same condition") — that's the load-bearing part of the
comment — drop the fragile line numbers and file paths.

Same treatment for the upstream Pi auth-storage.ts:424-485 reference,
which points at a specific line range in a moving dependency.

No behavior change; comment-only refactor.
@Wirasm Wirasm merged commit d89bc76 into dev Apr 17, 2026
4 checks passed
ztech-gthb pushed a commit to ztech-gthb/Archon that referenced this pull request Apr 18, 2026
…nts (coleam00#1275)

Applies the CLAUDE.md comment rule ("don't embed paths/callers that rot
as the codebase evolves") flagged by the PR coleam00#1271 review to the Pi
provider's inline comments.

Three spots in the merged Pi code embed `packages/.../provider.ts:N-M`
line ranges pointing at the Claude and Codex providers. These ranges
will drift the moment those files change — the Claude auth-merge
pattern's line numbers are already off-by-a-few in some local branches.

Keep the conceptual cross-reference ("mirrors Claude's process-env +
request-env merge pattern", "matches the Codex provider's fallback
pattern for the same condition") — that's the load-bearing part of the
comment — drop the fragile line numbers and file paths.

Same treatment for the upstream Pi auth-storage.ts:424-485 reference,
which points at a specific line range in a moving dependency.

No behavior change; comment-only refactor.
ztech-gthb pushed a commit to ztech-gthb/Archon that referenced this pull request Apr 18, 2026
…nd JSDoc (coleam00#1152) (coleam00#1271)

The server's getPort() fallback changed from 3000 to 3090 in the Hono
migration (coleam00#318), but .env.example, the setup wizard's generated .env,
and the JSDoc describing the fallback were not updated — leaving three
different sources of truth for "the default PORT."

When the wizard writes PORT=3000 to ~/.archon/.env (which the Hono
server loads with override: true, while Vite only reads repo-local
.env), the two processes can land on different ports silently. That
mismatch is the real mechanism behind the failure described in coleam00#1152.

- .env.example: comment out PORT, document 3090 as the default
- packages/cli/src/commands/setup.ts: wizard no longer writes PORT=3000
  into the generated .env; fix the "Additional Options" note
- packages/cli/src/commands/setup.test.ts: assert no bare PORT= line and
  the commented default is present
- packages/core/src/utils/port-allocation.ts: fix stale JSDoc "default
  3000" -> "default 3090"
- deploy/.env.example: keep Docker default at 3000 (compose/Caddy target
  that) but annotate it so users don't copy it for local dev

Single source of truth for the local-dev default is now basePort in
port-allocation.ts.
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…nts (coleam00#1275)

Applies the CLAUDE.md comment rule ("don't embed paths/callers that rot
as the codebase evolves") flagged by the PR coleam00#1271 review to the Pi
provider's inline comments.

Three spots in the merged Pi code embed `packages/.../provider.ts:N-M`
line ranges pointing at the Claude and Codex providers. These ranges
will drift the moment those files change — the Claude auth-merge
pattern's line numbers are already off-by-a-few in some local branches.

Keep the conceptual cross-reference ("mirrors Claude's process-env +
request-env merge pattern", "matches the Codex provider's fallback
pattern for the same condition") — that's the load-bearing part of the
comment — drop the fragile line numbers and file paths.

Same treatment for the upstream Pi auth-storage.ts:424-485 reference,
which points at a specific line range in a moving dependency.

No behavior change; comment-only refactor.
joaobmonteiro pushed a commit to joaobmonteiro/Archon that referenced this pull request Apr 26, 2026
…nd JSDoc (coleam00#1152) (coleam00#1271)

The server's getPort() fallback changed from 3000 to 3090 in the Hono
migration (coleam00#318), but .env.example, the setup wizard's generated .env,
and the JSDoc describing the fallback were not updated — leaving three
different sources of truth for "the default PORT."

When the wizard writes PORT=3000 to ~/.archon/.env (which the Hono
server loads with override: true, while Vite only reads repo-local
.env), the two processes can land on different ports silently. That
mismatch is the real mechanism behind the failure described in coleam00#1152.

- .env.example: comment out PORT, document 3090 as the default
- packages/cli/src/commands/setup.ts: wizard no longer writes PORT=3000
  into the generated .env; fix the "Additional Options" note
- packages/cli/src/commands/setup.test.ts: assert no bare PORT= line and
  the commented default is present
- packages/core/src/utils/port-allocation.ts: fix stale JSDoc "default
  3000" -> "default 3090"
- deploy/.env.example: keep Docker default at 3000 (compose/Caddy target
  that) but annotate it so users don't copy it for local dev

Single source of truth for the local-dev default is now basePort in
port-allocation.ts.
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.

bug(setup): fresh install on Windows 11 leaves web UI broken — .env not created, server (:3000) and Vite proxy (:3090) default to different ports

2 participants