Skip to content

archon setup and archon doctor leak boot stderr and Pino JSON logs into interactive output #1606

@Wirasm

Description

@Wirasm

Summary

  • What broke: The archon setup wizard and archon doctor interactive UX is visually disrupted by three classes of internal log output that leak into the terminal:
    1. Boot-time [archon] stripped … / [archon] loaded … stderr lines from the env loader, before any command-specific code runs.
    2. The CLAUDECODE=1 warning when archon is invoked from inside a Claude Code session, printed before the wizard banner.
    3. Pino JSON logs at info level (doctor.run_started, db.connection_sqlite_selected, db.sqlite_schema_initialized, doctor.run_completed) interleaved with the doctor's human-readable / checklist.
  • When it started: Reproduces on dev after PR feat(cli): setup overhaul + archon doctor + complete bundled skill #1566 (setup overhaul + archon doctor). Boot stderr predates the overhaul (PR feat(paths/cli/setup): unify env load + write on three-path model (#1302, #1303) #1304, three-path env model).
  • Severity: cosmetic (functionality works; the wizard is just visually noisy)

Steps to Reproduce

  1. Have ~/.archon/.env and/or <repo>/.archon/.env present so the env loader emits log lines.
  2. Run archon doctor (or archon setup).
  3. Observe the noise above the wizard intro and inside the doctor output.

Expected vs Actual

  • Expected: Interactive commands (archon setup, archon doctor) start with their banner/title as the first visible output, and only emit / style human-readable lines while running. Verbose internals available behind --verbose.
  • Actual:
[archon] stripped 22 keys from /Users/rasmus/Projects/cole/Archon (.env, .env.local) to prevent target repo env from leaking into Archon processes
⚠  Detected CLAUDECODE=1 — running inside a Claude Code session.
   …
[archon] loaded 3 keys from ~/.archon/.env
[archon] loaded 1 keys from ~/Projects/cole/Archon/.archon/.env (repo scope, overrides user scope)
archon doctor — verifying your setup

{"level":30,"time":1778163281760,"pid":33262,"hostname":"…","module":"cli.doctor","msg":"doctor.run_started"}
{"level":30,"time":1778163281762,"pid":33262,"hostname":"…","module":"db.connection","dbPath":"…","msg":"db.connection_sqlite_selected"}
{"level":30,"time":1778163281776,"pid":33262,"hostname":"…","module":"db.sqlite","msg":"db.sqlite_schema_initialized"}
○ Claude binary: dev mode (SDK resolves via node_modules)
○ gh CLI: GitHub not configured (no GITHUB_TOKEN)
✓ Database: reachable (sqlite)
✓ Workspace: /Users/rasmus/.archon is writable
✓ Bundled defaults: 20 workflow(s), 36 command(s) loaded
○ Slack: no SLACK_BOT_TOKEN set
○ Telegram: no TELEGRAM_BOT_TOKEN set

All checks passed.
{"level":30,"time":1778163281777,"pid":33262,"hostname":"…","module":"cli.doctor","msg":"doctor.run_completed"}

Sources

  • L1 — boot env-strip: packages/paths/src/strip-cwd-env.ts:79-81 (stripped) and :88-95 (CLAUDECODE warning)
  • L2 — boot env-load: packages/paths/src/env-loader.ts:64,78-80 (loaded)
  • L3 — doctor info logs: packages/cli/src/commands/doctor.ts:219,253
  • L4 — db init info logs: packages/core/src/db/connection.ts:41, packages/core/src/db/adapters/sqlite.ts:379

L1/L2 fire at module-init from packages/cli/src/cli.ts:12,16-17, before any command can change log level — so a per-command setLogLevel('warn') does not help suppress them without a different mechanism.

Proposed direction

  • For interactive commands (setup, doctor), default the global Pino level to warn unless --verbose is set. Quick win; suppresses L3/L4.
  • For boot stderr (L1/L2), gate the loaded-keys lines behind LOG_LEVEL=debug or ARCHON_VERBOSE_BOOT=1. Keep the stripped-keys line (security-relevant, tells the operator their target-repo env was discarded). The CLAUDECODE warning could move to the same debug gate now that it has a documented suppress flag (ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING).
  • Don't drop the diagnostics entirely — they are useful when something is wrong; just don't surface them by default during a UX-sensitive command.

Environment

  • Platform: CLI
  • Database: SQLite (default)
  • Running in worktree? No (main repo)
  • OS: macOS (Darwin 25.3.0)

Impact

  • Affected workflows/commands: archon setup, archon doctor
  • Reproduction rate: Always
  • Workaround available? Set ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING=1 for one of three lines; nothing for the others.
  • Data loss risk? No

Scope

  • Package(s) likely involved: cli, paths, core
  • Module (if known): cli:doctor, cli:setup, paths:env-loader, paths:strip-cwd-env, core:db/connection

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: cliCLI commands and interfacebugSomething is brokenuxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions