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

推荐订阅源

Vercel News
Vercel News
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
WordPress大学
WordPress大学
G
Google Developers Blog
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
P
Proofpoint News Feed
J
Java Code Geeks
U
Unit 42
云风的 BLOG
云风的 BLOG
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
宝玉的分享
宝玉的分享
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Docker
V
Visual Studio Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Help Net Security
V
V2EX
T
Tailwind CSS 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
fix: preserve terminal session lifecycle state · openclaw...
steipete · 2026-05-03 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -11,6 +11,7 @@ Docs: https://docs.openclaw.ai

1111
1212

### Fixes

1313
14+

- Agents/sessions: preserve terminal lifecycle state when final run metadata persists from a stale in-memory snapshot, preventing `main` sessions from staying stuck as running after completed or timed-out turns.

1415

- Status: show the `openai-codex` OAuth profile for `openai/gpt-*` sessions running through the native Codex runtime instead of reporting auth as unknown. (#76197) Thanks @mbelinky.

1516

- Plugins/externalization: keep diagnostics ClawHub packages and persisted bundled-plugin relocation on npm-first install metadata for launch, and omit Discord from the core package now that its external package is published. Thanks @vincentkoc.

1617

- Plugins/Codex: allow the official npm Codex plugin to install without the unsafe-install override, keep `/codex` command ownership, and cover the real npm Docker live path through managed `.openclaw/npm` dependencies plus uninstall failure proof.

Original file line numberDiff line numberDiff line change

@@ -388,6 +388,63 @@ describe("updateSessionStoreAfterAgentRun", () => {

388388

});

389389

});

390390
391+

it("preserves terminal lifecycle state when caller has a stale running snapshot", async () => {

392+

await withTempSessionStore(async ({ storePath }) => {

393+

const cfg = {} as OpenClawConfig;

394+

const sessionKey = "agent:main:explicit:test-lifecycle-preserve";

395+

const sessionId = "test-lifecycle-preserve-session";

396+

const terminalEntry: SessionEntry = {

397+

sessionId,

398+

updatedAt: 2_000,

399+

status: "done",

400+

startedAt: 1_000,

401+

endedAt: 1_900,

402+

runtimeMs: 900,

403+

};

404+

await fs.writeFile(storePath, JSON.stringify({ [sessionKey]: terminalEntry }, null, 2));

405+
406+

const staleInMemory: Record<string, SessionEntry> = {

407+

[sessionKey]: {

408+

sessionId,

409+

updatedAt: 1_100,

410+

status: "running",

411+

startedAt: 1_000,

412+

},

413+

};

414+
415+

await updateSessionStoreAfterAgentRun({

416+

cfg,

417+

sessionId,

418+

sessionKey,

419+

storePath,

420+

sessionStore: staleInMemory,

421+

defaultProvider: "openai",

422+

defaultModel: "gpt-5.4",

423+

result: {

424+

payloads: [],

425+

meta: {

426+

aborted: false,

427+

agentMeta: {

428+

provider: "openai",

429+

model: "gpt-5.4",

430+

},

431+

},

432+

} as never,

433+

});

434+
435+

const persisted = loadSessionStore(storePath, { skipCache: true })[sessionKey];

436+

expect(persisted).toMatchObject({

437+

status: "done",

438+

startedAt: 1_000,

439+

endedAt: 1_900,

440+

runtimeMs: 900,

441+

modelProvider: "openai",

442+

model: "gpt-5.4",

443+

});

444+

expect(staleInMemory[sessionKey]?.status).toBe("done");

445+

});

446+

});

447+
391448

it("persists latest systemPromptReport for downstream warning dedupe", async () => {

392449

await withTempSessionStore(async ({ storePath }) => {

393450

const sessionKey = "agent:codex:report:test-system-prompt-report";

Original file line numberDiff line numberDiff line change

@@ -36,6 +36,15 @@ function resolvePositiveInteger(value: number | undefined): number | undefined {

3636

return Math.floor(value);

3737

}

3838
39+

function removeLifecycleStateFromMetadataPatch(entry: SessionEntry): SessionEntry {

40+

const next = { ...entry };

41+

delete next.status;

42+

delete next.startedAt;

43+

delete next.endedAt;

44+

delete next.runtimeMs;

45+

return next;

46+

}

47+
3948

export async function updateSessionStoreAfterAgentRun(params: {

4049

cfg: OpenClawConfig;

4150

contextTokensOverride?: number;

@@ -218,8 +227,9 @@ export async function updateSessionStoreAfterAgentRun(params: {

218227

if (compactionsThisRun > 0) {

219228

next.compactionCount = (entry.compactionCount ?? 0) + compactionsThisRun;

220229

}

230+

const metadataPatch = removeLifecycleStateFromMetadataPatch(next);

221231

const persisted = await updateSessionStore(storePath, (store) => {

222-

const merged = mergeSessionEntry(store[sessionKey], next);

232+

const merged = mergeSessionEntry(store[sessionKey], metadataPatch);

223233

store[sessionKey] = merged;

224234

return merged;

225235

});