Skip to content

fix(acp): decode mise which output as utf-8 - #23950

Merged
KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
IngridMorstrad:fix/acp-mise-which-utf8
Oct 25, 2026
Merged

KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
IngridMorstrad:fix/acp-mise-which-utf8

Conversation

@IngridMorstrad

@IngridMorstrad IngridMorstrad commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

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 of mise which <tool> with the Windows code page instead of UTF-8. For a profile such as C:\Users\José, the path either came back mangled (cp1252), so the lookup silently found nothing, or it raised UnicodeDecodeError, which escapes the function's TimeoutExpired/OSError handler.

Why it matters

Every ACP backend asks _mise_which where 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

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_TEXT from src/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. With errors="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.py drops 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] in test/test_acp_client_binary_resolution.py uses a subprocess.run stand-in that decodes as subprocess does: with encoding= when it is given, otherwise with the host code page. It asserts that a real file under José/ resolves. Without the fix, cp1252 returns None and ascii raises UnicodeDecodeError. Both runs are deterministic on any host.

Determinism: TestMiseWhich passed 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=. The scripts/check_subprocess_encoding.py ratchet already enforces this, and this PR shrinks its baseline.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed e45516a21dc6fd1ae475bc0e49dbc46cba2374ea via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] e45516a

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of e45516a21dc6fd1ae475bc0e49dbc46cba2374ea via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: this is a one-line fix to how one output is decoded, and it uses the existing UTF8_TEXT mapping (already used in 48 other src/ files) instead of adding a new one.

What this change ships

Inventory (3 items) — 3 justified

Intent: 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.

  1. The path printed by mise which is now read as UTF-8, so a profile like José resolves instead of being silently missed or raising — justified
  2. The subprocess-encoding gate now holds acp/client.py clean, because its baseline row is removed — justified
  3. A test pins that a non-ASCII path resolves under cp1252 and ascii host code pages — justified

[FIRST-PRINCIPLES-REVIEWED] e45516a

Description read

[DESCRIPTION-READ] 69a2a53c775b0e24431c8612e3689593602ce9cfb7fb32cfd815decd5c3d1d62

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of e45516a21dc6fd1ae475bc0e49dbc46cba2374ea via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: this is a one-call decode fix that uses the repo's shared UTF8_TEXT mapping, changes behaviour only for non-ASCII paths, and is easy to revert.

[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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed e45516a21dc6fd1ae475bc0e49dbc46cba2374ea via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] e45516a

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 25, 2026
@IngridMorstrad

Copy link
Copy Markdown
Contributor Author

CI status on a44cc13d5 — three red checks, none from this diff:

This PR touches only acp/client.py's _mise_which, its test, and one baseline line. I'll rebase once #23933 lands, which re-runs all three; a maintainer re-run of the failed jobs would also clear them.

_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.
@IngridMorstrad
IngridMorstrad force-pushed the fix/acp-mise-which-utf8 branch from a44cc13 to e45516a Compare October 25, 2026 09:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ⏭️ skipped

Revision e45516a21dc6fd1ae475bc0e49dbc46cba2374ea touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 25, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 25, 2026 12:04

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@KiroCrewCaptain
KiroCrewCaptain merged commit 14fafaf into kirodotdev:main Oct 25, 2026
107 of 115 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

acp: mise which output decoded with the locale code page mangles non-ASCII Windows paths

2 participants