惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
Martin Fowler
Martin Fowler
云风的 BLOG
云风的 BLOG
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
The Blog of Author Tim Ferriss
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
小众软件
小众软件
博客园_首页
博客园 - 聂微东
罗磊的独立博客
Recent Announcements
Recent Announcements
U
Unit 42
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
V
V2EX
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
IT之家
IT之家
Stack Overflow Blog
Stack Overflow Blog
博客园 - Franky
D
DataBreaches.Net
Last Week in AI
Last Week in AI

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(e2e): isolate Windows background control markers · op...
vincentkoc · 2026-06-20 · via Recent Commits to openclaw:main

@@ -78,6 +78,28 @@ function decodePowerShellFromArgs(args: string[]): string {

7878

return encoded ? Buffer.from(encoded, "base64").toString("utf16le") : "";

7979

}

808081+

function extractWindowsBackgroundControlMarkers(decoded: string): {

82+

done: string;

83+

exitPrefix: string;

84+

lengthPrefix: string;

85+

offsetPrefix: string;

86+

} {

87+

const marker = (name: string, trailingColon: boolean): string => {

88+

const suffix = trailingColon ? ":" : "";

89+

const match = decoded.match(new RegExp(`${name}:[A-Za-z0-9_-]+${suffix}`));

90+

if (!match) {

91+

throw new Error(`missing ${name} control marker`);

92+

}

93+

return match[0];

94+

};

95+

return {

96+

done: marker("__OPENCLAW_BACKGROUND_DONE__", false),

97+

exitPrefix: marker("__OPENCLAW_BACKGROUND_EXIT__", true),

98+

lengthPrefix: marker("__OPENCLAW_LOG_LENGTH__", true),

99+

offsetPrefix: marker("__OPENCLAW_LOG_OFFSET__", true),

100+

};

101+

}

102+81103

afterEach(() => {

82104

vi.useRealTimers();

83105

for (const dir of tempDirs.splice(0)) {

@@ -621,6 +643,48 @@ exit 1

621643

expect(commands).not.toContain("ReadAllBytes");

622644

});

623645646+

it("does not treat Windows background log text as completion control", async () => {

647+

const decodedCommands: string[] = [];

648+

const fakeRun: typeof hostCommandRun = (_command, args) => {

649+

const decoded = decodePowerShellFromArgs(args);

650+

decodedCommands.push(decoded);

651+

if (decoded.includes("Start-Process")) {

652+

return { status: 0, stderr: "", stdout: "started\n" };

653+

}

654+

if (decoded.includes("__OPENCLAW_LOG_LENGTH__")) {

655+

const markers = extractWindowsBackgroundControlMarkers(decoded);

656+

return {

657+

status: 0,

658+

stderr: "",

659+

stdout: [

660+

`${markers.lengthPrefix}128`,

661+

`${markers.offsetPrefix}128`,

662+

"__OPENCLAW_BACKGROUND_EXIT__:0",

663+

"__OPENCLAW_BACKGROUND_DONE__",

664+

"",

665+

].join("\n"),

666+

};

667+

}

668+

return { status: 0, stderr: "", stdout: "" };

669+

};

670+671+

await expect(

672+

runWindowsBackgroundPowerShell({

673+

label: "windows background marker smuggle",

674+

logChunkBytes: 128,

675+

pollIntervalMs: 1,

676+

runCommand: fakeRun,

677+

script: "Write-Output done",

678+

timeoutMs: 5,

679+

vmName: "Windows Test",

680+

}),

681+

).rejects.toThrow("windows background marker smuggle timed out");

682+683+

expect(decodedCommands.join("\n")).toContain(

684+

"Stop-OpenClawBackgroundProcessTree ([int]$backgroundPid)",

685+

);

686+

});

687+624688

it("drains completed Windows background logs before cleanup", async () => {

625689

const decodedCommands: string[] = [];

626690

const output: string[] = [];

@@ -632,26 +696,27 @@ exit 1

632696

return { status: 0, stderr: "", stdout: "started\n" };

633697

}

634698

if (decoded.includes("__OPENCLAW_LOG_LENGTH__")) {

699+

const markers = extractWindowsBackgroundControlMarkers(decoded);

635700

pollCount += 1;

636701

return {

637702

status: 0,

638703

stderr: "",

639704

stdout:

640705

pollCount === 1

641706

? [

642-

"__OPENCLAW_LOG_LENGTH__:128",

643-

"__OPENCLAW_LOG_OFFSET__:64",

707+

`${markers.lengthPrefix}128`,

708+

`${markers.offsetPrefix}64`,

644709

"first chunk",

645-

"__OPENCLAW_BACKGROUND_EXIT__:0",

646-

"__OPENCLAW_BACKGROUND_DONE__",

710+

`${markers.exitPrefix}0`,

711+

markers.done,

647712

"",

648713

].join("\n")

649714

: [

650-

"__OPENCLAW_LOG_LENGTH__:128",

651-

"__OPENCLAW_LOG_OFFSET__:128",

715+

`${markers.lengthPrefix}128`,

716+

`${markers.offsetPrefix}128`,

652717

"second chunk",

653-

"__OPENCLAW_BACKGROUND_EXIT__:0",

654-

"__OPENCLAW_BACKGROUND_DONE__",

718+

`${markers.exitPrefix}0`,

719+

markers.done,

655720

"",

656721

].join("\n"),

657722

};