Skip to content

fix(cli): preserve populated model output on stdout in plain mode - #129871

Merged
steipete merged 1 commit into
mainfrom
codex/models-plain-stdout-payload
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/models-plain-stdout-payload

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users piping populated model aliases or text/image fallback lists in plain mode would receive an empty stdout stream even though the command succeeded, because the actual model payload was incorrectly emitted on stderr. The same output-ownership mistake also affected the model list and status producers.

Related: #129037

Why This Change Was Made

Plain machine-readable output must use the existing direct-stdout runtime writer while diagnostic logging remains routed to stderr. Reusing that canonical writer in all four model output owners repairs aliases, text fallbacks, image fallbacks, model lists, model status, and the parent status shortcut without changing JSON, human-readable output, model sanitization, or status-check exit behavior. Production code delta: +8/-8 (net zero).

User Impact

Operators and scripts once again receive populated model aliases, fallback entries, model lists, and status values on stdout, while startup/state-migration diagnostics remain isolated on stderr.

Evidence

Actual current-source CLI with a populated isolated configuration, before this change:

models aliases list --plain: exit=0 stdout="" stderr="backup openai/gpt-5.6-luna\\nchat anthropic/claude-sonnet-4-6\\nvision google/gemini-2.5-flash-image\\n"
models fallbacks list --plain: exit=0 stdout="" stderr="openai/gpt-5.6-luna\\n"
models image-fallbacks list --plain: exit=0 stdout="" stderr="google/gemini-2.5-flash-image\\n"

Same actual current-source CLI and populated configuration after the owner repair:

models aliases list --plain: exit=0 stdout="backup openai/gpt-5.6-luna\\nchat anthropic/claude-sonnet-4-6\\nvision google/gemini-2.5-flash-image\\n" stderr=""
models fallbacks list --plain: exit=0 stdout="openai/gpt-5.6-luna\\n" stderr=""
models image-fallbacks list --plain: exit=0 stdout="google/gemini-2.5-flash-image\\n" stderr=""
models aliases list --json: exit=0, existing structured stdout preserved
models aliases list: exit=0, existing human-readable stdout preserved
  • node scripts/run-vitest.mjs src/commands/models/aliases.test.ts src/commands/models/fallbacks-shared.test.ts src/commands/models/list.table.test.ts src/commands/models/list.status.test.ts: 59 tests passed across both command shards.
  • New populated owner regressions cover aliases, both fallback families, sanitized model-list rows, and plain status with its existing failed-auth exit behavior; the status regression failed on unchanged production before the fix.
  • The existing built-process migration E2E now uses populated model configuration and asserts exact nonempty stdout for six real command forms, while separately checking migration diagnostics stay on stderr. The isolated task worktree has no built dist/ tree, so this built-artifact suite is delegated to fresh exact-head hosted CI; the current-source CLI processes and all owner suites were run locally.
  • Independent owner-boundary review: approved; mandatory automated Codex review: clean, no actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 04:42
@steipete
steipete merged commit eacceeb into main Aug 26, 2026
202 checks passed
@steipete
steipete deleted the codex/models-plain-stdout-payload branch August 26, 2026 04:54
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant