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

推荐订阅源

IT之家
IT之家
C
CXSECURITY Database RSS Feed - CXSecurity.com
V
Visual Studio Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
小众软件
小众软件
L
LangChain Blog
Cyberwarzone
Cyberwarzone
美团技术团队
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
V
V2EX
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
L
LINUX DO - 最新话题
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
aimingoo的专栏
aimingoo的专栏
人人都是产品经理
人人都是产品经理
F
Full Disclosure
V2EX - 技术
V2EX - 技术
The Cloudflare Blog
博客园 - 叶小钗
T
Threat Research - Cisco Blogs
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Latest news
Latest news
S
Security @ Cisco Blogs
Spread Privacy
Spread Privacy
Project Zero
Project Zero
K
Kaspersky official blog
MyScale Blog
MyScale Blog
Attack and Defense Labs
Attack and Defense Labs
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
Hacker News - Newest:
Hacker News - Newest: "LLM"
大猫的无限游戏
大猫的无限游戏
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
WordPress大学
WordPress大学
C
Cybersecurity and Infrastructure Security Agency CISA
Webroot Blog
Webroot Blog
罗磊的独立博客
Vercel News
Vercel News
N
News and Events Feed by Topic
A
Arctic Wolf
C
CERT Recently Published Vulnerability Notes

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 test: trim doctor command hotspots · openclaw/openclaw@c66f16a test: isolate agent auth and spawn hotspots · openclaw/openclaw@9285935 test: stabilize MCP startup disposal race · openclaw/openclaw@dd9d2eb test: merge browser contract server suites · openclaw/openclaw@5817a76 test: narrow ollama provider discovery setup · openclaw/openclaw@a0d9598 build: declare qa-lab aimock runtime dependency · openclaw/openclaw@24431e5 test: speed up safe-bins exec harness · openclaw/openclaw@ee856ab test: preserve tool helpers in embedded runner mocks · openclaw/openclaw@acd86a0 refactor: move memory embeddings into provider plugins · openclaw/openclaw@77e6e4c test: reuse system-run temp fixtures · openclaw/openclaw@7e9ff0f test: trim hotspot wait overhead · openclaw/openclaw@12a59b0 Check: avoid duplicate boundary prep · openclaw/openclaw@baf11b8 test: reduce hotspot fixture overhead · openclaw/openclaw@3a59edd feat(ui): overhaul settings and slash command UX (#67819) thanks @Bun… · openclaw/openclaw@2cfb660 QA Matrix: exit cleanly on failure · openclaw/openclaw@42805d2 QA Matrix: isolate scenario coverage · openclaw/openclaw@7e659e1 Matrix: refresh crypto bootstrap state · openclaw/openclaw@94081d8 QA Lab: add provider registry · openclaw/openclaw@bb7e982 Matrix: add plugin changelog · openclaw/openclaw@4acab55 test: trim more hotspot overhead · openclaw/openclaw@f485311 test: trim remaining hotspot tests · openclaw/openclaw@6ba8626 test: narrow hotspot mocks · openclaw/openclaw@dbc8179 test: isolate gemini embedding request helpers · openclaw/openclaw@cd330f5 test: trim memory and mcp hotspots · openclaw/openclaw@fd48dfa test: slim provider registry mocks · openclaw/openclaw@2e08c77 test: harden Parallels update smoke · openclaw/openclaw@1a98090 feat: default Anthropic to Opus 4.7 · openclaw/openclaw@628b454 fix: harden node-host shell payload mutability checks · openclaw/openclaw@75c551e fix: land node-host approval binding for native binaries (#66731) (th… · openclaw/openclaw@29919bb CI: add daily schedule to CodeQL workflow (#67645) · openclaw/openclaw@69d25f5 fix(gateway): capture config hash after plugin auto-enable to prevent… · openclaw/openclaw@8c11210 fix: repair sanitized replay tool results before send (#67620) (thank… · openclaw/openclaw@c3c7a99 fix: restrict HTML timeout short-circuit to transient statuses · openclaw/openclaw@de129a6 fix: keep TUI watchdog bound to active run (#67401) (thanks @xantorres) · openclaw/openclaw@3525273 Gateway/skills: dedupe skills prefix-match + drop dead fallback on log · openclaw/openclaw@d7f489f Extensions/lmstudio: back off inference preload after consecutive fai… · openclaw/openclaw@b555214 TUI/streaming: add watchdog that resets the activity indicator after … · openclaw/openclaw@f44ab20 Agents/tool-loop: enable unknown-tool stream guard by default · openclaw/openclaw@36ed367 Gateway/skills: invalidate session skills snapshot on config write · openclaw/openclaw@b23d59a fix: classify HTML provider error pages correctly (#67642) (thanks @s… · openclaw/openclaw@e588e90 fix(skills): remove unused model-usage import (#67641) · openclaw/openclaw@55f05df docs(changelog): credit codex fix superseded PRs · openclaw/openclaw@e485f24 fix(openai-codex): normalize stale transport metadata in resolution a… · openclaw/openclaw@90801ba CI: pin Docker-related GitHub Actions (#67632) · openclaw/openclaw@f697b01 Android: modernize WebView and discovery API usage (#67627) · openclaw/openclaw@44a6e50 fix(deps): bump hono to 4.12.14 and @hono/node-server to 1.19.14 (GHS… · openclaw/openclaw@fbccc18 fix(deps): bump dompurify to 3.4.0 (#67614) · openclaw/openclaw@2c2dc00 CI: add explicit permissions to all workflow jobs (fixes code-scannin… · openclaw/openclaw@01b7516 fix: register bundled TTS providers and route overrides correctly (#6… · openclaw/openclaw@6ea3cdd fix: align host tilde paths with OS home (#62804) (thanks @stainlu) · openclaw/openclaw@ecfaf64 fix: flush creds queue before reconnect socket open (#67464) (thanks … · openclaw/openclaw@405c63f fix: strip standalone <function> tool call tags from visible text (#6… · openclaw/openclaw@78df859 fix(agents): preserve cli session metadata before transcript persist … · openclaw/openclaw@898fd04 docs(changelog): move cli transcript entry · openclaw/openclaw@c1817c6 fix(agents): normalize cli transcript api field · openclaw/openclaw@3a3fae0 docs(changelog): note cli transcript persistence · openclaw/openclaw@6c343f1 fix(agents): persist cli transcript turns · openclaw/openclaw@b8ef507 fix(msteams): harden security-sensitive flows (#65841) · openclaw/openclaw@c56b56e [Dashboard] Fix exec approval modal overflow for long command content… · openclaw/openclaw@053c5b0 Docs: remove QA changelog entry · openclaw/openclaw@7fd5771 QA: fix private runtime source loading (#67428) · openclaw/openclaw@d5933af docs(gateway): correct protocol.md schema path, hello-ok example, aut… · openclaw/openclaw@489404d CI: pin Node 22 runners to 22.18.0 · openclaw/openclaw@4ffa621 models.authStatus: normalize provider ids + tighten env-backed escape… · openclaw/openclaw@f2fdb9d Update CHANGELOG.md · openclaw/openclaw@7694a92 test(parallels): clean up npm update guard jobs · openclaw/openclaw@045ea7b Plugins: prefer scanDir override paths · openclaw/openclaw@b2974da fix(dreaming): default storage.mode to "separate" so phase blocks sto… · openclaw/openclaw@8c392f0 fix(memory-core): skip dreaming transcript ingestion via session stor… · openclaw/openclaw@a1b01f0 fix: dedupe replayed exec.finished node events (#67281) · openclaw/openclaw@5dcf526
test: use platform spy helpers · openclaw/openclaw@d350ac3
vincentkoc · 2026-05-17 · via Recent Commits to openclaw:main

@@ -6,6 +6,7 @@ import type { DatabaseSync } from "node:sqlite";

66

import { setTimeout as scheduleNativeTimeout } from "node:timers";

77

import type { Mock } from "vitest";

88

import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";

9+

import { withMockedWindowsPlatform } from "../../../../src/test-utils/vitest-spies.js";

9101011

const { logWarnMock, logDebugMock, logInfoMock } = vi.hoisted(() => ({

1112

logWarnMock: vi.fn(),

@@ -1917,47 +1918,47 @@ describe("QmdMemoryManager", () => {

19171918

});

1918191919191920

it("resolves bare qmd command to a Windows-compatible spawn invocation", async () => {

1920-

const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");

1921-

const previousPath = process.env.PATH;

1922-

try {

1923-

const nodeModulesDir = path.join(tmpRoot, "node_modules");

1924-

const shimDir = path.join(nodeModulesDir, ".bin");

1925-

const packageDir = path.join(nodeModulesDir, "qmd");

1926-

const scriptPath = path.join(packageDir, "dist", "cli.js");

1927-

await fs.mkdir(path.dirname(scriptPath), { recursive: true });

1928-

await fs.mkdir(shimDir, { recursive: true });

1929-

await fs.writeFile(path.join(shimDir, "qmd.cmd"), "@echo off\r\n", "utf8");

1930-

await fs.writeFile(

1931-

path.join(packageDir, "package.json"),

1932-

JSON.stringify({ name: "qmd", version: "0.0.0", bin: { qmd: "dist/cli.js" } }),

1933-

"utf8",

1934-

);

1935-

await fs.writeFile(scriptPath, "module.exports = {};\n", "utf8");

1936-

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

1921+

await withMockedWindowsPlatform(async () => {

1922+

const previousPath = process.env.PATH;

1923+

try {

1924+

const nodeModulesDir = path.join(tmpRoot, "node_modules");

1925+

const shimDir = path.join(nodeModulesDir, ".bin");

1926+

const packageDir = path.join(nodeModulesDir, "qmd");

1927+

const scriptPath = path.join(packageDir, "dist", "cli.js");

1928+

await fs.mkdir(path.dirname(scriptPath), { recursive: true });

1929+

await fs.mkdir(shimDir, { recursive: true });

1930+

await fs.writeFile(path.join(shimDir, "qmd.cmd"), "@echo off\r\n", "utf8");

1931+

await fs.writeFile(

1932+

path.join(packageDir, "package.json"),

1933+

JSON.stringify({ name: "qmd", version: "0.0.0", bin: { qmd: "dist/cli.js" } }),

1934+

"utf8",

1935+

);

1936+

await fs.writeFile(scriptPath, "module.exports = {};\n", "utf8");

1937+

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

193719381938-

const { manager } = await createManager({ mode: "status" });

1939-

await manager.sync({ reason: "manual" });

1939+

const { manager } = await createManager({ mode: "status" });

1940+

await manager.sync({ reason: "manual" });

194019411941-

const qmdCalls = spawnMock.mock.calls.filter((call: unknown[]) => {

1942-

const args = call[1] as string[] | undefined;

1943-

return (

1944-

Array.isArray(args) &&

1945-

args.some((token) => token === "update" || token === "search" || token === "query")

1946-

);

1947-

});

1948-

expect(qmdCalls.length).toBeGreaterThan(0);

1949-

for (const call of qmdCalls) {

1950-

const command = String(call[0]);

1951-

const options = call[2] as { shell?: boolean } | undefined;

1952-

expect(command).not.toMatch(/(^|[\\/])qmd\.cmd$/i);

1953-

expect(options?.shell).not.toBe(true);

1954-

}

1942+

const qmdCalls = spawnMock.mock.calls.filter((call: unknown[]) => {

1943+

const args = call[1] as string[] | undefined;

1944+

return (

1945+

Array.isArray(args) &&

1946+

args.some((token) => token === "update" || token === "search" || token === "query")

1947+

);

1948+

});

1949+

expect(qmdCalls.length).toBeGreaterThan(0);

1950+

for (const call of qmdCalls) {

1951+

const command = String(call[0]);

1952+

const options = call[2] as { shell?: boolean } | undefined;

1953+

expect(command).not.toMatch(/(^|[\\/])qmd\.cmd$/i);

1954+

expect(options?.shell).not.toBe(true);

1955+

}

195519561956-

await manager.close();

1957-

} finally {

1958-

platformSpy.mockRestore();

1959-

process.env.PATH = previousPath;

1960-

}

1957+

await manager.close();

1958+

} finally {

1959+

process.env.PATH = previousPath;

1960+

}

1961+

});

19611962

});

1962196319631964

it("keeps mixed Han-script BM25 queries intact before qmd search", async () => {

@@ -3210,125 +3211,125 @@ describe("QmdMemoryManager", () => {

32103211

});

3211321232123213

it("resolves mcporter to a direct Windows entrypoint without enabling shell mode", async () => {

3213-

const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");

3214-

const previousPath = process.env.PATH;

3215-

try {

3216-

const nodeModulesDir = path.join(tmpRoot, "node_modules");

3217-

const shimDir = path.join(nodeModulesDir, ".bin");

3218-

const packageDir = path.join(nodeModulesDir, "mcporter");

3219-

const scriptPath = path.join(packageDir, "dist", "cli.js");

3220-

await fs.mkdir(path.dirname(scriptPath), { recursive: true });

3221-

await fs.mkdir(shimDir, { recursive: true });

3222-

await fs.writeFile(path.join(shimDir, "mcporter.cmd"), "@echo off\r\n", "utf8");

3223-

await fs.writeFile(

3224-

path.join(packageDir, "package.json"),

3225-

JSON.stringify({ name: "mcporter", version: "0.0.0", bin: { mcporter: "dist/cli.js" } }),

3226-

"utf8",

3227-

);

3228-

await fs.writeFile(scriptPath, "module.exports = {};\n", "utf8");

3229-

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

3230-3231-

cfg = {

3232-

...cfg,

3233-

memory: {

3234-

backend: "qmd",

3235-

qmd: {

3236-

includeDefaultMemory: false,

3237-

update: { interval: "0s", debounceMs: 60_000, onBoot: false },

3238-

paths: [{ path: workspaceDir, pattern: "**/*.md", name: "workspace" }],

3239-

mcporter: { enabled: true, serverName: "qmd", startDaemon: false },

3214+

await withMockedWindowsPlatform(async () => {

3215+

const previousPath = process.env.PATH;

3216+

try {

3217+

const nodeModulesDir = path.join(tmpRoot, "node_modules");

3218+

const shimDir = path.join(nodeModulesDir, ".bin");

3219+

const packageDir = path.join(nodeModulesDir, "mcporter");

3220+

const scriptPath = path.join(packageDir, "dist", "cli.js");

3221+

await fs.mkdir(path.dirname(scriptPath), { recursive: true });

3222+

await fs.mkdir(shimDir, { recursive: true });

3223+

await fs.writeFile(path.join(shimDir, "mcporter.cmd"), "@echo off\r\n", "utf8");

3224+

await fs.writeFile(

3225+

path.join(packageDir, "package.json"),

3226+

JSON.stringify({ name: "mcporter", version: "0.0.0", bin: { mcporter: "dist/cli.js" } }),

3227+

"utf8",

3228+

);

3229+

await fs.writeFile(scriptPath, "module.exports = {};\n", "utf8");

3230+

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

3231+3232+

cfg = {

3233+

...cfg,

3234+

memory: {

3235+

backend: "qmd",

3236+

qmd: {

3237+

includeDefaultMemory: false,

3238+

update: { interval: "0s", debounceMs: 60_000, onBoot: false },

3239+

paths: [{ path: workspaceDir, pattern: "**/*.md", name: "workspace" }],

3240+

mcporter: { enabled: true, serverName: "qmd", startDaemon: false },

3241+

},

32403242

},

3241-

},

3242-

} as OpenClawConfig;

3243+

} as OpenClawConfig;

324332443244-

spawnMock.mockImplementation((_cmd: string, args: string[]) => {

3245-

const child = createMockChild({ autoClose: false });

3246-

if (args[0] === "call") {

3247-

emitAndClose(child, "stdout", JSON.stringify({ results: [] }));

3245+

spawnMock.mockImplementation((_cmd: string, args: string[]) => {

3246+

const child = createMockChild({ autoClose: false });

3247+

if (args[0] === "call") {

3248+

emitAndClose(child, "stdout", JSON.stringify({ results: [] }));

3249+

return child;

3250+

}

3251+

emitAndClose(child, "stdout", "[]");

32483252

return child;

3249-

}

3250-

emitAndClose(child, "stdout", "[]");

3251-

return child;

3252-

});

3253+

});

325332543254-

const { manager } = await createManager();

3255-

await manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" });

3255+

const { manager } = await createManager();

3256+

await manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" });

325632573257-

const mcporterCall = spawnMock.mock.calls.find((call: unknown[]) =>

3258-

(call[1] as string[] | undefined)?.includes("call"),

3259-

);

3260-

const searchCall = requireValue(mcporterCall, "mcporter search call missing");

3261-

const callCommand = searchCall[0];

3262-

expect(typeof callCommand).toBe("string");

3263-

const options = searchCall[2] as { shell?: boolean } | undefined;

3264-

expect(callCommand).not.toBe("mcporter.cmd");

3265-

expect(options?.shell).not.toBe(true);

3258+

const mcporterCall = spawnMock.mock.calls.find((call: unknown[]) =>

3259+

(call[1] as string[] | undefined)?.includes("call"),

3260+

);

3261+

const searchCall = requireValue(mcporterCall, "mcporter search call missing");

3262+

const callCommand = searchCall[0];

3263+

expect(typeof callCommand).toBe("string");

3264+

const options = searchCall[2] as { shell?: boolean } | undefined;

3265+

expect(callCommand).not.toBe("mcporter.cmd");

3266+

expect(options?.shell).not.toBe(true);

326632673267-

await manager.close();

3268-

} finally {

3269-

platformSpy.mockRestore();

3270-

process.env.PATH = previousPath;

3271-

}

3268+

await manager.close();

3269+

} finally {

3270+

process.env.PATH = previousPath;

3271+

}

3272+

});

32723273

});

3273327432743275

it("fails closed on Windows EINVAL cmd-shim failures instead of retrying through the shell", async () => {

3275-

const platformSpy = vi.spyOn(process, "platform", "get").mockReturnValue("win32");

3276-

const previousPath = process.env.PATH;

3277-

try {

3278-

const shimDir = await fs.mkdtemp(path.join(tmpRoot, "mcporter-shim-"));

3279-

await fs.writeFile(path.join(shimDir, "mcporter.cmd"), "@echo off\n");

3280-

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

3281-3282-

cfg = {

3283-

...cfg,

3284-

memory: {

3285-

backend: "qmd",

3286-

qmd: {

3287-

includeDefaultMemory: false,

3288-

update: { interval: "0s", debounceMs: 60_000, onBoot: false },

3289-

paths: [{ path: workspaceDir, pattern: "**/*.md", name: "workspace" }],

3290-

mcporter: { enabled: true, serverName: "qmd", startDaemon: false },

3276+

await withMockedWindowsPlatform(async () => {

3277+

const previousPath = process.env.PATH;

3278+

try {

3279+

const shimDir = await fs.mkdtemp(path.join(tmpRoot, "mcporter-shim-"));

3280+

await fs.writeFile(path.join(shimDir, "mcporter.cmd"), "@echo off\n");

3281+

process.env.PATH = `${shimDir};${previousPath ?? ""}`;

3282+3283+

cfg = {

3284+

...cfg,

3285+

memory: {

3286+

backend: "qmd",

3287+

qmd: {

3288+

includeDefaultMemory: false,

3289+

update: { interval: "0s", debounceMs: 60_000, onBoot: false },

3290+

paths: [{ path: workspaceDir, pattern: "**/*.md", name: "workspace" }],

3291+

mcporter: { enabled: true, serverName: "qmd", startDaemon: false },

3292+

},

32913293

},

3292-

},

3293-

} as OpenClawConfig;

3294+

} as OpenClawConfig;

329432953295-

let firstCallCommand: string | null = null;

3296-

spawnMock.mockImplementation((cmd: string, args: string[]) => {

3297-

if (args[0] === "call" && firstCallCommand === null) {

3298-

firstCallCommand = cmd;

3299-

}

3300-

if (args[0] === "call" && typeof cmd === "string" && cmd.toLowerCase().endsWith(".cmd")) {

3296+

let firstCallCommand: string | null = null;

3297+

spawnMock.mockImplementation((cmd: string, args: string[]) => {

3298+

if (args[0] === "call" && firstCallCommand === null) {

3299+

firstCallCommand = cmd;

3300+

}

3301+

if (args[0] === "call" && typeof cmd === "string" && cmd.toLowerCase().endsWith(".cmd")) {

3302+

const child = createMockChild({ autoClose: false });

3303+

queueMicrotask(() => {

3304+

const err = Object.assign(new Error("spawn EINVAL"), { code: "EINVAL" });

3305+

child.emit("error", err);

3306+

});

3307+

return child;

3308+

}

33013309

const child = createMockChild({ autoClose: false });

3302-

queueMicrotask(() => {

3303-

const err = Object.assign(new Error("spawn EINVAL"), { code: "EINVAL" });

3304-

child.emit("error", err);

3305-

});

3310+

emitAndClose(child, "stdout", "[]");

33063311

return child;

3307-

}

3308-

const child = createMockChild({ autoClose: false });

3309-

emitAndClose(child, "stdout", "[]");

3310-

return child;

3311-

});

3312+

});

331233133313-

const { manager } = await createManager();

3314-

await expect(

3315-

manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" }),

3316-

).rejects.toThrow(/without shell execution|EINVAL/);

3317-

const attemptedCmdShim = (firstCallCommand ?? "").toLowerCase().endsWith(".cmd");

3318-

if (attemptedCmdShim) {

3319-

expect(

3320-

spawnMock.mock.calls.some(

3321-

(call: unknown[]) =>

3322-

call[0] === "mcporter" &&

3323-

(call[2] as { shell?: boolean } | undefined)?.shell === true,

3324-

),

3325-

).toBe(false);

3314+

const { manager } = await createManager();

3315+

await expect(

3316+

manager.search("hello", { sessionKey: "agent:main:slack:dm:u123" }),

3317+

).rejects.toThrow(/without shell execution|EINVAL/);

3318+

const attemptedCmdShim = (firstCallCommand ?? "").toLowerCase().endsWith(".cmd");

3319+

if (attemptedCmdShim) {

3320+

expect(

3321+

spawnMock.mock.calls.some(

3322+

(call: unknown[]) =>

3323+

call[0] === "mcporter" &&

3324+

(call[2] as { shell?: boolean } | undefined)?.shell === true,

3325+

),

3326+

).toBe(false);

3327+

}

3328+

await manager.close();

3329+

} finally {

3330+

process.env.PATH = previousPath;

33263331

}

3327-

await manager.close();

3328-

} finally {

3329-

platformSpy.mockRestore();

3330-

process.env.PATH = previousPath;

3331-

}

3332+

});

33323333

});

3333333433343335

it("passes manager-scoped XDG env to mcporter commands", async () => {