feat(cli): --plain output mode for Docker / CI / CloudWatch#269
Conversation
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.
|
Warning Review limit reached
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 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
Comment |
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.