Skip to content

fix(microsoft-foundry): keep connection test error truncation UTF-16 safe#102605

Merged
steipete merged 2 commits into
openclaw:mainfrom
Pandah97:fix/onboard-truncate-utf16
Jul 9, 2026
Merged

fix(microsoft-foundry): keep connection test error truncation UTF-16 safe#102605
steipete merged 2 commits into
openclaw:mainfrom
Pandah97:fix/onboard-truncate-utf16

Conversation

@Pandah97

@Pandah97 Pandah97 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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 truncateUtf16Safe helper at the same 200-code-unit limit. The regression suite drives the exported testFoundryConnection path 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, focused oxlint, and git diff --check passed for the touched files.
  • Live Microsoft Azure proof on 2026-07-09: an unauthenticated request to https://management.azure.com/ returned HTTP 400, application/json, and the documented structured error envelope.
  • Microsoft Foundry's official REST guidance identifies structured error bodies and 400/503 status handling: https://learn.microsoft.com/en-us/azure/ai-services/reference/rest-api-resources

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.

…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.
@clawsweeper

clawsweeper Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 9, 2026, 6:50 AM ET / 10:50 UTC.

Summary
The PR replaces two Microsoft Foundry connection-test error-body slices with truncateUtf16Safe and adds a mocked regression test for 400/503 UTF-16 boundary cases.

PR surface: Source +1, Tests +36. Total +37 across 2 files.

Reproducibility: yes. source-reproducible: current main uses body.slice(0, 200) before displaying Foundry connection-test error notes, and a surrogate pair at that boundary can be split. I did not run a live Foundry setup path in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted after-fix terminal output, logs, copied live output, or a short recording from a Foundry connection-test error path showing the operator note after this change.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body has mocked test evidence and a live Azure 400 contract check, but not an after-fix real Foundry connection-test run or redacted runtime output for the changed note; add terminal output, logs, copied live output, or a recording with private details redacted, then update the PR body to trigger re-review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] The only remaining merge-relevant gap is proof: the PR has source and mocked-test evidence, but not a real after-fix Foundry connection-test transcript/log showing the changed operator-facing note path.

Maintainer options:

  1. Decide the mitigation before merge
    Land the narrow helper substitution after a redacted real connection-test transcript/log or an explicit maintainer proof override shows the changed message path.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated repair job is appropriate because the patch has no code finding; the remaining action is contributor real-behavior proof or a maintainer proof override.

Security
Cleared: The diff only adds an existing SDK helper import and mocked regression coverage; it does not change dependencies, workflows, secrets, package resolution, permissions, or install/runtime execution surfaces.

Review details

Best 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 body.slice(0, 200) before displaying Foundry connection-test error notes, and a surrogate pair at that boundary can be split. I did not run a live Foundry setup path in this read-only review.

Is this the best way to solve the issue?

Yes, the implementation is the narrow maintainable fix: reuse the existing plugin-SDK truncateUtf16Safe helper at the two display truncation sites. The remaining blocker is proof sufficiency, not code shape.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 5154fe08fa0b.

Label changes

Label justifications:

  • P3: This is a low-risk plugin onboarding text-quality fix for an edge-case Unicode truncation issue with no config, migration, auth, or runtime routing change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body has mocked test evidence and a live Azure 400 contract check, but not an after-fix real Foundry connection-test run or redacted runtime output for the changed note; add terminal output, logs, copied live output, or a recording with private details redacted, then update the PR body to trigger re-review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1, Tests +36. Total +37 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 2 +1
Tests 1 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 39 2 +37

What I checked:

Likely related people:

  • Pick-cat: Authored the merged bounded-read change for the same testFoundryConnection error branches and added the adjacent connection-test regression file. (role: recent area contributor; confidence: high; commits: eb5fb2aa69f4; files: extensions/microsoft-foundry/onboard.ts, extensions/microsoft-foundry/onboard.connection.test.ts)
  • haxudev: Authored the merged PR that added the Microsoft Foundry provider and its onboarding implementation, including the relevant onboard.ts and auth.ts surfaces. (role: introduced feature; confidence: high; commits: 0f56125a8f05, 32b9e9af4e46, 3a69eb6a172a; files: extensions/microsoft-foundry/onboard.ts, extensions/microsoft-foundry/auth.ts)
  • vincentkoc: Merged the bounded-read PR for this exact connection-test branch and has several recent Microsoft Foundry onboarding/auth commits in the file history. (role: recent area contributor and merger; confidence: medium; commits: eb5fb2aa69f4, 15806717d995, 0a8dfc21be9f; files: extensions/microsoft-foundry/onboard.ts, extensions/microsoft-foundry/auth.ts)
  • steipete: Has recent plugin SDK surface history and authored the current PR's added regression test, which makes them relevant for review routing even though the PR author remains the proposer. (role: adjacent owner signal; confidence: medium; commits: 827b0de0ce74, e5c1617e4604; files: src/plugin-sdk/text-utility-runtime.ts, extensions/microsoft-foundry/onboard.connection.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-09T09:37:21.871Z sha 21503e3 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Land-ready proof for exact head e5c1617e46044789d3ea31bb657e31ed6cc17db3:

  • Reviewed the Microsoft Foundry connection probe across request construction, Azure response handling, and onboarding notes; both HTTP 400 validation errors and other non-success responses now use the same UTF-16-safe preview boundary.
  • Added parameterized exact regressions for 400 and 503 responses at an emoji boundary. Focused Microsoft Foundry tests pass (3 tests).
  • A live unauthenticated request to https://management.azure.com/ returned the expected structured HTTP 400 Azure error, confirming the exercised response family; Microsoft documents structured REST error responses including 400 validation and 503 transient failures.
  • oxfmt, focused oxlint, git diff --check, and fresh branch autoreview pass clean. Native OPENCLAW_TESTBOX=1 scripts/pr prepare-run 102605 accepted exact-head hosted CI/Testbox.

No authenticated resource mutation was needed; request routing and status classification are unchanged. No changelog entry or known proof gaps.

@steipete
steipete merged commit c067802 into openclaw:main Jul 9, 2026
95 checks passed
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants