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

推荐订阅源

WordPress大学
WordPress大学
Jina AI
Jina AI
小众软件
小众软件
GbyAI
GbyAI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 【当耐特】
D
DataBreaches.Net
腾讯CDC
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
The Blog of Author Tim Ferriss
S
SegmentFault 最新的问题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
云风的 BLOG
云风的 BLOG
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
有赞技术团队
有赞技术团队
U
Unit 42
博客园 - 司徒正美
博客园 - 聂微东

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(codex): stabilize app-server cleanup tests · openclaw...
vincentkoc · 2026-06-01 · via Recent Commits to openclaw:main
11

import fs from "node:fs/promises";

22

import path from "node:path";

33

import {

4+

abortAndDrainAgentHarnessRun,

45

nativeHookRelayTesting,

56

queueAgentHarnessMessage,

67

resetAgentEventsForTest,

@@ -30,6 +31,8 @@ const appServerHarnessWait = { interval: 1, timeout: 120_000 } as const;

3031

const activeAppServerAttemptsForTest = new Set<{

3132

abortController?: AbortController;

3233

promise: Promise<unknown>;

34+

sessionId: string;

35+

sessionKey?: string;

3336

}>();

34373538

type RunCodexAppServerAttemptOptions = NonNullable<

@@ -62,6 +65,8 @@ export function runCodexAppServerAttempt(

6265

const entry = {

6366

abortController,

6467

promise: undefined as unknown as Promise<unknown>,

68+

sessionId: params.sessionId,

69+

sessionKey: params.sessionKey,

6570

};

6671

const promise = runCodexAppServerAttemptImpl(

6772

trackedParams,

@@ -76,19 +81,41 @@ export function runCodexAppServerAttempt(

7681

}

77827883

async function drainActiveAppServerAttemptsForTest(): Promise<void> {

84+

vi.useRealTimers();

7985

const attempts = [...activeAppServerAttemptsForTest];

8086

if (attempts.length === 0) {

8187

return;

8288

}

8389

for (const attempt of attempts) {

8490

attempt.abortController?.abort("test_cleanup");

8591

}

86-

await Promise.race([

87-

Promise.allSettled(attempts.map((attempt) => attempt.promise)),

88-

new Promise<void>((resolve) => {

89-

setTimeout(resolve, 5_000);

92+

const drainedSessions = new Set<string>();

93+

const sessionDrains = attempts.flatMap((attempt) => {

94+

if (!attempt.sessionId || drainedSessions.has(attempt.sessionId)) {

95+

return [];

96+

}

97+

drainedSessions.add(attempt.sessionId);

98+

return [

99+

abortAndDrainAgentHarnessRun({

100+

sessionId: attempt.sessionId,

101+

sessionKey: attempt.sessionKey,

102+

settleMs: 1_000,

103+

forceClear: true,

104+

reason: "test_cleanup",

105+

}).catch(() => undefined),

106+

];

107+

});

108+

const drainResult = await Promise.race([

109+

Promise.allSettled([...attempts.map((attempt) => attempt.promise), ...sessionDrains]).then(

110+

() => "settled" as const,

111+

),

112+

new Promise<"timeout">((resolve) => {

113+

setTimeout(() => resolve("timeout"), 5_000);

90114

}),

91115

]);

116+

if (drainResult === "settled") {

117+

activeAppServerAttemptsForTest.clear();

118+

}

92119

}

9312094121

export function createParams(sessionFile: string, workspaceDir: string): EmbeddedRunAttemptParams {

@@ -490,8 +517,8 @@ export function setupRunAttemptTestHooks(): void {

490517

resetGlobalHookRunner();

491518

clearInternalHooks();

492519

defaultCodexAppInventoryCache.clear();

493-

vi.useRealTimers();

494520

vi.restoreAllMocks();

521+

vi.useRealTimers();

495522

vi.unstubAllEnvs();

496523

await closeCodexSandboxExecServersForTests();

497524

await fs.rm(tempDir, { recursive: true, force: true });