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

推荐订阅源

L
LangChain Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
量子位
V
V2EX
S
SegmentFault 最新的问题
月光博客
月光博客
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
大猫的无限游戏
大猫的无限游戏
T
Tailwind CSS Blog
博客园_首页
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
Y
Y Combinator Blog
The Cloudflare Blog
C
Check Point Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
腾讯CDC
B
Blog
Stack Overflow Blog
Stack Overflow Blog
P
Proofpoint News Feed

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(gateway): dedupe exec followup continuations (#82717)...
udaymanish6 · 2026-05-17 · via Recent Commits to openclaw:main

@@ -4,7 +4,10 @@ import {

44

} from "../infra/outbound/best-effort-delivery.js";

55

import { sendMessage } from "../infra/outbound/message.js";

66

import { isCronSessionKey, isSubagentSessionKey } from "../sessions/session-key-utils.js";

7-

import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";

7+

import {

8+

normalizeLowercaseStringOrEmpty,

9+

normalizeOptionalString,

10+

} from "../shared/string-coerce.js";

811

import { isGatewayMessageChannel, normalizeMessageChannel } from "../utils/message-channel.js";

912

import { buildExecApprovalFollowupIdempotencyKey } from "./bash-tools.exec-approval-followup-state.js";

1013

import {

@@ -124,6 +127,51 @@ function buildSessionResumeFallbackPrefix(): string {

124127

return "Automatic session resume failed, so sending the status directly.\n\n";

125128

}

126129130+

function readGatewayStatus(value: unknown): string | undefined {

131+

return value && typeof value === "object" && !Array.isArray(value)

132+

? normalizeOptionalString((value as { status?: unknown }).status)

133+

: undefined;

134+

}

135+136+

function readGatewayRunId(value: unknown): string | undefined {

137+

return value && typeof value === "object" && !Array.isArray(value)

138+

? normalizeOptionalString((value as { runId?: unknown }).runId)

139+

: undefined;

140+

}

141+142+

function buildFollowupWaitError(params: { status?: string; error?: unknown }): Error {

143+

const suffix =

144+

typeof params.error === "string" && params.error.trim()

145+

? `: ${params.error.trim()}`

146+

: params.status

147+

? `: ${params.status}`

148+

: "";

149+

return new Error(`exec approval followup session resume failed${suffix}`);

150+

}

151+152+

function isSuccessfulFollowupStatus(status: string | undefined): boolean {

153+

return status === "ok";

154+

}

155+156+

async function waitForAgentFollowupRun(params: {

157+

runId: string;

158+

timeoutMs: number;

159+

}): Promise<void> {

160+

const wait = await callGatewayTool(

161+

"agent.wait",

162+

{ timeoutMs: params.timeoutMs + 2_000 },

163+

{

164+

runId: params.runId,

165+

timeoutMs: params.timeoutMs,

166+

},

167+

);

168+

const status = readGatewayStatus(wait);

169+

if (isSuccessfulFollowupStatus(status)) {

170+

return;

171+

}

172+

throw buildFollowupWaitError({ status, error: wait.error });

173+

}

174+127175

function shouldPrefixDirectFollowupWithSessionResumeFailure(params: {

128176

resultText: string;

129177

sessionError: unknown;

@@ -249,25 +297,34 @@ export async function sendExecApprovalFollowup(

249297250298

if (sessionKey && params.direct !== true) {

251299

try {

252-

await callGatewayTool(

253-

"agent",

254-

{ timeoutMs: 60_000 },

255-

buildAgentFollowupArgs({

256-

approvalId: params.approvalId,

257-

sessionKey,

258-

resultText,

259-

deliveryTarget,

260-

sessionOnlyOriginChannel,

261-

turnSourceChannel: params.turnSourceChannel,

262-

turnSourceTo: params.turnSourceTo,

263-

turnSourceAccountId: params.turnSourceAccountId,

264-

turnSourceThreadId: params.turnSourceThreadId,

265-

internalRuntimeHandoffId: params.internalRuntimeHandoffId,

266-

idempotencyKey: params.idempotencyKey,

267-

}),

268-

{ expectFinal: true },

269-

);

270-

return true;

300+

const agentArgs = buildAgentFollowupArgs({

301+

approvalId: params.approvalId,

302+

sessionKey,

303+

resultText,

304+

deliveryTarget,

305+

sessionOnlyOriginChannel,

306+

turnSourceChannel: params.turnSourceChannel,

307+

turnSourceTo: params.turnSourceTo,

308+

turnSourceAccountId: params.turnSourceAccountId,

309+

turnSourceThreadId: params.turnSourceThreadId,

310+

internalRuntimeHandoffId: params.internalRuntimeHandoffId,

311+

idempotencyKey: params.idempotencyKey,

312+

});

313+

const accepted = await callGatewayTool("agent", { timeoutMs: 60_000 }, agentArgs);

314+

const status = readGatewayStatus(accepted);

315+

if (isSuccessfulFollowupStatus(status)) {

316+

return true;

317+

}

318+

if (status === "accepted" || status === "in_flight" || status === "pending") {

319+

const runId =

320+

readGatewayRunId(accepted) ?? normalizeOptionalString(agentArgs.idempotencyKey);

321+

if (!runId) {

322+

throw buildFollowupWaitError({ status: "missing-run-id" });

323+

}

324+

await waitForAgentFollowupRun({ runId, timeoutMs: 60_000 });

325+

return true;

326+

}

327+

throw buildFollowupWaitError({ status, error: accepted.error });

271328

} catch (err) {

272329

sessionError = err;

273330

}