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

推荐订阅源

P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
Recent Announcements
Recent Announcements
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
J
Java Code Geeks
博客园_首页
Jina AI
Jina AI
美团技术团队
H
Help Net Security
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
S
SegmentFault 最新的问题

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(codex): expose sandbox shell tools for ssh backends ·...
steipete · 2026-05-19 · via Recent Commits to openclaw:main

@@ -39,7 +39,10 @@ import * as authBridge from "./auth-bridge.js";

3939

import { resolveCodexAppServerEnvApiKeyCacheKey } from "./auth-bridge.js";

4040

import type { CodexAppServerClientFactory } from "./client-factory.js";

4141

import { readCodexPluginConfig, resolveCodexAppServerRuntimeOptions } from "./config.js";

42-

import { CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE } from "./dynamic-tools.js";

42+

import {

43+

CODEX_OPENCLAW_DYNAMIC_TOOL_NAMESPACE,

44+

createCodexDynamicToolBridge,

45+

} from "./dynamic-tools.js";

4346

import * as elicitationBridge from "./elicitation-bridge.js";

4447

import {

4548

buildCodexPluginAppCacheKey,

@@ -463,9 +466,14 @@ function createNamedDynamicTool(

463466

};

464467

}

465468466-

function createRuntimeDynamicTool(name: string) {

469+

type RuntimeDynamicToolForTest = Parameters<

470+

typeof createCodexDynamicToolBridge

471+

>[0]["tools"][number];

472+473+

function createRuntimeDynamicTool(name: string): RuntimeDynamicToolForTest {

467474

return {

468475

name,

476+

label: name,

469477

description: `${name} test tool`,

470478

parameters: {

471479

type: "object",

@@ -476,7 +484,7 @@ function createRuntimeDynamicTool(name: string) {

476484

content: [{ type: "text" as const, text: `${name} done` }],

477485

details: {},

478486

})),

479-

} as never;

487+

};

480488

}

481489482490

