Skip to content

feat(cli): --plain output mode for Docker / CI / CloudWatch#269

Merged
jacsamell merged 1 commit into
mainfrom
feat/plain-output
Jun 2, 2026
Merged

feat(cli): --plain output mode for Docker / CI / CloudWatch#269
jacsamell merged 1 commit into
mainfrom
feat/plain-output

Conversation

@jacsamell
Copy link
Copy Markdown
Contributor

Companion to v2#1586 (cube-runner). cube --plain disables Rich Live + colour + alternate-screen so cube reads cleanly in non-TTY pipes (CloudWatch, Docker, CI). Three flip paths: CLI flag, CUBE_PLAIN_OUTPUT=1 env, auto-detect non-TTY stdout. 724/724 tests pass.

cube's default output stack is Rich Live displays + coloured markup +
an alternate-screen buffer. Inside a non-TTY pipe (Docker logs,
CloudWatch, CI) all three are broken: Live frames never flush, ANSI
escape codes leak into the log, alternate-screen sequences corrupt
scrollback. The cube-runner image (v2#1586) needs cube to stream
readable lines straight to stdout — this adds that mode.

Three resolution paths (any one flips it on):
1. CLI: ``cube --plain <subcmd> …``
2. Env: ``CUBE_PLAIN_OUTPUT=1`` or legacy ``CUBE_NON_TTY=1``
3. Auto: ``sys.stdout.isatty() is False``

CLI flag also exports ``CUBE_PLAIN_OUTPUT=1`` so subprocesses
(sdk-bridge, codex CLI, recursive cube calls) inherit without
threading the flag through every launcher.

Plain mode disables:
* ``_SafeConsole`` constructed with ``no_color, markup=False,
  highlight=False, force_terminal=False, width=200``.
* ``BaseThinkingLayout.start()`` is a no-op (no Live, no
  alternate-screen). ``add_thinking`` / ``add_output`` /
  ``add_assistant_message`` / ``mark_complete`` fall through to direct
  ``console.print`` with ``[<label>]`` prefixes so log readers can
  correlate streams from concurrent writers/judges.

Plain mode does NOT change:
* Every existing layout API call still works — same call sites, code
  path diverges underneath. CloudWatch + the operator's local terminal
  share one implementation.

8 new tests in ``test_core/test_plain.py`` cover the latch, env-var
parsing (including explicit-off), TTY auto-detect, the SafeConsole
kwarg shape, and ``BaseThinkingLayout.start`` no-op-ing.

Existing ``test_base_layout`` tests now pin plain OFF in an autouse
fixture — those tests assert Live-path behaviour which the plain
path intentionally bypasses.

724/724 tests pass.
@jacsamell jacsamell merged commit 49478cf into main Jun 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Warning

Review limit reached

@jacsamell, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4041b3ce-d112-4cd0-8cf7-6e59ba8dc3bc

📥 Commits

Reviewing files that changed from the base of the PR and between fa94d2d and 7608ecd.

📒 Files selected for processing (6)
  • python/cube/cli.py
  • python/cube/core/base_layout.py
  • python/cube/core/output.py
  • python/cube/core/plain.py
  • tests/core/test_base_layout.py
  • tests/core/test_plain.py

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

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.

1 participant