Skip to content

fix(cli): suppress boot stderr and Pino info logs in archon doctor/setup#1608

Merged
Wirasm merged 3 commits into
devfrom
archon/task-fix-issue-1606
May 11, 2026
Merged

fix(cli): suppress boot stderr and Pino info logs in archon doctor/setup#1608
Wirasm merged 3 commits into
devfrom
archon/task-fix-issue-1606

Conversation

@Wirasm

@Wirasm Wirasm commented May 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Problem: archon doctor and archon setup leaking boot-time stderr noise ([archon] loaded N keys) and Pino JSON log events (doctor.run_started, db.connection_sqlite_selected, db.sqlite_schema_initialized) into their human-readable / checklist output.
  • Why it matters: Interactive commands are the first-run UX for new users; garbled mixed output undermines trust and readability.
  • What changed: (1) Gate [archon] loaded N keys stderr lines in env-loader.ts behind ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug/trace. (2) Default Pino to warn for setup and doctor in cli.ts (unless --verbose is passed). (3) Update env-loader.test.ts to cover the new gating behavior.
  • What did not change: [archon] stripped N keys (security-relevant, stays unconditional), the CLAUDECODE=1 nested-session warning, Pino verbosity for all other CLI commands (workflow run, serve, etc.).

UX Journey

Before

User runs: archon doctor

Terminal output:
  [archon] loaded 1 keys from /home/user/.archon/.env    ← boot stderr noise
  {"level":30,"time":...,"msg":"doctor.run_started"}     ← Pino info JSON
  {"level":30,"time":...,"msg":"db.connection_sqlite_selected"}
  {"level":30,"time":...,"msg":"db.sqlite_schema_initialized"}

  archon doctor
  ──────────────────────────────────────────────────────
  ○ Checking Claude binary...
  ✓ Claude binary found at /home/user/.local/bin/claude
  ...

After

User runs: archon doctor

Terminal output (clean by default):
  archon doctor
  ──────────────────────────────────────────────────────
  ○ Checking Claude binary...
  ✓ Claude binary found at /home/user/.local/bin/claude
  ...

User runs: archon doctor --verbose

Terminal output (structured logs opt-in):
  [archon] loaded 1 keys from /home/user/.archon/.env    ← only with ARCHON_VERBOSE_BOOT=1
  {"level":30,...,"msg":"doctor.run_started"}             ← only with --verbose
  ...checklist...

User runs: ARCHON_VERBOSE_BOOT=1 archon doctor

Terminal output (env-loader lines visible, Pino still suppressed):
  [archon] loaded 1 keys from /home/user/.archon/.env
  ...checklist (no Pino JSON)...

Architecture Diagram

Before

cli.ts
  └─▶ loadArchonEnv()         → always writes [archon] loaded N keys to stderr
  └─▶ parseArgs()
  └─▶ setLogLevel()           → only 'warn' when --quiet; otherwise stays 'info'
  └─▶ doctorCommand()
        └─▶ getLog().info()   → emits JSON to terminal (level = info)
        └─▶ connectDb()
              └─▶ getLog().info() → emits JSON to terminal

After

cli.ts
  └─▶ loadArchonEnv()         → [isVerboseBoot() check] only writes when
  │                              ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug/trace
  └─▶ parseArgs()
  └─▶ setLogLevel()           → [~] now also 'warn' when command is setup|doctor
  │                              and --verbose is absent
  └─▶ doctorCommand()
        └─▶ getLog().info()   → suppressed (level = warn for interactive cmds)
        └─▶ connectDb()
              └─▶ getLog().info() → suppressed

Connection inventory:

From To Status Notes
cli.ts env-loader.ts loadArchonEnv() unchanged called at boot
env-loader.ts process.stderr modified gated behind isVerboseBoot()
cli.ts setLogLevel() modified now defaults to warn for setup/doctor
cli.ts doctorCommand() unchanged
doctorCommand() getLog().info() unchanged silenced by level, not removed

Label Snapshot

  • Risk: risk: low
  • Size: size: XS
  • Scope: cli, paths, tests
  • Module: cli:doctor, paths:env-loader

Change Metadata

  • Change type: bug
  • Primary scope: cli

Linked Issue

Validation Evidence (required)

bun run validate

All six checks passed:

Check Result
check:bundled ✅ 36 commands, 20 workflows up to date
check:bundled-skill ✅ 21 files up to date
bun run type-check ✅ 0 errors (all 10 packages)
bun run lint ✅ 0 errors, 0 warnings
bun run format:check ✅ All files formatted
bun run test ✅ 0 failures across all packages
  • Evidence provided: full bun run validate run completed without errors.
  • No commands skipped.

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 — default behavior is stricter (less output); ARCHON_VERBOSE_BOOT=1 restores the [archon] loaded lines for users who relied on them.
  • Config/env changes? New opt-in env var: ARCHON_VERBOSE_BOOT=1 (additive). Existing LOG_LEVEL=debug also re-enables the lines.
  • Database migration needed? No

Human Verification (required)

Validated three modes against an ARCHON_HOME containing a populated .env:

  • archon doctor (default) — clean ○/✓ checklist; no [archon] loaded line, no Pino JSON.
  • archon doctor --verbose — checklist plus Pino info events; [archon] loaded still absent (env-loader runs before parseArgs, so --verbose can't reach it; only ARCHON_VERBOSE_BOOT=1 does).
  • ARCHON_VERBOSE_BOOT=1 archon doctor[archon] loaded 1 keys … appears before banner; Pino remains suppressed.

Edge cases checked:

  • archon workflow run assist "test" (non-interactive command): Pino info logs unaffected.
  • archon doctor --quiet: same as default (warn level).
  • Lazy logger pattern in cli.doctor, db.connection, db.sqlite confirmed — setLogLevel('warn') runs before any getLog() call.

What was not verified: archon setup interactive wizard (requires interactive TTY; covered by same code path as doctor).

Side Effects / Blast Radius (required)

  • Affected subsystems/workflows: archon doctor and archon setup output; env-loader.ts stderr behavior.
  • Potential unintended effects: Users who depended on [archon] loaded lines for debugging will need to set ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug.
  • Guardrails/monitoring: None needed — cosmetic output change with a clear opt-in escape hatch.

Rollback Plan (required)

  • Fast rollback: git revert the single commit (e6466ffc); no database or config changes to undo.
  • Feature flags or config toggles: ARCHON_VERBOSE_BOOT=1 restores the env-loader lines immediately without a code change.
  • Observable failure symptoms: If rollback needed, symptom would be the original log noise returning — not a correctness issue.

Risks and Mitigations

  • Risk: Users who relied on [archon] loaded lines to diagnose env-loading order lose them silently.
    • Mitigation: ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug restores them. The [archon] stripped line in strip-cwd-env.ts is unchanged.

Summary by CodeRabbit

  • Bug Fixes

    • archon doctor and archon setup no longer interleave startup logs with interactive output, providing cleaner checklists by default.
  • Documentation

    • Updated CLI and configuration documentation to describe the new ARCHON_VERBOSE_BOOT environment variable for restoring verbose startup logging when needed.

Review Change Stack

…tup (#1606)

`archon doctor` and `archon setup` were leaking `[archon] loaded N keys` boot
lines and Pino `info` JSON events into their human-readable ○/✓ checklist
output. Gate the loaded-keys lines behind ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=
debug/trace, and default Pino to `warn` for the two interactive commands
unless `--verbose` is passed.

Changes:
- packages/paths/src/env-loader.ts: add isVerboseBoot() helper; only emit
  `[archon] loaded` lines when verbose-boot or LOG_LEVEL=debug/trace is set
- packages/cli/src/cli.ts: default Pino to `warn` for `setup` and `doctor`
  unless `--verbose` is passed (lazy logger init means this takes effect
  before any module logger is created)
- packages/paths/src/env-loader.test.ts: existing loaded-line tests opt in
  via ARCHON_VERBOSE_BOOT=1; add coverage for default suppression and
  LOG_LEVEL=debug

Fixes #1606
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b2030c74-3d4a-4f5b-a3ce-4cc9c9112b98

📥 Commits

Reviewing files that changed from the base of the PR and between f4f2725 and e0b7c16.

📒 Files selected for processing (9)
  • .env.example
  • CHANGELOG.md
  • packages/cli/src/cli.ts
  • packages/docs-web/src/content/docs/contributing/cli-internals.md
  • packages/docs-web/src/content/docs/reference/cli.md
  • packages/docs-web/src/content/docs/reference/configuration.md
  • packages/paths/src/env-loader.test.ts
  • packages/paths/src/env-loader.ts
  • packages/paths/src/index.ts

📝 Walkthrough

Walkthrough

The PR adds conditional boot logging for interactive commands by introducing an isVerboseBoot() helper that gates verbose environment-load messages behind ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug/trace, and updates the CLI to suppress Pino JSON logs for setup and doctor commands by defaulting the log level to warn.

Changes

Boot Logging Verbosity Control

Layer / File(s) Summary
Verbosity Detection Helper
packages/paths/src/env-loader.ts, packages/paths/src/index.ts
Exports new isVerboseBoot() function that checks ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL in {debug, trace} (case-insensitive).
Conditional Boot Logging
packages/paths/src/env-loader.ts
loadArchonEnv() gates user and repo scope "[archon] loaded N keys" stderr messages with count > 0 && isVerboseBoot(); docstring updated.
CLI Interactive Command Log Suppression
packages/cli/src/cli.ts
CLI detects setup/doctor commands and defaults log level to warn unless --verbose or isVerboseBoot() is true, suppressing Pino JSON logs during checklist output.
Documentation
.env.example, packages/docs-web/src/content/docs/...
Updated .env.example quiet/verbose levels, added ARCHON_VERBOSE_BOOT to configuration docs, clarified conditional logging in CLI and internals docs, and added changelog entry.
Test Coverage
packages/paths/src/env-loader.test.ts
Extended tests to verify boot lines are not emitted by default, are emitted when LOG_LEVEL=debug/trace, and are suppressed when ARCHON_VERBOSE_BOOT is non-"1"; refactored test setup/teardown for environment isolation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • coleam00/Archon#1304: Extended the env-loader and re-exports in the same paths package; this PR directly builds on those changes by adding the isVerboseBoot() helper and its re-export.
  • coleam00/Archon#1092: Modifies CLI startup and env-boot behavior; this PR uses isVerboseBoot() in the CLI startup flow to gate boot "[archon] loaded N keys" logs during interactive commands.
  • coleam00/Archon#1045: Touches CLI env-loading and startup docs; this PR adds ARCHON_VERBOSE_BOOT documentation and refines the CLI environment startup logging behavior covered by the retrieved PR.

Poem

🐰 A boot log quieter than whispers,
With isVerboseBoot() to call the tune—
Interactive commands hush their chatter,
Unless you ask for the --verbose moon. ✨

✨ 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 archon/task-fix-issue-1606

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.

@Wirasm

Wirasm commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Review: fix(cli) suppress boot stderr and Pino info logs in archon doctor/setup

Verdict: Approve with one actionable fix and a few optional notes.

The fix is correct and clean for the primary case. One edge case warrants attention before merge.


C1 — LOG_LEVEL=debug archon doctor produces half-verbose state (fix before merge)

Files: packages/cli/src/cli.ts:290-295, packages/paths/src/env-loader.ts:51

When a user has LOG_LEVEL=debug in their environment and runs archon doctor:

  1. isVerboseBoot()true[archon] loaded N keys lines appear in stderr (correct)
  2. isInteractiveCommand && !values.verbosesetLogLevel('warn') → all Pino info/debug events suppressed

The user explicitly signaled debug intent via LOG_LEVEL=debug but gets boot lines without Pino — a contradictory state. --verbose is required to fully re-enable logging, which is undocumented and surprising.

Fix:

const isInteractiveCommand = command === 'setup' || command === 'doctor';
const logLevelIsVerbose = ['debug', 'trace'].includes(
  (process.env.LOG_LEVEL ?? '').toLowerCase()
);
if (values.quiet || (isInteractiveCommand && !values.verbose && !logLevelIsVerbose)) {
  setLogLevel('warn');
} else if (values.verbose) {
  setLogLevel('debug');
}

Alternatively: keep current behavior but document in the comment that LOG_LEVEL=debug only affects boot-time output and --verbose is required for Pino verbosity in interactive commands. This is defensible but should be explicit.


S1 — isVerboseBoot() docstring is too verbose (optional)

File: packages/paths/src/env-loader.ts:45-48

Per CLAUDE.md: one short line max. The four-line JSDoc restates what the function name already says. The non-obvious WHY (runs before parseArgs()) is worth keeping as a single line:

// Verbosity via env vars because this runs before parseArgs() and Pino.
function isVerboseBoot(): boolean {

S2 — isInteractiveCommand is used exactly once (optional)

File: packages/cli/src/cli.ts:290

Assigned on one line, consumed on the next. Per YAGNI, no named variable needed here. Inline it:

if (values.quiet || ((command === 'setup' || command === 'doctor') && !values.verbose)) {

Note: this suggestion would be superseded by the C1 fix above which needs the variable or the logLevelIsVerbose guard.


S3 — Comment block above setLogLevel is one sentence too long (optional)

File: packages/cli/src/cli.ts:285-289

The last sentence about lazy logger initialization is an implementation detail, not a decision. Two sentences cover the intent:

// quiet > verbose > default; setup and doctor default to warn so checklist
// output isn't interleaved with Pino JSON (--verbose re-enables structured logs).

S4 — consoleErrorSpy fixture scope is broader than needed (optional)

File: packages/paths/src/env-loader.test.ts:26-29

consoleErrorSpy is set up in beforeEach and used by exactly one test. Globally scoping it silently swallows unexpected console.error calls in the other seven tests. Moving it inside the one test that needs it makes the test surface explicit.


Docs (update before merge)

Three docs pages have stale descriptions of [archon] loaded as always-on:

  • packages/docs-web/src/content/docs/reference/configuration.md — "Operator log lines" block
  • packages/docs-web/src/content/docs/reference/cli.md — boot sequence steps C2/C3
  • packages/docs-web/src/content/docs/contributing/cli-internals.mdloadArchonEnv ASCII diagram

Each needs "and ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug/trace is set" added to the condition for the loaded lines.

Also suggest a CHANGELOG.md entry under [Unreleased] ### Fixed:

archon doctor and archon setup no longer interleave [archon] loaded N keys boot lines and Pino info JSON with their checklist output. Set ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug to restore the boot lines; pass --verbose to re-enable structured Pino logs (#1606).


No issues

  • Key loading is not affected by the gating — keys are loaded unconditionally, only the stderr line is gated ✓
  • isVerboseBoot() is safe: optional chaining on LOG_LEVEL, pure boolean, cannot throw ✓
  • setLogLevel runs before any getLog() call in doctor/setup code paths ✓
  • ARCHON_VERBOSE_BOOT is a safe env var: equality check only, no interpolation or subprocess exposure ✓
  • Test beforeEach/afterEach save/restore is correct for all three env vars ✓
  • Type safety is clean throughout ✓

@Wirasm

Wirasm commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

Comprehensive PR Review

PR: #1608fix(cli): suppress boot stderr and Pino info logs in archon doctor/setup
Reviewed by: 5 specialized agents (code-review, error-handling, test-coverage, comment-quality, docs-impact)
Date: 2026-05-07


Summary

Small, focused fix that correctly gates [archon] loaded N keys boot-time stderr output behind ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=debug/trace, and defaults setup/doctor Pino level to warn. Implementation is semantically correct, type-safe, and well-tested for primary paths. No blocking issues.

Verdict: APPROVE — with 2 MEDIUM suggestions worth addressing before merge

Severity Count
🔴 CRITICAL 0
🟠 HIGH 0
🟡 MEDIUM 2
🟢 LOW 6

🟡 Medium Issues (Consider Fixing Before Merge)

M1: cli.ts comment block exceeds "one short line max" rule

📍 packages/cli/src/cli.ts:285-289

The added 5-line comment block violates CLAUDE.md's "Never write multi-line comment blocks — one short line max" rule. The opening shorthand (quiet > verbose > default) is also slightly inaccurate now that setup/doctor default to warn without any flag.

View suggested fix

Current (5 lines):

// Set log level from flags (quiet > verbose > default).
// Interactive commands (setup, doctor) default to warn so their human-readable
// ○/✓ checklist output isn't interleaved with Pino info JSON; --verbose opts
// back into structured logs. Lazy logger initialization in those commands
// means setLogLevel here takes effect before any logger is first created.
const isInteractiveCommand = command === 'setup' || command === 'doctor';

Suggested (1 line, captures the non-obvious lazy-init constraint):

// setup/doctor default to warn to avoid Pino info JSON interleaving with ○/✓ output; lazy loggers pick up this level at first creation
const isInteractiveCommand = command === 'setup' || command === 'doctor';

M2: ARCHON_VERBOSE_BOOT undocumented in configuration reference

📍 packages/docs-web/src/content/docs/reference/configuration.md

The new ARCHON_VERBOSE_BOOT=1 env var has no entry in the docs. Its sister ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING is already documented in the Core env vars table (line ~233). Users troubleshooting silent boot output have no documented way to enable it.

View suggested addition

Add one row after ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING:

| `ARCHON_VERBOSE_BOOT` | When set to `1`, prints `[archon] loaded N keys from …` lines to stderr at boot. Also enabled by `LOG_LEVEL=debug` or `LOG_LEVEL=trace`. Silent by default to avoid interleaving with interactive command output. | -- |

🟢 Low Issues

View 6 low-priority suggestions
# Issue Location Suggestion
L1 isVerboseBoot() JSDoc is 3 lines env-loader.ts:45-48 Collapse to /** Env var gating: boot runs before parseArgs(), so CLI flags aren't available yet. */
L2 beforeEach comment is 2 lines env-loader.test.ts:38-39 Collapse to single line
L3 LOG_LEVEL=trace activation path untested env-loader.ts:52-53 Add a LOG_LEVEL=trace test mirroring the existing debug test (low risk — same boolean arm)
L4 isInteractiveCommand branch in main() untested cli.ts:290-292 Pre-existing structural constraint (cli.ts self-executes on import). Defer; if fixing, extract resolveLogLevel(command, flags) as a pure helper
L5 .env.example LOG_LEVEL comment: --quiet (error) should be --quiet (warn) .env.example Minimal fix: # CLI can override with --quiet (warn) or --verbose (debug)
L6 Shorthand (quiet > verbose > default) ambiguous cli.ts:285 Resolved automatically if M1 is fixed

✅ What's Good

  • Semantic correctness: Keys load unconditionally; only the stderr diagnostic line is gated. Cannot accidentally prevent env vars from loading.
  • Consistent naming: ARCHON_VERBOSE_BOOT=1 follows the ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING=1 convention from strip-cwd-env.ts.
  • Private encapsulation: isVerboseBoot() is not exported — correct for a boot-only internal helper.
  • --quiet still overrides: values.quiet || (isInteractiveCommand && !values.verbose) correctly preserves --quiet as highest-priority flag.
  • Test isolation: beforeEach/afterEach save/restore for ARCHON_VERBOSE_BOOT and LOG_LEVEL is clean and consistent with existing ARCHON_HOME handling.
  • Key test: "does not emit loaded lines by default even when keys are present" directly validates that suppressing output does not suppress loading — the most critical regression risk.
  • No new error paths: All new logic is pure boolean guards; pre-existing process.exit(1) handlers are unchanged and correctly covered.
  • No comment rot: The "prints only when N > 0" docblock line was updated to reflect the new gating behavior.

Reviewed by Archon prp-review-agents workflow
Full artifacts: /Users/rasmus/.archon/workspaces/coleam00/Archon/artifacts/runs/fb99fb1302cec1ce6197bae22181e076/review/

- Condense multi-line cli.ts comment to one line (CLAUDE.md compliance)
- Respect LOG_LEVEL=debug/trace even for interactive commands (setup/doctor)
- Collapse isVerboseBoot() JSDoc to single-line comment
- Scope consoleErrorSpy to single test that uses it (was global fixture)
- Add LOG_LEVEL=trace test for isVerboseBoot() coverage
- Add ARCHON_VERBOSE_BOOT=true (non-'1') test to document strict-equality
- Document ARCHON_VERBOSE_BOOT in configuration.md env var table
- Update configuration.md operator log lines block to reflect gating
- Update cli.md env startup steps 2/3 with verbosity gate note
- Update cli-internals.md boot flow diagram with verbosity gate note
- Add CHANGELOG.md [Unreleased] entry for #1606
- Fix .env.example --quiet level label (error → warn)
@Wirasm

Wirasm commented May 7, 2026

Copy link
Copy Markdown
Collaborator Author

⚡ Self-Fix Report (Aggressive)

Status: COMPLETE
Pushed: ✅ Changes pushed to archon/task-fix-issue-1606
Commit: 3b02ce0
Philosophy: Fix everything unless clearly a new concern


Fixes Applied (13 total)

Severity Count
🔴 CRITICAL 0
🟠 IMPORTANT 1
🟡 MEDIUM 2
🟢 LOW 10
View all fixes
  • LOG_LEVEL=debug archon doctor inconsistency (packages/cli/src/cli.ts:291) — Added logLevelIsVerbose check so explicit LOG_LEVEL=debug/trace wins over interactive-command default; was silently downgrading to warn
  • Multi-line comment block in cli.ts (packages/cli/src/cli.ts:285-289) — Condensed 5-line comment to one line per CLAUDE.md rule
  • ARCHON_VERBOSE_BOOT undocumented (docs/reference/configuration.md) — Added env var row after ARCHON_SUPPRESS_NESTED_CLAUDE_WARNING
  • isVerboseBoot() JSDoc is multi-line (packages/paths/src/env-loader.ts:45-48) — Replaced 3-line JSDoc with single-line comment
  • beforeEach comment is two lines (packages/paths/src/env-loader.test.ts:38) — Condensed to one line
  • consoleErrorSpy global fixture suppresses errors in all tests (packages/paths/src/env-loader.test.ts) — Moved spy setup into the single test that uses it
  • .env.example says --quiet (error) (.env.example:220) — Fixed to --quiet (warn)
  • Operator log lines block shows all lines as unconditional (docs/reference/configuration.md:352) — Split: stripped always emits; loaded gated with explanation
  • cli.md startup steps 2/3 say "when N > 0" without gating (docs/reference/cli.md:401-402) — Added verbosity gate qualifier
  • cli-internals.md boot flow shows load lines as unconditional (docs/contributing/cli-internals.md:52-53) — Updated diagram box
  • CHANGELOG.md missing entry for C1606 (CHANGELOG.md) — Added Fixed entry under [Unreleased]

Tests Added

  • emits loaded lines when LOG_LEVEL=trace — covers the trace branch of isVerboseBoot()
  • does not emit loaded lines when ARCHON_VERBOSE_BOOT is set to a non-"1" value — documents the intentional strict === '1' equality

Skipped (0)

(none — all findings addressed)


Suggested Follow-up Issues

  1. "Add resolveLogLevel() helper for testable log-level selection in cli.ts"main() self-executes on import; unit-testing the isInteractiveCommand branch requires subprocess tests or extracting a pure helper. Pre-existing structural constraint not introduced by this PR.

Validation

✅ Type check | ✅ Lint | ✅ Tests (10 passed)


Self-fix by Archon · aggressive mode · fixes pushed to archon/task-fix-issue-1606

@Wirasm Wirasm marked this pull request as ready for review May 11, 2026 11:15
@Wirasm Wirasm merged commit eafff6b into dev May 11, 2026
4 checks passed
@Wirasm Wirasm mentioned this pull request May 12, 2026
cropse pushed a commit to cropse/Archon that referenced this pull request May 19, 2026
…tup (coleam00#1608)

* fix(cli): suppress boot stderr and Pino info logs in archon doctor/setup (coleam00#1606)

`archon doctor` and `archon setup` were leaking `[archon] loaded N keys` boot
lines and Pino `info` JSON events into their human-readable ○/✓ checklist
output. Gate the loaded-keys lines behind ARCHON_VERBOSE_BOOT=1 or LOG_LEVEL=
debug/trace, and default Pino to `warn` for the two interactive commands
unless `--verbose` is passed.

Changes:
- packages/paths/src/env-loader.ts: add isVerboseBoot() helper; only emit
  `[archon] loaded` lines when verbose-boot or LOG_LEVEL=debug/trace is set
- packages/cli/src/cli.ts: default Pino to `warn` for `setup` and `doctor`
  unless `--verbose` is passed (lazy logger init means this takes effect
  before any module logger is created)
- packages/paths/src/env-loader.test.ts: existing loaded-line tests opt in
  via ARCHON_VERBOSE_BOOT=1; add coverage for default suppression and
  LOG_LEVEL=debug

Fixes coleam00#1606

* fix: address review findings from PR coleam00#1608

- Condense multi-line cli.ts comment to one line (CLAUDE.md compliance)
- Respect LOG_LEVEL=debug/trace even for interactive commands (setup/doctor)
- Collapse isVerboseBoot() JSDoc to single-line comment
- Scope consoleErrorSpy to single test that uses it (was global fixture)
- Add LOG_LEVEL=trace test for isVerboseBoot() coverage
- Add ARCHON_VERBOSE_BOOT=true (non-'1') test to document strict-equality
- Document ARCHON_VERBOSE_BOOT in configuration.md env var table
- Update configuration.md operator log lines block to reflect gating
- Update cli.md env startup steps 2/3 with verbosity gate note
- Update cli-internals.md boot flow diagram with verbosity gate note
- Add CHANGELOG.md [Unreleased] entry for coleam00#1606
- Fix .env.example --quiet level label (error → warn)

* simplify: export isVerboseBoot and eliminate logLevelIsVerbose duplicate in cli
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.

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

1 participant