Skip to content

fix(windows): preserve Unicode LAN route aliases - #122263

Merged
steipete merged 1 commit into
mainfrom
codex/windows-lan-advertised-host-unicode-main-current
Aug 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/windows-lan-advertised-host-unicode-main-current

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Summary

  • pin the Windows PowerShell route probe to BOM-less UTF-8 before serializing localized adapter aliases
  • keep route selection at the existing resolveAdvertisedLanHostCore owner and remove unused route JSON fields
  • add a real Windows child-process regression plus Windows CI scope/package routing

Root cause and fix

Get-NetRoute | ConvertTo-Json inherited the host console output code page. On localized Windows systems, an adapter alias such as réseau-网卡 could therefore be emitted in a legacy code page while OpenClaw decoded the child output as UTF-8, so the route alias no longer matched os.networkInterfaces() and LAN advertisement could select the wrong fallback address.

The route producer now sets [Console]::OutputEncoding to UTF8Encoding(false) before Get-NetRoute. This is the owner boundary where the bytes are created; callers in pairing, gateway system.info, Control UI links, and device-pair keep consuming the same resolved host. Microsoft documents that Console.OutputEncoding controls console output bytes and that the default code page is locale-dependent: https://learn.microsoft.com/en-us/dotnet/api/system.console.outputencoding and https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_character_encoding

No config, protocol, storage, or public API surface changes.

Verification

  • RED on current main: owner/native focused suite failed 2 assertions because the command did not establish UTF-8
  • GREEN on Windows: owner + native PowerShell contract 7/7
  • GREEN on Windows after formatting: owner, pairing, gateway system info, device-pair, changed-scope, and package routing 178/178
  • authentic child proof forces CP437 first, executes the production prefix, and round-trips réseau-网卡
  • GREEN on Linux: 177 passed, with the one native-Windows test intentionally skipped
  • targeted core/scripts oxlint, formatting, git diff --check, changed-lane classification, and plugin SDK surface gate clean
  • exact seven-file TruffleHog scan clean
  • independent max-P1 review clean
  • structured Sol/high max-P1 review clean, zero findings, correctness 0.97

Change size

  • production: +2/-3 (net -1)
  • tests: +92/-3
  • CI/package routing: +3/-3 (net 0)

Fresh publication guard used main c2ad148cb8b750587217b249d0ade95fcb534bdd: candidate paths had zero drift, the patch was unsuperseded, and merge-tree was clean.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S labels Aug 11, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 6:01 PM ET / 22:01 UTC.

ClawSweeper review

What this changes

The PR makes the Windows PowerShell route probe emit UTF-8 so localized network-adapter aliases continue to match local interfaces when choosing the advertised LAN host.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. Current main still emits the Windows route JSON without an encoding declaration, while this PR corrects that producer boundary and adds native Windows coverage; no blocking patch defect was found. The maintainer label and member authorship require normal maintainer handling rather than automated cleanup.

Priority: P2
Reviewed head: fd08bfdd97898c4cc63df7640a06a50559a2423b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A compact owner-boundary repair with a meaningful native Windows regression, clean routing coverage, and no identified correctness or security issue.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes a native Windows child-process round trip and the provided context reports green Windows CI.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes a native Windows child-process round trip and the provided context reports green Windows CI.
Evidence reviewed 8 items Current-main gap: Current main invokes Get-NetRoute and serializes JSON without first selecting UTF-8 output, so a localized route alias can arrive in a legacy console encoding.
Owner-boundary repair: The PR sets BOM-less UTF-8 at the PowerShell producer and retains only the three JSON fields consumed by the route parser.
Consumer contract: The process runner decodes Windows output through the shared decoder, which accepts strict UTF-8 before falling back to the Windows console encoding; producer UTF-8 therefore preserves the alias consumed by the resolver.
Findings None None.
Security None None.

How this fits together

OpenClaw resolves a LAN address from local network interfaces and, on Windows, uses the default route reported by PowerShell to pick the preferred address. That selected address feeds pairing, gateway system information, and LAN links.

flowchart LR
  A[Local network interfaces] --> C[LAN host resolver]
  B[Windows route probe] --> C
  C --> D[Route alias match]
  D --> E[Selected LAN address]
  E --> F[Pairing and gateway links]
Loading

Decision needed

Question Recommendation
Should this maintainer-owned Windows route-encoding fix be merged using its clean three-way merge result? Merge the focused fix: Accept the owner-boundary encoding correction and its native Windows regression coverage.

Why: The PR carries the protected maintainer label and is authored by a repository member, so automated cleanup must pause for an explicit maintainer choice despite the clean review.

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +89, Config 0, Other 0. Total +88 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 3 -1
Tests 4 92 3 +89
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 1 2 2 0
Total 7 97 9 +88

Review metrics

