Skip to content

[cli] fix: keep service JSON ANSI-free - #246

Merged
Wangmerlyn merged 1 commit into
mainfrom
codex/cli-machine-json-plain-output
Jul 1, 2026
Merged

[cli] fix: keep service JSON ANSI-free#246
Wangmerlyn merged 1 commit into
mainfrom
codex/cli-machine-json-plain-output

Conversation

@Wangmerlyn

Copy link
Copy Markdown
Owner

Summary

  • route status/stop/list-gpus machine JSON through a plain stdlib JSON writer instead of Rich rendering
  • add forced-color regression coverage for success and error JSON paths
  • document that service JSON output is ANSI-free under pseudo-TTY/forced-color consoles

Verification

  • RED: forced-color CLI JSON tests failed with ANSI escapes before the helper change
  • PYTHONPATH=src pytest tests/test_cli_service_commands.py::test_service_json_commands_stay_plain_json_when_console_color_is_enabled tests/test_cli_service_commands.py::test_service_json_errors_stay_plain_json_when_console_color_is_enabled -q -> 4 passed
  • PYTHONPATH=src pytest tests/test_cli_service_commands.py -q -> 230 passed
  • PYTHONPATH=src pytest tests -q -> 936 passed, 11 skipped
  • mkdocs build --strict -> passed with known Material warning
  • pre-commit run --all-files --show-diff-on-failure -> passed
  • local subagent code review -> clean, ready to PR

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@Wangmerlyn, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 24 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1975fafb-0840-4c92-9022-b0d2472393a2

📥 Commits

Reviewing files that changed from the base of the PR and between 40952bf and 10880e2.

📒 Files selected for processing (6)
  • AGENTS.md
  • docs/guides/cli.md
  • docs/plans/fix-cli-json-output.md
  • docs/reference/cli.md
  • src/keep_gpu/cli.py
  • tests/test_cli_service_commands.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/cli-machine-json-plain-output

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request ensures that CLI service commands (status, stop, and list-gpus) output plain, structured JSON without any Rich color or highlighting, even in pseudo-TTY or forced-color environments. This is achieved by introducing a _print_machine_json helper that uses the standard library's json.dumps to write directly to the console stream, bypassing Rich's rendering. Relevant documentation, plans, and tests have been updated to reflect and verify this change. There are no review comments to address, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Wangmerlyn
Wangmerlyn merged commit 01531ac into main Jul 1, 2026
6 checks passed
@Wangmerlyn
Wangmerlyn deleted the codex/cli-machine-json-plain-output branch July 1, 2026 14:02
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