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

推荐订阅源

Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
量子位
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
Y
Y Combinator Blog
Vercel News
Vercel News
云风的 BLOG
云风的 BLOG
宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
GbyAI
GbyAI
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
Microsoft Security Blog
Microsoft Security Blog
B
Blog
Last Week in AI
Last Week in AI
有赞技术团队
有赞技术团队
博客园 - 聂微东
腾讯CDC
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks

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
refactor: centralize reply followup drain lifecycle · ope...
steipete · 2026-05-05 · via Recent Commits to openclaw:main

@@ -1148,11 +1148,14 @@ export async function runReplyAgent(params: {

11481148

throw error;

11491149

}

11501150

let runFollowupTurn = queuedRunFollowupTurn;

1151-

let shouldDrainFollowupsAfterReplyOperationClears = false;

1152-

const returnAfterReplyOperationClearsThenDrainFollowups = <T>(value: T): T => {

1153-

shouldDrainFollowupsAfterReplyOperationClears = true;

1151+

let shouldDrainQueuedFollowupsAfterClear = false;

1152+

const returnWithQueuedFollowupDrain = <T>(value: T): T => {

1153+

shouldDrainQueuedFollowupsAfterClear = true;

11541154

return value;

11551155

};

1156+

const drainQueuedFollowupsAfterClear = () => {

1157+

scheduleFollowupDrain(queueKey, runFollowupTurn);

1158+

};

11561159

const prePreflightCompactionCount = activeSessionEntry?.compactionCount ?? 0;

11571160

let preflightCompactionApplied = false;

11581161

@@ -1288,7 +1291,7 @@ export async function runReplyAgent(params: {

12881291

if (!replyOperation.result) {

12891292

replyOperation.fail("run_failed", new Error("reply operation exited with final payload"));

12901293

}

1291-

return returnAfterReplyOperationClearsThenDrainFollowups(runOutcome.payload);

1294+

return returnWithQueuedFollowupDrain(runOutcome.payload);

12921295

}

1293129612941297

const {

@@ -1421,7 +1424,7 @@ export async function runReplyAgent(params: {

14211424

// Otherwise, a late typing trigger (e.g. from a tool callback) can outlive the run and

14221425

// keep the typing indicator stuck.

14231426

if (payloadArray.length === 0) {

1424-

return returnAfterReplyOperationClearsThenDrainFollowups(undefined);

1427+

return returnWithQueuedFollowupDrain(undefined);

14251428

}

1426142914271430

const currentMessageId = sessionCtx.MessageSidFull ?? sessionCtx.MessageSid;

@@ -1453,7 +1456,7 @@ export async function runReplyAgent(params: {

14531456

didLogHeartbeatStrip = payloadResult.didLogHeartbeatStrip;

1454145714551458

if (replyPayloads.length === 0) {

1456-

return returnAfterReplyOperationClearsThenDrainFollowups(undefined);

1459+

return returnWithQueuedFollowupDrain(undefined);

14571460

}

1458146114591462

const successfulCronAdds = runResult.successfulCronAdds ?? 0;

@@ -1870,7 +1873,7 @@ export async function runReplyAgent(params: {

18701873

}

18711874

}

187218751873-

const result = returnAfterReplyOperationClearsThenDrainFollowups(

1876+

const result = returnWithQueuedFollowupDrain(

18741877

finalPayloads.length === 1 ? finalPayloads[0] : finalPayloads,

18751878

);

18761879

@@ -1880,36 +1883,35 @@ export async function runReplyAgent(params: {

18801883

replyOperation.result?.kind === "aborted" &&

18811884

replyOperation.result.code === "aborted_for_restart"

18821885

) {

1883-

return returnAfterReplyOperationClearsThenDrainFollowups({

1886+

return returnWithQueuedFollowupDrain({

18841887

text: "⚠️ Gateway is restarting. Please wait a few seconds and try again.",

18851888

});

18861889

}

18871890

if (replyOperation.result?.kind === "aborted") {

1888-

return returnAfterReplyOperationClearsThenDrainFollowups({ text: SILENT_REPLY_TOKEN });

1891+

return returnWithQueuedFollowupDrain({ text: SILENT_REPLY_TOKEN });

18891892

}

18901893

if (error instanceof GatewayDrainingError) {

18911894

replyOperation.fail("gateway_draining", error);

1892-

return returnAfterReplyOperationClearsThenDrainFollowups({

1895+

return returnWithQueuedFollowupDrain({

18931896

text: "⚠️ Gateway is restarting. Please wait a few seconds and try again.",

18941897

});

18951898

}

18961899

if (error instanceof CommandLaneClearedError) {

18971900

replyOperation.fail("command_lane_cleared", error);

1898-

return returnAfterReplyOperationClearsThenDrainFollowups({

1901+

return returnWithQueuedFollowupDrain({

18991902

text: "⚠️ Gateway is restarting. Please wait a few seconds and try again.",

19001903

});

19011904

}

19021905

replyOperation.fail("run_failed", error);

19031906

// Keep the followup queue moving even when an unexpected exception escapes

19041907

// the run path; the caller still receives the original error.

1905-

returnAfterReplyOperationClearsThenDrainFollowups(undefined);

1908+

returnWithQueuedFollowupDrain(undefined);

19061909

throw error;

19071910

} finally {

1908-

replyOperation.complete();

1909-

if (shouldDrainFollowupsAfterReplyOperationClears) {

1910-

// Same-session follow-up turns create their own ReplyOperation; start them

1911-

// only after this run clears the active-run guard.

1912-

scheduleFollowupDrain(queueKey, runFollowupTurn);

1911+

if (shouldDrainQueuedFollowupsAfterClear) {

1912+

replyOperation.completeThen(drainQueuedFollowupsAfterClear);

1913+

} else {

1914+

replyOperation.complete();

19131915

}

19141916

blockReplyPipeline?.stop();

19151917

typing.markRunComplete();