function createPluginAppConfigPatch() {

@@ -696,6 +704,177 @@ describe("runCodexAppServerAttempt", () => {

696704

expect(testing.resolveCodexDynamicToolsLoading({}, privateQaCodexEnv)).toBe("direct");

697705

});

698706707+

it("exposes OpenClaw sandbox shell tools under distinct names for non-Docker sandbox backends", async () => {

708+

testing.setOpenClawCodingToolsFactoryForTests(() => [

709+

createRuntimeDynamicTool("read"),

710+

createRuntimeDynamicTool("write"),

711+

createRuntimeDynamicTool("edit"),

712+

createRuntimeDynamicTool("apply_patch"),

713+

createRuntimeDynamicTool("exec"),

714+

createRuntimeDynamicTool("process"),

715+

createRuntimeDynamicTool("message"),

716+

]);

717+

const sessionFile = path.join(tempDir, "session.jsonl");

718+

const workspaceDir = path.join(tempDir, "workspace");

719+

const params = createParams(sessionFile, workspaceDir);

720+

params.disableTools = false;

721+

const sandboxSessionKey = params.sessionKey;

722+

if (!sandboxSessionKey) {

723+

throw new Error("createParams must provide a sessionKey for Codex dynamic tool tests.");

724+

}

725+726+

const tools = await testing.buildDynamicTools({

727+

params,

728+

resolvedWorkspace: workspaceDir,

729+

effectiveWorkspace: workspaceDir,

730+

sandboxSessionKey,

731+

sandbox: { enabled: true, backendId: "ssh" } as never,

732+

runAbortController: new AbortController(),

733+

sessionAgentId: "main",

734+

pluginConfig: {},

735+

onYieldDetected: () => undefined,

736+

});

737+738+

expect(tools.map((tool) => tool.name)).toEqual(["message", "sandbox_exec", "sandbox_process"]);

739+

expect(tools.find((tool) => tool.name === "sandbox_exec")?.description).toContain(

740+

"configured sandbox backend",

741+

);

742+

expect(tools.find((tool) => tool.name === "sandbox_process")?.description).toContain(

743+

"sandbox_exec sessions",

744+

);

745+

});

746+747+

it("does not expose sandbox shell tools unless non-Docker sandbox routing is available", async () => {

748+

testing.setOpenClawCodingToolsFactoryForTests(() => [

749+

createRuntimeDynamicTool("exec"),

750+

createRuntimeDynamicTool("process"),

751+

createRuntimeDynamicTool("message"),

752+

]);

753+

const sessionFile = path.join(tempDir, "session.jsonl");

754+

const workspaceDir = path.join(tempDir, "workspace");

755+

const params = createParams(sessionFile, workspaceDir);

756+

params.disableTools = false;

757+

const sandboxSessionKey = params.sessionKey;

758+

if (!sandboxSessionKey) {

759+

throw new Error("createParams must provide a sessionKey for Codex dynamic tool tests.");

760+

}

761+762+

const dockerTools = await testing.buildDynamicTools({

763+

params,

764+

resolvedWorkspace: workspaceDir,

765+

effectiveWorkspace: workspaceDir,

766+

sandboxSessionKey,

767+

sandbox: { enabled: true, backendId: "docker" } as never,

768+

runAbortController: new AbortController(),

769+

sessionAgentId: "main",

770+

pluginConfig: {},

771+

onYieldDetected: () => undefined,

772+

});

773+

const disabledSandboxTools = await testing.buildDynamicTools({

774+

params,

775+

resolvedWorkspace: workspaceDir,

776+

effectiveWorkspace: workspaceDir,

777+

sandboxSessionKey,

778+

sandbox: { enabled: false, backendId: "ssh" } as never,

779+

runAbortController: new AbortController(),

780+

sessionAgentId: "main",

781+

pluginConfig: {},

782+

onYieldDetected: () => undefined,

783+

});

784+785+

expect(dockerTools.map((tool) => tool.name)).toEqual(["message"]);

786+

expect(disabledSandboxTools.map((tool) => tool.name)).toEqual(["message"]);

787+

});

788+789+

it("does not expose sandbox_exec without a matching process follow-up tool", async () => {

790+

testing.setOpenClawCodingToolsFactoryForTests(() => [

791+

createRuntimeDynamicTool("exec"),

792+

createRuntimeDynamicTool("message"),

793+

]);

794+

const sessionFile = path.join(tempDir, "session.jsonl");

795+

const workspaceDir = path.join(tempDir, "workspace");

796+

const params = createParams(sessionFile, workspaceDir);

797+

params.disableTools = false;

798+

const sandboxSessionKey = params.sessionKey;

799+

if (!sandboxSessionKey) {

800+

throw new Error("createParams must provide a sessionKey for Codex dynamic tool tests.");

801+

}

802+803+

const tools = await testing.buildDynamicTools({

804+

params,

805+

resolvedWorkspace: workspaceDir,

806+

effectiveWorkspace: workspaceDir,

807+

sandboxSessionKey,

808+

sandbox: { enabled: true, backendId: "ssh" } as never,

809+

runAbortController: new AbortController(),

810+

sessionAgentId: "main",

811+

pluginConfig: {},

812+

onYieldDetected: () => undefined,

813+

});

814+815+

expect(tools.map((tool) => tool.name)).toEqual(["message"]);

816+

});

817+818+

it("honors Codex dynamic tool excludes for sandbox shell exposure", async () => {

819+

testing.setOpenClawCodingToolsFactoryForTests(() => [

820+

createRuntimeDynamicTool("exec"),

821+

createRuntimeDynamicTool("process"),

822+

createRuntimeDynamicTool("message"),

823+

]);

824+

const sessionFile = path.join(tempDir, "session.jsonl");

825+

const workspaceDir = path.join(tempDir, "workspace");

826+

const params = createParams(sessionFile, workspaceDir);

827+

params.disableTools = false;

828+

const sandboxSessionKey = params.sessionKey;

829+

if (!sandboxSessionKey) {

830+

throw new Error("createParams must provide a sessionKey for Codex dynamic tool tests.");

831+

}

832+833+

for (const excludedToolName of ["sandbox_exec", "process"]) {

834+

const tools = await testing.buildDynamicTools({

835+

params,

836+

resolvedWorkspace: workspaceDir,

837+

effectiveWorkspace: workspaceDir,

838+

sandboxSessionKey,

839+

sandbox: { enabled: true, backendId: "ssh" } as never,

840+

runAbortController: new AbortController(),

841+

sessionAgentId: "main",

842+

pluginConfig: { codexDynamicToolsExclude: [excludedToolName] },

843+

onYieldDetected: () => undefined,

844+

});

845+846+

expect(tools.map((tool) => tool.name)).toEqual(["message"]);

847+

}

848+

});

849+850+

it("points yielded sandbox_exec follow-up guidance at sandbox_process", async () => {

851+

const execTool = createRuntimeDynamicTool("exec");

852+

vi.mocked(execTool.execute).mockResolvedValueOnce({

853+

content: [

854+

{

855+

type: "text",

856+

text: "Command still running (session exec-1, pid 123). Use process (list/poll/log/write/send-keys/submit/paste/kill/clear/remove) for follow-up.",

857+

},

858+

],

859+

details: { status: "running" },

860+

});

861+

const processTool = createRuntimeDynamicTool("process");

862+

const tools = testing.addSandboxShellDynamicToolsIfAvailable([], [execTool, processTool], {

863+

sandbox: { enabled: true, backendId: "ssh" },

864+

pluginConfig: {},

865+

} as never);

866+867+

const sandboxExec = tools.find((tool) => tool.name === "sandbox_exec");

868+

const result = await sandboxExec?.execute("call-1", {}, undefined);

869+870+

expect(result?.content).toEqual([

871+

{

872+

type: "text",

873+

text: "Command still running (session exec-1, pid 123). Use sandbox_process (list/poll/log/write/send-keys/submit/paste/kill/clear/remove) for follow-up.",

874+

},

875+

]);

876+

});

877+699878

it("starts Codex threads without duplicate OpenClaw workspace tools by default", async () => {

700879

const sessionFile = path.join(tempDir, "session.jsonl");

701880

const workspaceDir = path.join(tempDir, "workspace");

@@ -980,13 +1159,15 @@ describe("runCodexAppServerAttempt", () => {

9801159

});

98111609821161

it("normalizes Codex dynamic toolsAllow entries before filtering", () => {

983-

const tools = ["exec", "apply_patch", "read", "message"].map((name) => ({ name }));

1162+

const tools = ["exec", "sandbox_exec", "sandbox_process", "apply_patch", "read", "message"].map(

1163+

(name) => ({ name }),

1164+

);

98411659851166

expect(

9861167

testing

9871168

.filterCodexDynamicToolsForAllowlist(tools, [" BASH ", "apply-patch", "READ"])

9881169

.map((tool) => tool.name),

989-

).toEqual(["exec", "apply_patch", "read"]);

1170+

).toEqual(["exec", "sandbox_exec", "sandbox_process", "apply_patch", "read"]);

9901171

});

99111729921173

it("treats an explicit empty Codex dynamic toolsAllow as no tools", () => {