fix(microsoft-foundry): keep Azure CLI error truncation UTF-16 safe#102604
Conversation
Replace `.slice(0, 300)` with `truncateUtf16Safe(normalized, 300)` in summarizeAzErrorMessage to prevent surrogate pair corruption. Ref. lsr911 pattern — mechanical substitution, no behavior change.
|
Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 6:43 AM ET / 10:43 UTC. Summary PR surface: Source +1, Tests +16. Total +17 across 2 files. Reproducibility: yes. from source inspection: current main uses Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the narrow helper substitution after the PR gains redacted real behavior proof for the Azure CLI fallback error path, or after a maintainer explicitly overrides that proof gate for this mechanical formatting fix. Do we have a high-confidence way to reproduce the issue? Yes, from source inspection: current main uses Is this the best way to solve the issue? Yes; using the existing plugin-SDK AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e635cdbbe941. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +16. Total +17 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
Land-ready proof for exact head
No live Azure login is needed because command execution, authentication, and error classification are unchanged; this is isolated fallback-message formatting. No changelog entry or known proof gaps. |
|
Merged via squash.
|
…penclaw#102604) * fix(microsoft-foundry): keep Azure CLI error truncation UTF-16 safe Replace `.slice(0, 300)` with `truncateUtf16Safe(normalized, 300)` in summarizeAzErrorMessage to prevent surrogate pair corruption. Ref. lsr911 pattern — mechanical substitution, no behavior change. * test(microsoft-foundry): cover UTF-16-safe CLI errors * test(microsoft-foundry): assert complete CLI error --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Microsoft Foundry surfaces unexpected Azure CLI stderr/stdout in a bounded authentication error. The fallback path used raw
.slice(0, 300), so supplementary Unicode crossing that UTF-16 boundary could leave a dangling surrogate in the operator-facing error.Why This Change Was Made
The Foundry-owned error summarizer now uses the existing plugin-SDK
truncateUtf16Safehelper at the same 300-code-unit limit. Existing classifications for missing Azure CLI, login, subscription, tenant, and AADSTS errors remain unchanged.The regression test drives the public async token command path with a mocked
execFilefailure and asserts the complete propagatedError.messageat the exact emoji boundary.User Impact
Unexpected Azure CLI authentication details remain valid and readable when they contain supplementary Unicode. Command execution, timeout, classification, auth flow, and configuration are unchanged.
Evidence
node ../../node_modules/vitest/vitest.mjs run --config test/vitest/vitest.extension-providers.config.ts extensions/microsoft-foundry/index.test.ts— 92 tests passed.oxlintandgit diff --checkpassed for the touched files.getAccessTokenResultAsync→execAzAsync→buildAzCommandErrorpath, not the helper in isolation.No live Azure request is needed for this local child-process error-formatting boundary; the Azure API and successful CLI paths are unchanged.
AI-assisted
This PR was generated with Claude Code and improved/reviewed with Codex.