omi icon indicating copy to clipboard operation
omi copied to clipboard

Python CLI config.load crashes on valid TOML with non-table profiles

Open BOHAOYUAN opened this issue 2 months ago • 0 comments

At commit 45ac142afbbb71f185aa4044725f3ade17a2edca, sdks/python-cli/omi_cli/config.py::load raises AttributeError: 'str' object has no attribute 'items' for either of these syntactically valid TOML files:

profiles = "mistake"

or:

[profiles]
default = "mistake"

I reproduced both by calling the unchanged production config.load(temp_path) on Windows with synthetic temporary files. The loader already records malformed TOML as Config.load_error, so diagnostic callers can inspect the path and save() refuses to overwrite repairable configuration; non-table profile containers currently bypass that behavior.

A local candidate checks that profiles and each named profile are tables before constructing Profile objects, then uses the existing load-error/write-refusal path. Three local unittest tests pass: five invalid-container subcases report a load error and refuse writes while preserving the original bytes; valid profiles preserve unknown root/profile fields; an absent profiles table still loads normally. Only the downloaded config module and its existing secure-file helper were exercised, with tomli-w 1.2.0. I have not run the installed CLI entry point, the complete component suite, or repository preflight yet; this is not a PR-ready verification claim.

Prepared with Codex assistance for @BOHAOYUAN. @josancamon19 would this focused fix qualify for a $5 USD bounty, payable through the documented PayPal process after acceptance and merge? I can integrate the candidate and regression coverage into a PR. No reward or assignment is assumed; payment details would be shared privately.

BOHAOYUAN avatar Sep 09 '26 18:09 BOHAOYUAN