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

推荐订阅源

爱范儿
爱范儿
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
N
Netflix TechBlog - Medium
GbyAI
GbyAI
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Martin Fowler
Martin Fowler
腾讯CDC
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
WordPress大学
WordPress大学
P
Proofpoint News Feed
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog

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(agents): emit inline exec approval decisions · opencl...
vincentkoc · 2026-06-17 · via Recent Commits to openclaw:main

@@ -114,6 +114,7 @@ const runExecProcessMock = vi.hoisted(() => vi.fn());

114114

const sendExecApprovalFollowupResultMock = vi.hoisted(() =>

115115

vi.fn<SendExecApprovalFollowupResult>(async () => undefined),

116116

);

117+

const shouldResolveExecApprovalUnavailableInlineMock = vi.hoisted(() => vi.fn(() => false));

117118

const enforceStrictInlineEvalApprovalBoundaryMock = vi.hoisted(() =>

118119

vi.fn<StrictInlineEvalBoundary>((value) => ({

119120

approvedByAsk: value.approvedByAsk,

@@ -168,7 +169,7 @@ vi.mock("./bash-tools.exec-host-shared.js", () => ({

168169

enforceStrictInlineEvalApprovalBoundary: enforceStrictInlineEvalApprovalBoundaryMock,

169170

resolveApprovalDecisionOrUndefined: resolveApprovalDecisionOrUndefinedMock,

170171

sendExecApprovalFollowupResult: sendExecApprovalFollowupResultMock,

171-

shouldResolveExecApprovalUnavailableInline: vi.fn(() => false),

172+

shouldResolveExecApprovalUnavailableInline: shouldResolveExecApprovalUnavailableInlineMock,

172173

}));

173174174175

vi.mock("./bash-tools.exec-runtime.js", () => ({

@@ -296,6 +297,8 @@ describe("processGatewayAllowlist", () => {

296297

recordAllowlistMatchesUseMock.mockReset();

297298

resolveApprovalDecisionOrUndefinedMock.mockReset();

298299

resolveApprovalDecisionOrUndefinedMock.mockResolvedValue(undefined);

300+

shouldResolveExecApprovalUnavailableInlineMock.mockReset();

301+

shouldResolveExecApprovalUnavailableInlineMock.mockReturnValue(false);

299302

resolveExecHostApprovalContextMock.mockReset();

300303

resolveExecHostApprovalContextMock.mockReturnValue({

301304

approvals: { allowlist: [], file: { version: 1, agents: {} } },

@@ -449,6 +452,87 @@ describe("processGatewayAllowlist", () => {

449452

expect(serialized).not.toContain("agent-1");

450453

});

451454455+

it("emits a denied security event for inline unavailable approval denials", async () => {

456+

shouldResolveExecApprovalUnavailableInlineMock.mockReturnValue(true);

457+

createExecApprovalDecisionStateMock.mockReturnValue({

458+

baseDecision: { timedOut: false },

459+

approvedByAsk: false,

460+

deniedReason: "user-denied",

461+

});

462+

enforceStrictInlineEvalApprovalBoundaryMock.mockReturnValue({

463+

approvedByAsk: false,

464+

deniedReason: "user-denied",

465+

});

466+

const captured = captureSecurityEvents();

467+468+

try {

469+

await expect(

470+

runGatewayAllowlist({

471+

command: "deploy --token raw-secret-value",

472+

agentId: "agent-1",

473+

}),

474+

).rejects.toThrow("denied");

475+

} finally {

476+

captured.stop();

477+

}

478+479+

expect(captured.events).toHaveLength(2);

480+

expect(captured.events[1]).toMatchObject({

481+

action: "exec.approval.denied",

482+

outcome: "denied",

483+

severity: "medium",

484+

reason: "user-denied",

485+

policy: { id: "exec.approval", decision: "deny", reason: "user-denied" },

486+

attributes: {

487+

has_agent_id: true,

488+

},

489+

});

490+

const serialized = JSON.stringify(captured.events);

491+

expect(serialized).not.toContain("deploy");

492+

expect(serialized).not.toContain("raw-secret-value");

493+

expect(serialized).not.toContain("agent-1");

494+

});

495+496+

it("emits an approved security event for inline unavailable approval approvals", async () => {

497+

shouldResolveExecApprovalUnavailableInlineMock.mockReturnValue(true);

498+

createExecApprovalDecisionStateMock.mockReturnValue({

499+

baseDecision: { timedOut: false },

500+

approvedByAsk: true,

501+

deniedReason: null,

502+

});

503+

enforceStrictInlineEvalApprovalBoundaryMock.mockReturnValue({

504+

approvedByAsk: true,

505+

deniedReason: null,

506+

});

507+

const captured = captureSecurityEvents();

508+509+

let result: Awaited<ReturnType<typeof runGatewayAllowlist>>;

510+

try {

511+

result = await runGatewayAllowlist({

512+

command: "echo ok",

513+

agentId: "agent-1",

514+

});

515+

} finally {

516+

captured.stop();

517+

}

518+519+

expect(result!).toEqual({

520+

execCommandOverride: undefined,

521+

allowWithoutEnforcedCommand: true,

522+

});

523+

expect(captured.events).toHaveLength(2);

524+

expect(captured.events[1]).toMatchObject({

525+

action: "exec.approval.approved",

526+

outcome: "success",

527+

severity: "medium",

528+

policy: { id: "exec.approval", decision: "allow" },

529+

attributes: {

530+

has_agent_id: true,

531+

},

532+

});

533+

expect(JSON.stringify(captured.events)).not.toContain("agent-1");

534+

});

535+452536

it("auto-reviews simple read-only approval misses without prompting", async () => {

453537

requiresExecApprovalMock.mockReturnValue(true);

454538

evaluateShellAllowlistMock.mockReturnValue({