omi icon indicating copy to clipboard operation
omi copied to clipboard

Python CLI: define UTF-8 pipe support for conversation create on Windows

Open shai3 opened this issue 2 months ago • 2 comments

Product fit (see PRODUCT.md)

  • [x] Fits the memory-first loop: preserving imported conversation text at capture.
  • Primary loop layer: Capture.
  • [x] No locked-product-invariant exception is proposed; this is a CLI input-contract question.

Is your feature request related to a problem? Please describe.

GitHub Copilot is assisting @shai3 with this report and proposal.

The documented omi --json conversation create --text - --language fr path reads redirected text through sys.stdin.read(). On Windows, UTF-8 bytes from a producer are consequently interpreted using the Python process's stdin encoding, which may be cp1252.

At revision 1310062b7b676c7886249124a8701f3270b0740a, a hermetic Python 3.12.10 fresh-process diagnostic invoked the real CLI entry point and intercepted its outgoing request with respx while socket connections were blocked. It supplied UTF-8 bytes for caf\u00e9 through a subprocess pipe, without replacing stdin decoding:

Input and process Captured request text (Unicode escapes) Result
UTF-8 pipe, -X utf8=0, stdin cp1252 caf\u00c3\u00a9 One request; exit 0 and normal success JSON
Same UTF-8 pipe, -X utf8=1 caf\u00e9 Text preserved
Direct Unicode --text, -X utf8=0 caf\u00e9 Text preserved

The relevant stdin code is unchanged in 9ff63a63b047ec756b6a4e3d726bac5bf5d6440e. No live Omi account or service was used, and no customer impact is claimed.

Important qualification: the docs advertise piped input but do not specify its encoding. This demonstrates a producer/consumer encoding mismatch, not a violation of an existing documented UTF-8 contract. Locale-encoded pipelines may be intentional.

Describe the solution you'd like

Would the project like an explicit UTF-8 contract for redirected input to this command? If so, @josancamon19, would you approve US$5 via PayPal after an accepted merge for that bounded change, focused regression coverage, and documentation?

Proposed acceptance scope, subject to your agreement:

  • UTF-8 redirected input reaches the conversation request unchanged regardless of the host locale.
  • Undecodable input fails before HTTP with a clear structured usage error.
  • Direct --text arguments and interactive input retain their current behavior.
  • Documentation states the supported pipe encoding, with regression coverage for the non-UTF-8 Windows case and the existing behavior controls.

Standardizing redirected input on UTF-8 would change behavior for existing locale-encoded pipes. If those must remain compatible, please specify a preferred bounded opt-in approach before any implementation; I am not treating that product choice as settled.

Describe alternatives you've considered

Enabling Python UTF-8 mode already preserves the text in the diagnostic and is a working alternative. Keeping the current locale-based behavior and documenting how producers and consumers must agree on encoding is another option.

Additional context

Merged #12965 addresses a separate JSON-file import path, not raw stdin for conversation creation. Searches of related issues and open/closed/merged PRs found no matching raw-stdin proposal at the time of this report.

Only diagnosis has been performed: no implementation or PR exists. I will wait for explicit scope and paid-bounty approval before proceeding. No reservation, award, or payment is assumed. Payment details would be provided only through the documented private claim process, never in this issue.

shai3 avatar Sep 08 '26 17:09 shai3

/claim #13332

CreamPle avatar Sep 09 '26 17:09 CreamPle

Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

aryanorastar avatar Nov 05 '26 16:11 aryanorastar