Skip to content

fix(cli): keep diagnostics available with malformed configuration - #13163

Closed
ikoomm wants to merge 1 commit into
BasedHardware:mainfrom
ikoomm:fix/cli-config-independent-diagnostics
Closed

ikoomm wants to merge 1 commit into
BasedHardware:mainfrom
ikoomm:fix/cli-config-independent-diagnostics

Conversation

@ikoomm

@ikoomm ikoomm commented Sep 8, 2026 •

Copy link
Copy Markdown

Fixes #13161.

Malformed TOML currently prevents omi version and omi config path from running. Resolve the profile only when a command needs it, and read the configured path without parsing file contents. Config-dependent commands still reject malformed files. README documents the diagnostic behavior.

Validation (Windows/Python 3.12):

  • Seven new behavioral tests pass; the three malformed-config diagnostic cases fail before this fix. Tests also cover flag/environment/saved-profile precedence and refusal to overwrite malformed TOML.
  • Real python -m omi_cli version and text/JSON config-path invocations pass using isolated malformed TOML.
  • 38 focused CLI/config/OpenAPI tests pass. The broader run had 279 passes and five failures: four missing OpenAPI fixture failures pass after restoring the exact tracked file omitted by sparse checkout; the remaining auth transport failure is also present on the unchanged base (auth source and test unchanged from 2654b4d).
  • Mypy reports the same seven dependency/errors.py diagnostics on the original CLI and this branch; none in changed source files.

Product invariants affected: none.

Failure-Class: none

Repository preflight: all 12 selected local checks pass (22.56s), using the Makefile's Python entry point on Windows. The historical recurrence ratchet skips its history analysis in this shallow clone. scripts/failure-class validate passes. Proposed US$5 bounty in the issue is awaiting approval.

Hosted CI on this head: Linux/Python 3.10, Linux/Python 3.12 and Windows/Python 3.12 each fail only test_transport_failure_during_login_leaves_saved_config_unchanged (assert 0 != 0), matching the known baseline failure above. Run: https://github.com/BasedHardware/omi/actions/runs/34254694831 . Repository Hygiene and PR Metadata Preflight pass.

Resolve profiles only when needed and obtain the config path without parsing TOML. Seven new behavioral tests pass; three failed before the fix. Real python -m omi_cli version and text/JSON config path succeed against malformed temporary TOML.

Failure-Class: none

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

No issues found across 4 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @ikoomm — nice fix for #13161, and the validation notes in the description matched what I found when I re-checked them independently. Reviewed against the head diff:

  • sdks/python-cli/omi_cli/main.py — moving profile resolution out of the root callback into a lazy AppContext.profile_name property is the right shape. I traced every consumer (commands/auth.py, commands/config.py, commands/local.py, and the get_profile() path used by the API commands): all of them read ctx.profile_name before any same-invocation cfg.save()/ctx.reload_config(), so resolution timing is equivalent everywhere — omi version just no longer drags tomllib.load() along. The rename to profile_override plus the cached _profile_name cleanly separates the input flag from the resolved value, and nothing else in the package or tests constructs AppContext directly.
  • sdks/python-cli/omi_cli/commands/config.py — path now prints cfg.default_config_path() instead of config.path; the output string is identical (both honor $OMI_CONFIG), but no TOML parse happens. Good that config show/set and the profile subcommands still go through load_config() and keep rejecting malformed files.
  • sdks/python-cli/tests/test_diagnostics.py — the seven test cases cover the three diagnostic invocations (text and JSON) plus the two guards that matter: config-mutating commands still fail on malformed TOML without touching the file on disk, and flag > env > saved-profile precedence survives lazy resolution. The byte-for-byte read_bytes() assertions are the right way to prove "no accidental rewrite".
  • sdks/python-cli/README.md — the new paragraph is accurate and narrowly scoped to the behavior that actually changed.

On CI: the three Python CLI jobs on this head each fail only test_transport_failure_during_login_leaves_saved_config_unchanged (assert 0 != 0). I confirmed the same test fails identically on base commit 2654b4d and is flaky across recent main runs, so it is pre-existing and unrelated to this change.

Since this changes when (and whether) the config file is parsed across every command, leaving the final merge sign-off to a human maintainer.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added python positive-signal Automation verified a genuine fix/quality contribution labels Sep 8, 2026
@kodjima33

Copy link
Copy Markdown
Collaborator

Thank you so much for this 🙏 — looks like this was already fixed on main (see #13167, merged just now, same root issue #13161). Closing this one, but please keep them coming!

@kodjima33 kodjima33 closed this Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Hey @ikoomm 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our product principles and locked invariants

Before your next PR, please skim:

  • PRODUCT.md — product north star
  • Product invariants — locked rules (shared chat, memory tiers, agent control plane, integrations, brand)

If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing.

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community!

@huiyuansun28-cmyk

Copy link
Copy Markdown
Contributor

PR: #14089

AUTO (AI Agent). Authorship disclosed.

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

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI version and config path fail when config TOML is malformed

4 participants