fix(python): add encoding=utf-8 to file reads and writes in sandbox.py#1912
fix(python): add encoding=utf-8 to file reads and writes in sandbox.py#1912mesutoezdil wants to merge 6 commits into
Conversation
…ox.py read_text(), fdopen() without encoding use the system locale, which can differ on non-UTF-8 systems. All config files (metadata.json, oidc_token.json, active_gateway) are UTF-8 text.
PR Review StatusValidation: This is a small, concentrated Python SDK bug fix that makes OpenShell's shared gateway config files use an explicit UTF-8 encoding, matching the Rust-side writers for Review findings:
Docs: not needed; this does not change a documented command, config field, or workflow. Next state: |
|
/ok to test dba017a |
Author Follow-Up NudgeThis PR has been in @mesutoezdil, please respond to the review comments or push an update. If this is no longer planned, please say so and a maintainer can close it out. |
… encoding tests Corrupt or non-UTF-8 oidc_token.json now returns None consistently. Add regression tests for non-ASCII UTF-8 paths in metadata, oidc token, and active_gateway files.
|
Fixed in 7ac0153. Added ensure_ascii=False to test dumps. Added from_active_cluster test writing active_gateway and metadata.json as explicit UTF-8 bytes. |
|
/ok to test c7b876b |
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved:
Remaining items:
Docs: still not needed; this is an internal Python SDK compatibility fix with no documented command, config field, or workflow change. Next state: |
…e_cluster UTF-8 bytes test
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved:
Remaining items:
Docs: still not needed; this is an internal Python SDK compatibility fix with no documented command, config field, or workflow change. Next state: |
Re-check After Author UpdateI re-evaluated latest head Disposition: partially resolved. Resolved:
Remaining items:
Docs: still not needed; this is an internal Python SDK compatibility fix with no documented command, config field, or workflow change. Next state: |
|
ready for re-check on eff441b |
Re-check After Author UpdateI re-evaluated latest head Disposition: resolved. Resolved:
Remaining items:
Docs: still not needed; this is an internal Python SDK compatibility fix with no documented command, config field, or workflow change. E2E: no Next state: |
|
/ok to test eff441b |
CI Failure Needs Author UpdateThe latest head Failure:
Next action: @mesutoezdil, please run Docs: still not needed for this internal Python SDK encoding fix. Next state: |
|
ready for re-check on a6bb809 |
Re-check After Author UpdateI re-evaluated latest head Disposition: resolved. Resolved:
Remaining items:
Docs: still not needed; this is an internal Python SDK compatibility fix with no documented command, config field, or workflow change. E2E: no Next state: |
|
/ok to test a6bb809 |
Maintainer Approval NeededGator validation and PR monitoring are complete. Validation: This is a small, concentrated Python SDK compatibility fix that makes OpenShell sandbox config reads and writes use explicit UTF-8 encoding. Human maintainer approval or merge decision is now required. |
read_text()andfdopen(..., "w")without an explicit encoding use the system locale,which can be non-UTF-8 on some platforms (e.g. Windows).
4 call sites in
sandbox.pyread or write UTF-8 config files without specifying encoding:metadata_path.read_text()gatewaymetadata.jsontoken_path.read_text()oidc_token.jsonos.fdopen(fd, "w")atomic write ofoidc_token.jsonactive_file.read_text()active_gatewayname fileAll 4 are now explicit with
encoding="utf-8".