Repository navigation
fix(acp): decode mise which output as utf-8 - #23950
Conversation
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: this is a one-line fix to how one output is decoded, and it uses the existing What this change shipsInventory (3 items) — 3 justifiedIntent: on Windows, find a node, kiro-cli or ACP adapter installed with mise when the user's profile folder has a non-ASCII name — FIX.
[FIRST-PRINCIPLES-REVIEWED] e45516a Description read[DESCRIPTION-READ] 69a2a53c775b0e24431c8612e3689593602ce9cfb7fb32cfd815decd5c3d1d62 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is a one-call decode fix that uses the repo's shared [DESIGN-REVIEWED] e45516a Description read[DESCRIPTION-READ] 85596e2578b2cac425a2879b43f3c251a24d475f8a35ce8f8d7eaf08532a96d7 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
CI status on
This PR touches only |
_mise_which ran `mise which <tool>` with text=True and no encoding, so the resolved path was decoded with the locale code page. mise writes the path to a pipe as UTF-8, so on Windows a non-ASCII profile dir (C:\Users\José) came back mangled under cp1252 and the node / kiro-cli / adapter lookup silently fell through, or raised UnicodeDecodeError under a code page that cannot decode the bytes, which escapes the TimeoutExpired/OSError handler. Pin UTF8_TEXT on the call, drop the file from the subprocess-encoding baseline, and add a test that decodes like subprocess does under a cp1252 and an ascii host code page.
a44cc13 to
e45516a
Compare
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (3 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the mise which probe decodes its output as UTF-8, plus a test for a non-ASCII path under a non-UTF-8 code page.
Problem / Motivation
Goal: Kiro Crew finds a mise-installed node, kiro-cli or ACP adapter on Windows even when the user's profile folder has a non-ASCII name.
_mise_which()read the output ofmise which <tool>with the Windows code page instead of UTF-8. For a profile such asC:\Users\José, the path either came back mangled (cp1252), so the lookup silently found nothing, or it raisedUnicodeDecodeError, which escapes the function'sTimeoutExpired/OSErrorhandler.Why it matters
Every ACP backend asks
_mise_whichwhere its binary lives. On a Windows machine whose user name has an accent, CJK character or similar, mise-managed tools are invisible to Kiro Crew. The user then sees a launch that falls back to PATH or fails, and nothing points to encoding as the cause.Not a goal
deploy/engine.pyis handled in its own PR, andenv.py/diagnostics.pyare in fix(core): pin utf-8 on the diagnostics and env subprocess calls #20147.What changed (motivation → approach → change)
mise is a Rust binary. When its stdout is a pipe it writes the path as UTF-8 bytes on every OS. The parent was decoding those bytes with the locale code page, so the child and parent disagreed. The call now passes
**UTF8_TEXTfromsrc/kiro_crew/subprocess_utf8.py, which is the repo's shared "this child writes UTF-8" mapping and is already used at other fixed sites. Witherrors="replace", a malformed byte cannot raise any more: at worst it turns into a path that is not a file, and the existing fall-through handles that.acp/client.pydrops out of.github/subprocess-encoding-baseline.txt, so the gate now holds this file clean.Backwards compatibility
Compatible: ASCII paths decode identically under UTF-8 and every Windows code page; only non-ASCII paths change, from broken to correct.
Removes nothing: the change only pins a decode and deletes a baseline line for a file the gate now finds clean.
Tests
test_non_ascii_path_survives_a_non_utf8_host_codepage[cp1252|ascii]intest/test_acp_client_binary_resolution.pyuses asubprocess.runstand-in that decodes assubprocessdoes: withencoding=when it is given, otherwise with the host code page. It asserts that a real file underJosé/resolves. Without the fix, cp1252 returnsNoneand ascii raisesUnicodeDecodeError. Both runs are deterministic on any host.Determinism:
TestMiseWhichpassed 20/20 at-n0. The whole file passed 10/10 at-n 4, and 37/37 in a seeded shuffled order.Proof: PROVEN test/test_acp_client_binary_resolution.py::TestMiseWhich::test_non_ascii_path_survives_a_non_utf8_host_codepage[cp1252] (head e45516a)
Manual verification
N/A: no Windows host with a non-ASCII profile was available. The parametrised stand-in reproduces both Windows outcomes deterministically.
Related Issues
Closes #23947
Sibling sweep
Swept: git grep -nE '"mise"|mise_bin|[mise' -- src/
Sibling: src/kiro_crew/env.py:1620 -- tracked in #20147
Pattern harvest
Rule candidate: lint
Pattern: text-mode subprocess call without
encoding=. Thescripts/check_subprocess_encoding.pyratchet already enforces this, and this PR shrinks its baseline.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.