Repository navigation
fix(cli): keep diagnostics working when config TOML is malformed - #13167
Conversation
There was a problem hiding this comment.
1 issue found across 5 files
Confidence score: 4/5
backend/utils/task_integrations_ops.pychanges the endpoint while the Todoist E2E regression test still expects/rest/v2/tasks, so the suite will fail until the migration is reflected in the test; update the expectation to verify the intended endpoint.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/utils/task_integrations_ops.py">
<violation number="1" location="backend/utils/task_integrations_ops.py:256">
P2: This endpoint change breaks the existing Todoist E2E regression test because it still expects `/rest/v2/tasks`. Update the test expectation alongside this migration so the suite passes and verifies the intended endpoint.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| response = await client.post( | ||
| 'https://api.todoist.com/rest/v2/tasks', | ||
| 'https://api.todoist.com/api/v1/tasks', |
There was a problem hiding this comment.
P2: This endpoint change breaks the existing Todoist E2E regression test because it still expects /rest/v2/tasks. Update the test expectation alongside this migration so the suite passes and verifies the intended endpoint.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/utils/task_integrations_ops.py, line 256:
<comment>This endpoint change breaks the existing Todoist E2E regression test because it still expects `/rest/v2/tasks`. Update the test expectation alongside this migration so the suite passes and verifies the intended endpoint.</comment>
<file context>
@@ -253,7 +253,7 @@ async def create_task_internal(
response = await client.post(
- 'https://api.todoist.com/rest/v2/tasks',
+ 'https://api.todoist.com/api/v1/tasks',
headers={'Authorization': f'Bearer {access_token}', 'Content-Type': 'application/json'},
json=body,
</file context>
There was a problem hiding this comment.
This file is no longer part of this PR — the branch was cleaned to contain only the config-TOML fix (sdks/python-cli/omi_cli/config.py + tests/test_config.py). The Todoist endpoint migration lives in its own PR (#13166), where the e2e test assertion was updated in the same change.
omi version, omi config path, and omi --json config path crashed with TOMLDecodeError when the config file was malformed — exactly when those diagnostics are most needed. cfg.load() now returns an empty Config on TOMLDecodeError (same as a missing file), so read-only commands work and config-writing commands can rebuild a healthy default. Failure-Class: none Verification: - 3 new regression tests (load + version + config path with malformed TOML) pass with the fix, fail without it (confirmed via stash) - full config test suite passes
e1e3541 to
5249ead
Compare
load() now records the parse failure (invalid TOML or invalid UTF-8) on Config.load_error instead of silently returning a pristine Config, and save() refuses to overwrite such a file. A write command (config set, config profile use/delete, auth login/logout) can no longer destroy a malformed config the user could still repair by hand; read-only diagnostics (version, config path, --json config path) still work on a corrupt file. Regression tests: malformed TOML, invalid UTF-8, save refusal, and the --json config path branch. Failure-Class: none Verification: - 6 new/updated regression tests fail without the fix (stash proof), pass with it - full tests/test_config.py suite passes (30 tests)
|
Verified independently — nice fix, and good response to the earlier review feedback: all four findings from the previous head are addressed on 16c3dce (load_error recording, UTF-8 handling, save() refusal, --json path test), and the Todoist endpoint change correctly moved out to #13166. What I checked: sdks/python-cli/omi_cli/config.py
sdks/python-cli/tests/test_config.py
Two optional polish ideas for a follow-up (not blocking):
Thanks @anakinsuper — clean, well-scoped robustness fix with the failure modes thought through. Leaving the merge call to the maintainers; nothing here needs product judgment. Automated maintainer-review feedback on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Failure-Class: none Verification: - python -m pytest -q sdks/python-cli/tests/test_config.py (23 passed, 1 skipped)
kodjima33
left a comment
There was a problem hiding this comment.
Scoped bug fix, confirmed not yet fixed on main, tests added/updated, CI has no red required checks (pending).
Summary
Fixes #13161 — with an isolated
OMI_CONFIGcontaining invalid TOML (e.g.active_profile = [),omi version,omi config path, andomi --json config pathall failed withTOMLDecodeError. These diagnostics are most useful precisely when the config needs repair and don't require its contents.Change
cfg.load()now treats malformed TOML and invalid UTF-8 as a recoverable load error for read-only diagnostics, while retaining that state onConfig.load_error.save()refuses to overwrite a config that failed to parse, so write commands cannot silently destroy profiles or credentials that may still be repaired manually.Verification
omi version, human-readableomi config path, and parsed JSONomi --json config pathoutputpython -m pytest -q sdks/python-cli/tests/test_config.py— 23 passed, 1 skippedFailure-Class: none