Metric Value Why it matters
Production versus test delta production +2/-3 (net -1); tests +92/-3; CI routing +3/-3 (net 0) The bug fix reduces production surface while adding a native child-process regression and ensuring that coverage is selected on Windows.

Stored data model

Persistent data-model change detected: migration/backfill/repair: package.json, vector/embedding metadata: scripts/ci-changed-scope.mjs. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Merge the producer-side UTF-8 correction with its native PowerShell regression and existing Windows CI routing retained.

Do we have a high-confidence way to reproduce the issue?

Yes for a high-confidence source path: on Windows, serialize a Unicode route alias after selecting a legacy console encoding, then resolve the advertised host. The PR supplies that native child-process scenario, although this read-only reviewer environment could not rerun PowerShell locally.

Is this the best way to solve the issue?

Yes. Encoding the bytes at the PowerShell producer matches the existing UTF-8-first decoder and avoids a downstream fallback or caller-specific workaround.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 459c70e14a2c.

Labels

Label changes:

  • add P2: This is a bounded Windows LAN-advertisement correctness fix without evidence of an urgent broad outage.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes a native Windows child-process round trip and the provided context reports green Windows CI.

Label justifications:

  • P2: This is a bounded Windows LAN-advertisement correctness fix without evidence of an urgent broad outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🌊 off-meta tidepool and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless describes a native Windows child-process round trip and the provided context reports green Windows CI.

Evidence

What I checked:

  • Current-main gap: Current main invokes Get-NetRoute and serializes JSON without first selecting UTF-8 output, so a localized route alias can arrive in a legacy console encoding. (src/infra/advertised-lan-host.ts:14, 459c70e14a2c)
  • Owner-boundary repair: The PR sets BOM-less UTF-8 at the PowerShell producer and retains only the three JSON fields consumed by the route parser. (src/infra/advertised-lan-host.ts:14, fd08bfdd9789)
  • Consumer contract: The process runner decodes Windows output through the shared decoder, which accepts strict UTF-8 before falling back to the Windows console encoding; producer UTF-8 therefore preserves the alias consumed by the resolver. (src/infra/windows-encoding.ts:166, 459c70e14a2c)
  • Caller coverage: Pairing, displayed Control UI links, gateway system information, and the public gateway runtime all consume the same resolver rather than carrying separate route-selection logic. (src/pairing/setup-code.ts:381, 459c70e14a2c)
  • Native proof and CI routing: The added Windows-only test forces CP437, applies the production prefix, verifies a Unicode JSON alias, and routes both owner and native-proof changes to the Windows lane. (src/infra/advertised-lan-host.windows.test.ts:42, fd08bfdd9789)
  • Exact-head validation: Provided PR context records a successful Windows-node check and a clean CI gate for the PR head. (fd08bfdd9789)

Likely related people:

  • steipete: Peter Steinberger has recent merged history on the LAN-host resolver and authored the proposed owner-boundary repair. (role: recent area refactor author; confidence: high; commits: e7a9f33d8972, fd08bfdd9789; files: src/infra/advertised-lan-host.ts, src/infra/advertised-lan-host.test.ts)
  • vincentkoc: Vincent Koc authored the earlier advertised-host refactor that established this resolver surface. (role: feature-history contributor; confidence: medium; commits: 8091292e3e83; files: src/infra/advertised-lan-host.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit c525f1a into main Aug 11, 2026
133 checks passed
@steipete
steipete deleted the codex/windows-lan-advertised-host-unicode-main-current branch August 11, 2026 22:21
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 11, 2026
* origin/main: (1725 commits)
  fix(agents): preserve reply cleanup when cancellation throws (#122252)
  fix(ui): render disallowed link schemes as plain text (#122311)
  fix(test): isolate gateway helper env stubs (#122319)
  fix(ui): keep chat Markdown block rhythm consistent (#122289)
  test(cli): trim duplicate Hooks process cases (#122278)
  fix(ui): retain identity while agent roster loads
  fix(ui): preserve configured agent labels
  fix(plugins): keep startup convergence read-only (#122330)
  fix: preserve WebChat reply context after reloads (#122169)
  fix(ui): make DONE moves visibly reversible (#122303)
  fix(ui): keep inline-code punctuation attached (#122291)
  fix(google-meet): publish exports atomically (#122306)
  fix(channels): preserve failed agent run reactions (#122009)
  fix(ui): label patch file operations accurately (#122287)
  fix(windows): preserve Unicode LAN route aliases (#122263)
  test(media): synchronize transcode pool completion (#122279)
  fix(android): keep completed subagent activity visible for sixty seconds (#122089)
  fix(ui): humanize bare GitHub item links (#122285)
  refactor(qqbot): install plugin from Tencent package (#107295)
  chore: scope SQLite session lifecycle CI (#121917)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant