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

推荐订阅源

MongoDB | Blog
MongoDB | Blog
B
Blog
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
B
Blog RSS Feed
博客园 - Franky
V
V2EX
IT之家
IT之家
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
F
Fortinet All Blogs
I
InfoQ
云风的 BLOG
云风的 BLOG
腾讯CDC
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
Microsoft Security Blog
Microsoft Security 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
test(gateway): accept app-server approval proof · opencla...
vincentkoc · 2026-06-18 · via Recent Commits to openclaw:main

@@ -258,17 +258,21 @@ async function writeLiveGatewayConfig(params: {

258258

async function requestAgentTextWithEvents(params: {

259259

client: GatewayClient;

260260

eventPrefix?: string;

261+

eventPrefixes?: string[];

261262

includeAllSessions?: boolean;

262263

message: string;

263264

sessionKey: string;

264265

}): Promise<{ text: string; events: CapturedAgentEvent[] }> {

265266

const { extractPayloadText } = await import("./test-helpers.agent-results.js");

266267

const { onAgentEvent } = await import("../infra/agent-events.js");

267268

const events: CapturedAgentEvent[] = [];

268-

const eventPrefix = params.eventPrefix ?? "codex_app_server.guardian";

269+

const eventPrefixes = params.eventPrefixes ?? [

270+

params.eventPrefix ?? "codex_app_server.guardian",

271+

"approval",

272+

];

269273

const unsubscribe = onAgentEvent((event) => {

270274

if (

271-

!event.stream.startsWith(eventPrefix) ||

275+

!eventPrefixes.some((prefix) => event.stream.startsWith(prefix)) ||

272276

(!params.includeAllSessions && event.sessionKey && event.sessionKey !== params.sessionKey)

273277

) {

274278

return;

@@ -643,6 +647,22 @@ function findGuardianReviewStatus(events: CapturedAgentEvent[]): "approved" | "d

643647

return status === "approved" || status === "denied" ? status : undefined;

644648

}

645649650+

function findAppServerApprovalStatus(

651+

events: CapturedAgentEvent[],

652+

): "approved" | "denied" | undefined {

653+

const status = events.findLast(

654+

(event) =>

655+

event.stream === "approval" &&

656+

event.data?.phase === "resolved" &&

657+

event.data?.kind === "exec",

658+

)?.data?.status;

659+

return status === "approved" || status === "denied" ? status : undefined;

660+

}

661+662+

function hasGuardianReviewEvents(events: CapturedAgentEvent[]): boolean {

663+

return events.some((event) => event.stream === "codex_app_server.guardian");

664+

}

665+646666

function assertGuardianReviewCompleted(params: {

647667

events: CapturedAgentEvent[];

648668

label: string;

@@ -664,6 +684,27 @@ function assertGuardianReviewCompleted(params: {

664684

return completedEvents.at(-1);

665685

}

666686687+

function assertAppServerApprovalResolved(params: {

688+

events: CapturedAgentEvent[];

689+

expectedStatus: "approved" | "denied";

690+

label: string;

691+

}): CapturedAgentEvent {

692+

const approvalEvent = params.events.findLast(

693+

(event) =>

694+

event.stream === "approval" &&

695+

event.data?.phase === "resolved" &&

696+

event.data?.kind === "exec",

697+

);

698+

expect(

699+

approvalEvent,

700+

`${params.label} expected an OpenClaw app-server approval resolution; events=${JSON.stringify(

701+

params.events,

702+

)}`,

703+

).toBeDefined();

704+

expect(approvalEvent?.data?.status).toBe(params.expectedStatus);

705+

return approvalEvent as CapturedAgentEvent;

706+

}

707+667708

async function verifyCodexGuardianProbe(params: {

668709

client: GatewayClient;

669710

setPluginApprovalDecision?: (decision: GuardianPluginApprovalDecision | undefined) => void;

@@ -687,6 +728,7 @@ async function verifyCodexGuardianProbe(params: {

687728

const allowReview = assertGuardianReviewCompleted({

688729

events: allowResult.events,

689730

label: "allow probe",

731+

requireEvents: false,

690732

});

691733

const allowStatus = findGuardianReviewStatus(allowResult.events);

692734

if (allowStatus === "denied") {

@@ -696,8 +738,21 @@ async function verifyCodexGuardianProbe(params: {

696738

expect(allowResult.text.toLowerCase()).toMatch(/approv|permission|guardian|reject|denied/);

697739

expect(allowReview?.data?.status).toBe("denied");

698740

} else {

741+

if (!allowReview) {

742+

expect(

743+

hasGuardianReviewEvents(allowResult.events),

744+

`allow probe emitted Guardian review events without a completed event; events=${JSON.stringify(

745+

allowResult.events,

746+

)}`,

747+

).toBe(false);

748+

assertAppServerApprovalResolved({

749+

events: allowResult.events,

750+

expectedStatus: "approved",

751+

label: "allow probe",

752+

});

753+

}

699754

expect(allowResult.text).toContain(allowToken);

700-

expect(allowStatus ?? "approved").toBe("approved");

755+

expect(allowStatus ?? findAppServerApprovalStatus(allowResult.events)).toBe("approved");

701756

}

702757703758

const askBackToken = `OPENCLAW-GUARDIAN-ASK-BACK-${randomBytes(3).toString("hex").toUpperCase()}`;

@@ -1064,11 +1119,7 @@ describeLive("gateway live (Codex harness)", () => {

10641119

}

10651120

resolvedGuardianPluginApprovalIds.add(approvalId);

10661121

void approvalClient

1067-

.request(

1068-

"plugin.approval.resolve",

1069-

{ id: approvalId, decision },

1070-

{ timeoutMs: 30_000 },

1071-

)

1122+

.request("plugin.approval.resolve", { id: approvalId, decision }, { timeoutMs: 30_000 })

10721123

.then(() => {

10731124

logCodexLiveStep("guardian-plugin-approval:resolved", { approvalId, decision });

10741125

})