Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Python CLI: corrupt compressed responses hide an unknown write outcome

Open Beginner friendly
#21,295 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@pranav440 is already working on this.

Since Oct 12, 2026.

  • #21335 by @pranav440 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start in the Python CLI request handling and the chat streaming handler, which already catches HTTPX DecodingError separately. Reproduce the malformed gzip response with the provided mocked httpx.Response; add regression coverage for write methods, GET recovery and exhaustion, and CLI text and JSON modes. Done means writes return the existing unknown-outcome guidance with exit code 3, while GET follows its retry policy and maps exhausted decoding failures to exit code 3.

Written by the indexing model from the issue text.

Description

On d4f4b788f176fcbc9dc4cb71333e0efaf159789f, a malformed gzip response makes the Python CLI report an unexpected error with exit code 1. For a POST, PATCH, or DELETE, the server may already have applied the write. The CLI should instead preserve its existing outcome unknown error and tell the caller to check the resource before retrying.

This is a local, synthetic reproduction; I am not claiming a production incident. HTTPX raises DecodingError while consuming the response body. It is not a subclass of httpx.TransportError, so the ordinary request handler misses it. The chat streaming handler already catches this exception separately.

Reproduction

Return the following response from a mocked endpoint called through OmiClient:

httpx.Response(
    200,
    headers={"Content-Encoding": "gzip"},
    stream=httpx.ByteStream(b"not a gzip body"),
)

The stream ensures that HTTPX performs the decoding during the actual client request. Calling omi goal create synthetic --target 1 against the mocked endpoint prints an unexpected decompression error and exits 1, including in JSON mode. The write is not automatically replayed today; the defect is the missing unknown-outcome warning and the wrong error classification.

Proposed correction

  • Keep POST, PATCH, and DELETE at one attempt when response decoding fails; use the shared unknown-write-outcome error, exit code 3, and existing check-before-retrying guidance.
  • Let GET use the existing bounded retry policy. After four failed attempts, return a mapped API response-decoding error with exit code 3.
  • Add hermetic regression coverage for all three write methods, GET recovery and exhaustion, and the real CLI entry point in text and JSON modes.

The local implementation adds 11 production lines, changes one existing line, and adds seven regression cases. All seven fail against the unmodified client and pass with the correction. The complete Python CLI suite passes on macOS with Python 3.12: 797 passed, 1 Windows-only test skipped. No live API or customer data was used.

Bounty request

@kodjima33, would you approve a US$50 bounty for this scoped correction and its regression tests? I can provide the patch as a PR if you approve the scope and amount. I understand that eligibility is discretionary and payment requires acceptance and merge under the contribution rules. PayPal is available for payment through the documented private claim process.

Prepared with AI assistance. The implementation and reported tests have been run locally; maintainer review and CI are still pending.

Reference: Omi contribution and bounty rules.

Dominant language
Python
Stars
13.8k
Forks
2.7k
Avg merge
6h 4m
Merged PRs (30d)
610

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BasedHardware/omi

All issues in BasedHardware/omi

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.