Skip to content

fix(deploy): decode artifact-deploy aws cli output as utf-8 - #24017

Merged
bolichen97 merged 1 commit into
mainfrom
fix/artifact-deploy-utf8-23963
Oct 25, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/artifact-deploy-utf8-23963

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The artifact-deploy attach and detach backend scripts read the aws CLI's output as UTF-8, so non-ASCII names and localized errors arrive intact on Windows.

Both scripts spawn the aws CLI with text=True and no encoding=. Python then decodes the child's output with the locale code page (the ANSI code page on Windows), while the CLI writes UTF-8. Non-ASCII resource names, paths and localized AWS errors come back as mojibake, and a byte that is invalid in the code page raises UnicodeDecodeError.

Why it matters

Anyone attaching or detaching a deploy backend on a non-UTF-8 Windows locale can see garbled CLI output or a crash instead of the real AWS error.

Not a goal

What changed (motivation → approach → change)

Symptom: mojibake or UnicodeDecodeError from the backend scripts on Windows. Cause: the aws() helper in each script decoded the child with the locale code page. Change: each helper now spawns with the shared UTF8_TEXT mapping (UTF-8, errors="replace"), the same shape the deploy engine uses, and both scripts leave the subprocess-encoding baseline.

Backwards compatibility

Compatible: on a UTF-8 locale the decode is unchanged; elsewhere the output is now read as the UTF-8 the CLI already writes.

Removes nothing: only the decode of captured output changes; the baseline shrinks because the two calls are now pinned.

Tests

test/test_artifact_deploy_aws_utf8_decode.py loads each script and pins the keyword arguments its aws() helper hands run_limited: text, encoding="utf-8", errors="replace", plus the existing capture and timeout.

Proof: PROVEN test/test_artifact_deploy_aws_utf8_decode.py::test_aws_helper_decodes_child_output_as_utf8[attach_backend], test/test_artifact_deploy_aws_utf8_decode.py::test_aws_helper_decodes_child_output_as_utf8[detach_backend] (head a5967d9)

Manual verification

N/A - unit coverage sufficient: the change is the decode keywords on one call per script, which the test pins directly.

Related Issues

Closes #23963

Sibling sweep

Swept: git grep -nE "text=True" -- src/kiro_crew/deploy/ and the deploy/cloud entries in .github/subprocess-encoding-baseline.txt
Sibling: src/kiro_crew/deploy/engine.py -- not affected -- already pinned to UTF8_TEXT on main
Sibling: src/kiro_crew/cloud/aws.py -- tracked in #23946
Sibling: src/kiro_crew/deploy/profiles.py:430 -- not affected -- credential_process snippet run by another shell; its output is ASCII JSON credentials

Pattern harvest

Rule candidate: lint
Pattern: text-mode subprocess spawn without a pinned encoding (already enforced by scripts/check_subprocess_encoding.py; 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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 25, 2026 13:47
@bolichen97
bolichen97 requested a review from buluoray October 25, 2026 13:47
@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a5967d9cac54ba05ebce94f437437c39588c45fb 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 the readiness: checking Automated validation is still running label Oct 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of a5967d9cac54ba05ebce94f437437c39588c45fb — 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. The change is a mechanism-level fix that reuses the existing UTF8_TEXT mapping, and it shrinks the subprocess-encoding baseline instead of adding new surface.

What this change ships

Inventory (4 items) — 4 justified

Intent: a person attaching or detaching a deploy backend on a non-UTF-8 Windows locale sees the real AWS CLI output and errors, not garbled text or a crash. This is a FIX.

  1. Attaching a deploy backend now reads aws CLI output as UTF-8, so non-ASCII names and errors are no longer garbled — justified
  2. Detaching a deploy backend now reads aws CLI output as UTF-8 too — justified
  3. Both scripts leave the subprocess-encoding lint baseline, so a regression is now caught — justified
  4. A test pins the decode arguments each script's aws() helper passes to run_limited — justified

[FIRST-PRINCIPLES-REVIEWED] a5967d9

Description read

[DESCRIPTION-READ] 5ebb79cfbe7dc750460f7155553cb0faa581ed003aa8f0b6cb6dcd4df8e33bd1

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of a5967d9cac54ba05ebce94f437437c39588c45fb — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

This is a small decode-only fix. It reuses the UTF8_TEXT shape that deploy/engine.py already uses, and errors="replace" means an encoding mismatch degrades instead of crashing.

Notes

  • The new comment says the CLI writes UTF-8 because it inherits PYTHONUTF8=1. That is unverified for the bundled aws CLI v2 on Windows. If the claim is wrong, the result is replacement characters rather than a crash, and a revert undoes it cleanly.

[DESIGN-REVIEWED] a5967d9

Description read

[DESCRIPTION-READ] b6e160bb948419b779ea36a9da62ce2db013f373e50caf84c15a3f54e109a761

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed a5967d9cac54ba05ebce94f437437c39588c45fb — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a5967d9

Verdict parsed from the review's SHA-scoped output markers for commit a5967d9cac54ba05ebce94f437437c39588c45fb.

False positive or not applicable? A repository writer can comment:
/ai-review override fable a5967d9cac54ba05ebce94f437437c39588c45fb false-positive: <reason, 20 to 500 characters>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of a5967d9cac54ba05ebce94f437437c39588c45fb and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a5967d9

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a5967d9cac54ba05ebce94f437437c39588c45fb false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) October 25, 2026 13:58
@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 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 (4 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 artifact-deploy attach and detach helpers decode the aws CLI output as UTF-8 instead of the locale code page, with a test that pins the arguments passed to run_limited.

@bolichen97
bolichen97 merged commit 6bf094c into main Oct 25, 2026
106 checks passed
@bolichen97
bolichen97 deleted the fix/artifact-deploy-utf8-23963 branch October 25, 2026 15:04
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

artifact-deploy attach/detach_backend scripts decode aws CLI output with the locale code page

2 participants