fix: cap chrome mcp stderr by utf8 bytes · openclaw/openclaw@f4f059e
steipete
·
2026-05-29
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,6 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
5 | 5 | import { |
6 | 6 | clickChromeMcpElement, |
7 | 7 | buildChromeMcpArgs, |
| 8 | +decodeChromeMcpStderrTail, |
8 | 9 | ensureChromeMcpAvailable, |
9 | 10 | evaluateChromeMcpScript, |
10 | 11 | listChromeMcpTabs, |
@@ -451,6 +452,14 @@ describe("chrome MCP page parsing", () => {
|
451 | 452 | expect(message).not.toContain(userDataDir); |
452 | 453 | }); |
453 | 454 | |
| 455 | +it("keeps Chrome MCP stderr tails within the byte cap without splitting UTF-8", () => { |
| 456 | +const output = decodeChromeMcpStderrTail(Buffer.from(`${"x".repeat(8191)}é`)); |
| 457 | + |
| 458 | +expect(output).toMatch(/é$/); |
| 459 | +expect(output).not.toContain("�"); |
| 460 | +expect(Buffer.byteLength(output, "utf8")).toBeLessThanOrEqual(8192); |
| 461 | +}); |
| 462 | + |
454 | 463 | it("parses new_page text responses and returns the created tab", async () => { |
455 | 464 | const factory: ChromeMcpSessionFactory = async () => createFakeSession(); |
456 | 465 | setChromeMcpSessionFactoryForTest(factory); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。