Skip to content

Settings default assistant save is masked by DEFAULT_AI_ASSISTANT in Docker #1171

@orakemu

Description

@orakemu

Summary

  • What broke: Saving Default Assistant = Claude in Settings persists the YAML change, but reloading still shows codex because the runtime config resolves the env value instead.
  • When it started (if known): Observed on a fresh Docker deployment on 2026-04-13.
  • Severity: major

Steps to Reproduce

  1. Run Archon in Docker with DEFAULT_AI_ASSISTANT=codex in .env.
  2. In the Web UI Settings page, change Default Assistant to Claude and save.
  3. Reload the Settings page or query /api/config.

Expected vs Actual

  • Expected: After saving, the default assistant should resolve to claude.
  • Actual: The saved config file reflects claude, but the UI/API still resolve assistant: "codex".

User Flow

  User                  Settings UI                Config Loader
  ────                  ───────────                ─────────────
  selects Claude ─────▶ PATCH /api/config
                        writes global config
  reloads page ───────▶ GET /api/config ─────────▶ merges config
                                                    [X] env override wins
  sees Codex again ◀── returns assistant=codex

Environment

  • Platform: Web
  • Database: PostgreSQL
  • Running in worktree? No
  • OS: Linux VPS, Docker deployment

Logs

Persisted config file after save:
{defaultAssistant: claude,assistants: {claude: {model: sonnet},codex: {}}}

Live API response after reload:
{"config":{"assistant":"codex","assistants":{"claude":{"model":"sonnet"},"codex":{}}},"database":"postgresql"}

Startup log:
@archon/server start: {"level":30,"module":"config","assistant":"codex","streaming":{"telegram":"stream","discord":"batch","slack":"batch"},"msg":"config_loaded"}

Impact

  • Affected workflows/commands: Settings UI, global default assistant behavior
  • Reproduction rate: Always
  • Workaround available? If so, describe: Only by changing/removing the env var rather than using Settings
  • Data loss risk? No

Scope

  • Package(s) likely involved: core|server|web
  • Module (if known): core:config/config-loader, server:routes/api, web:SettingsPage

Potential Root Cause

  • PATCH /api/config/assistants writes defaultAssistant into the global config successfully.
  • loadConfig() then applies environment overrides last, and applyEnvOverrides() overwrites config.assistant from process.env.DEFAULT_AI_ASSISTANT.
  • In Docker, that makes the saved global config effectively non-authoritative whenever DEFAULT_AI_ASSISTANT is set in .env.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority - Address soon, next in queuearea: configConfiguration loadingarea: serverHTTP server (packages/server) - API routes, SSE, adaptersarea: webWeb UI (packages/web) - React frontendbugSomething is brokeneffort/lowSingle file or function, one responsibility, isolated change

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions