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

推荐订阅源

WordPress大学
WordPress大学
腾讯CDC
阮一峰的网络日志
阮一峰的网络日志
GbyAI
GbyAI
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
Google DeepMind News
Google DeepMind News
MyScale Blog
MyScale Blog
Last Week in AI
Last Week in AI
F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
G
Google Developers Blog
博客园_首页
有赞技术团队
有赞技术团队
V
V2EX
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
MongoDB | Blog
MongoDB | Blog
H
Help Net Security
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub 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(discord): keep exec approval fallbacks reachable · op...
steipete · 2026-04-29 · via Recent Commits to openclaw:main

@@ -1,5 +1,9 @@

11

import { beforeAll, beforeEach, describe, expect, it, vi, type Mock } from "vitest";

22

import type { OpenClawConfig } from "../../config/config.js";

3+

import {

4+

clearApprovalNativeRouteStateForTest,

5+

createApprovalNativeRouteReporter,

6+

} from "../../infra/approval-native-route-coordinator.js";

37

import type { SessionBindingRecord } from "../../infra/outbound/session-binding-service.js";

48

import type {

59

AcpRuntime,

@@ -701,7 +705,14 @@ describe("dispatchReplyFromConfig", () => {

701705

}),

702706

outbound: {

703707

deliveryMode: "direct",

704-

shouldSuppressLocalPayloadPrompt: ({ payload }: { payload: ReplyPayload }) =>

708+

shouldSuppressLocalPayloadPrompt: ({

709+

payload,

710+

hint,

711+

}: {

712+

payload: ReplyPayload;

713+

hint?: { nativeRouteActive?: boolean };

714+

}) =>

715+

hint?.nativeRouteActive === true &&

705716

Boolean(

706717

payload.channelData &&

707718

typeof payload.channelData === "object" &&

@@ -719,6 +730,7 @@ describe("dispatchReplyFromConfig", () => {

719730

},

720731

]),

721732

);

733+

clearApprovalNativeRouteStateForTest();

722734

acpManagerRuntimeMocks.getAcpSessionManager.mockReset();

723735

acpManagerRuntimeMocks.getAcpSessionManager.mockReturnValue(createMockAcpSessionManager());

724736

resetInboundDedupe();

@@ -2581,7 +2593,7 @@ describe("dispatchReplyFromConfig", () => {

25812593

expect(replyResolver).toHaveBeenCalledTimes(1);

25822594

});

258325952584-

it("suppresses local discord exec approval tool prompts when discord approvals are enabled", async () => {

2596+

it("keeps local discord exec approval tool prompts when the native runtime is inactive", async () => {

25852597

setNoAbort();

25862598

const cfg = {

25872599

channels: {

@@ -2616,12 +2628,67 @@ describe("dispatchReplyFromConfig", () => {

2616262826172629

await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });

261826302619-

expect(dispatcher.sendToolResult).not.toHaveBeenCalled();

2631+

expect(dispatcher.sendToolResult).toHaveBeenCalledWith(

2632+

expect.objectContaining({ text: "Approval required." }),

2633+

);

26202634

expect(dispatcher.sendFinalReply).toHaveBeenCalledWith(

26212635

expect.objectContaining({ text: "done" }),

26222636

);

26232637

});

262426382639+

it("suppresses local discord exec approval tool prompts when the native runtime is active", async () => {

2640+

setNoAbort();

2641+

const cfg = {

2642+

channels: {

2643+

discord: {

2644+

enabled: true,

2645+

execApprovals: {

2646+

enabled: true,

2647+

approvers: ["123"],

2648+

},

2649+

},

2650+

},

2651+

} as OpenClawConfig;

2652+

const reporter = createApprovalNativeRouteReporter({

2653+

handledKinds: new Set(["exec"]),

2654+

channel: "discord",

2655+

channelLabel: "Discord",

2656+

accountId: "default",

2657+

requestGateway: async <T>() => ({ ok: true }) as T,

2658+

});

2659+

reporter.start();

2660+

try {

2661+

const dispatcher = createDispatcher();

2662+

const ctx = buildTestCtx({

2663+

Provider: "discord",

2664+

Surface: "discord",

2665+

AccountId: "default",

2666+

});

2667+

const replyResolver = vi.fn(async (_ctx: MsgContext, options?: GetReplyOptions) => {

2668+

await options?.onToolResult?.({

2669+

text: "Approval required.",

2670+

channelData: {

2671+

execApproval: {

2672+

approvalId: "12345678-1234-1234-1234-123456789012",

2673+

approvalSlug: "12345678",

2674+

allowedDecisions: ["allow-once", "allow-always", "deny"],

2675+

},

2676+

},

2677+

});

2678+

return { text: "done" } as ReplyPayload;

2679+

});

2680+2681+

await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });

2682+2683+

expect(dispatcher.sendToolResult).not.toHaveBeenCalled();

2684+

expect(dispatcher.sendFinalReply).toHaveBeenCalledWith(

2685+

expect.objectContaining({ text: "done" }),

2686+

);

2687+

} finally {

2688+

await reporter.stop();

2689+

}

2690+

});

2691+26252692

it("deduplicates same-agent inbound replies across main and direct session keys", async () => {

26262693

setNoAbort();

26272694

const cfg = emptyConfig;