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

推荐订阅源

S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
博客园 - 【当耐特】
月光博客
月光博客
Vercel News
Vercel News
D
Docker
I
InfoQ
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 叶小钗
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
有赞技术团队
有赞技术团队
雷峰网
雷峰网
博客园 - 聂微东
小众软件
小众软件
Y
Y Combinator Blog
腾讯CDC
L
LangChain Blog
The GitHub Blog
The GitHub Blog
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
大猫的无限游戏
大猫的无限游戏
T
The Blog of Author Tim Ferriss

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(subagents): honor archiveAfterMinutes for session-mod...
arniesaha · 2026-05-07 · via Recent Commits to openclaw:main

@@ -36,6 +36,7 @@ import {

3636

reconcileOrphanedRestoredRuns,

3737

reconcileOrphanedRun,

3838

resolveAnnounceRetryDelayMs,

39+

resolveArchiveAfterMs,

3940

resolveSubagentRunOrphanReason,

4041

resolveSubagentSessionStatus,

4142

safeRemoveAttachmentsDir,

@@ -196,8 +197,6 @@ const LIFECYCLE_ERROR_RETRY_GRACE_MS = 15_000;

196197

* `timed out` completion right before the eventual success.

197198

*/

198199

const LIFECYCLE_TIMEOUT_RETRY_GRACE_MS = 15_000;

199-

/** Absolute TTL for session-mode runs after cleanup completes (no archiveAtMs). */

200-

const SESSION_RUN_TTL_MS = 5 * 60_000; // 5 minutes

201200

/** Absolute TTL for orphaned pendingLifecycleError / pendingLifecycleTimeout entries. */

202201

const PENDING_LIFECYCLE_TERMINAL_TTL_MS = 5 * 60_000; // 5 minutes

203202

/** Grace period before treating a "running" subagent without a live run context as stale. */

@@ -751,6 +750,7 @@ async function sweepSubagentRuns() {

751750

try {

752751

const now = Date.now();

753752

const storeCache = new Map<string, Record<string, SessionEntry>>();

753+

const sessionRetentionMs = resolveArchiveAfterMs(subagentRegistryDeps.getRuntimeConfig());

754754

let mutated = false;

755755

for (const [runId, entry] of subagentRuns.entries()) {

756756

if (typeof entry.endedAt !== "number") {

@@ -813,12 +813,18 @@ async function sweepSubagentRuns() {

813813

}

814814

}

815815816-

// Session-mode runs have no archiveAtMs — apply absolute TTL after cleanup completes.

816+

// Session-mode runs have no archiveAtMs because the child session is retained

817+

// independently — but the registry row itself still needs to be reaped after

818+

// cleanup, otherwise `subagents list` and other registry-backed surfaces grow

819+

// without bound. Honor the same `agents.defaults.subagents.archiveAfterMinutes`

820+

// window run-mode uses for `archiveAtMs`, so operators get one consistent

821+

// retention knob (default 60 minutes; 0 disables session-mode reaping).

817822

// Use cleanupCompletedAt (not endedAt) to avoid interrupting deferred cleanup flows.

818823

if (!entry.archiveAtMs) {

819824

if (

825+

typeof sessionRetentionMs === "number" &&

820826

typeof entry.cleanupCompletedAt === "number" &&

821-

now - entry.cleanupCompletedAt > SESSION_RUN_TTL_MS

827+

now - entry.cleanupCompletedAt > sessionRetentionMs

822828

) {

823829

clearPendingLifecycleError(runId);

824830

void notifyContextEngineSubagentEnded({