omi icon indicating copy to clipboard operation
omi copied to clipboard

Python CLI config mutations emit empty stdout in JSON mode

Open MiTM-1 opened this issue 2 months ago • 1 comments

Summary

The Python CLI documents --json as machine-readable output available for any command, but the mutating omi config commands currently exit successfully with empty stdout in JSON mode.

Affected commands in sdks/python-cli/omi_cli/commands/config.py:

  • omi --json config set KEY VALUE
  • omi --json config profile use NAME
  • omi --json config profile delete NAME --yes

Each mutation calls only ctx.renderer.success(...) after saving. Renderer.success() deliberately returns immediately when json_mode is enabled, so no JSON payload is emitted.

This differs from read-only config commands (config show, config path, config profile list), which call renderer.emit(...), and from resource create/update commands, which emit their API result after the success message.

Source-level reproduction

The output contract in sdks/python-cli/README.md says:

Pass --json to any command ... to get machine-readable output

and omi_cli/output.py describes JSON mode as:

machine-readable JSON to stdout

But the mutation path is:

cfg.save(config)
ctx.renderer.success(...)

while Renderer.success() contains:

def success(self, message: str) -> None:
    if self.json_mode:
        return

Therefore a successful JSON-mode mutation has no stdout document for a caller to parse.

No live Omi service, credentials, or user data are required to reproduce this; these commands operate on local configuration.

Expected behavior / proposed scope

Preserve the current pretty-mode success messages, but emit a small structured acknowledgement in JSON mode after each successful mutation. For example:

  • config set → {"success": true, "profile": "default", "key": "api_base", "value": "..."} (with local_token masked or omitted)
  • profile use → {"success": true, "active_profile": "work"}
  • profile delete → {"success": true, "deleted_profile": "old-account"}

Focused regression tests should invoke the real Typer commands with an isolated temporary config and verify:

  1. stdout is valid JSON after each successful mutation;
  2. the config file contains the requested mutation;
  3. local_token is never exposed in JSON output;
  4. pretty-mode behavior remains unchanged;
  5. declined deletion still performs no mutation.

I searched open Omi issues for the config/profile JSON-output case before filing and did not find a matching report. This is related in shape to the successful resource-delete JSON-output issue, but it affects a separate local-config command family.

Following the contribution guide's documented “No Bounties Available?” process, @josancamon19 @kodjima33: would you approve a US$10 bounty for an accepted and merged focused fix with regression coverage, payable through the documented private PayPal claim process? This is a proposal, not an assumed award or reservation; payment details will remain private.

AI disclosure: this source-level investigation and report were prepared by OpenAI GPT-5.6 Sol acting with the connected GitHub account owner's authorization. I am available to discuss the report and revise or implement the fix after maintainer scope/bounty confirmation.

MiTM-1 avatar Sep 08 '26 03:09 MiTM-1

Opened PR #13531. Config mutations emit JSON in --json mode.

Nukeys avatar Sep 11 '26 20:09 Nukeys