fix(microsoft-foundry): keep connection test error truncation UTF-16 safe#102605
Conversation
…safe Replace `.slice(0, 200)` with `truncateUtf16Safe(body, 200)` in testFoundryConnection error messages 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:50 AM ET / 10:50 UTC. Summary PR surface: Source +1, Tests +36. Total +37 across 2 files. Reproducibility: yes. source-reproducible: 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
Security Review detailsBest possible solution: Land the narrow helper substitution after a redacted real connection-test transcript/log or an explicit maintainer proof override shows the changed message path. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main uses Is this the best way to solve the issue? Yes, the implementation is the narrow maintainable fix: reuse the existing plugin-SDK AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5154fe08fa0b. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +36. Total +37 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 authenticated resource mutation was needed; request routing and status classification are unchanged. No changelog entry or known proof gaps. |
|
Merged via squash.
|
…safe (openclaw#102605) * fix(microsoft-foundry): keep connection test error truncation UTF-16 safe Replace `.slice(0, 200)` with `truncateUtf16Safe(body, 200)` in testFoundryConnection error messages to prevent surrogate pair corruption. Ref. lsr911 pattern — mechanical substitution, no behavior change. * test(microsoft-foundry): cover UTF-16-safe connection errors --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Microsoft Foundry's connection test includes a bounded response-body preview when the endpoint returns HTTP 400 or another non-success status. Both branches used raw
.slice(0, 200), so supplementary Unicode crossing that UTF-16 boundary could leave a dangling surrogate in the operator-facing note.Why This Change Was Made
Both sibling error branches now use the existing plugin-SDK
truncateUtf16Safehelper at the same 200-code-unit limit. The regression suite drives the exportedtestFoundryConnectionpath for HTTP 400 and 503, places an emoji across the exact boundary, and asserts each complete prompter note.User Impact
Foundry connection-test diagnostics stay valid and readable for Unicode error bodies. Response byte limits, cancellation, status handling, auth, endpoint selection, and the decision to continue after a failed probe are unchanged.
Evidence
node ../../node_modules/vitest/vitest.mjs run --config test/vitest/vitest.extension-providers.config.ts extensions/microsoft-foundry/onboard.connection.test.ts— 3 tests passed.oxfmt, focusedoxlint, andgit diff --checkpassed for the touched files.https://management.azure.com/returned HTTP 400,application/json, and the documented structured error envelope.The live request validates the external error contract; the exact Unicode boundary is injected deterministically at the Foundry connection-test boundary.
AI-assisted
This PR was generated with Claude Code and improved/reviewed with Codex.