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

推荐订阅源

人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
雷峰网
雷峰网
Google DeepMind News
Google DeepMind News
Y
Y Combinator Blog
Microsoft Security Blog
Microsoft Security Blog
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
V
V2EX
博客园 - 【当耐特】
GbyAI
GbyAI
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Martin Fowler
Martin Fowler
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Hugging Face - Blog
Hugging Face - Blog
B
Blog
V
Visual Studio Blog
D
DataBreaches.Net
C
Check Point Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
F
Fortinet All Blogs

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(agent): await local agent_end hooks (#85007) · opencl...
Kaspre · 2026-05-22 · via Recent Commits to openclaw:main

@@ -6064,6 +6064,92 @@ describe("runCodexAppServerAttempt", () => {

60646064

expect(agentEndContext.sessionId).toBe("session-1");

60656065

});

606660666067+

it("waits for agent_end hooks before resolving local codex turns", async () => {

6068+

let releaseAgentEnd: () => void = () => undefined;

6069+

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

6070+

releaseAgentEnd = resolve;

6071+

});

6072+

const agentEnd = vi.fn(() => agentEndSettled);

6073+

initializeGlobalHookRunner(

6074+

createMockPluginRegistry([{ hookName: "agent_end", handler: agentEnd }]),

6075+

);

6076+

const sessionFile = path.join(tempDir, "session.jsonl");

6077+

const workspaceDir = path.join(tempDir, "workspace");

6078+

const harness = createStartedThreadHarness();

6079+

const run = runCodexAppServerAttempt(createParams(sessionFile, workspaceDir));

6080+

let settled = false;

6081+

void run.then(() => {

6082+

settled = true;

6083+

});

6084+6085+

await harness.waitForMethod("turn/start");

6086+

await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });

6087+6088+

await vi.waitFor(() => expect(agentEnd).toHaveBeenCalledTimes(1), fastWait);

6089+

expect(settled).toBe(false);

6090+

releaseAgentEnd();

6091+

await expect(run).resolves.toMatchObject({ promptError: null });

6092+

expect(settled).toBe(true);

6093+

});

6094+6095+

it("does not wait for agent_end hooks before resolving channel-backed codex turns", async () => {

6096+

let releaseAgentEnd: () => void = () => undefined;

6097+

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

6098+

releaseAgentEnd = resolve;

6099+

});

6100+

const agentEnd = vi.fn(() => agentEndSettled);

6101+

initializeGlobalHookRunner(

6102+

createMockPluginRegistry([{ hookName: "agent_end", handler: agentEnd }]),

6103+

);

6104+

const sessionFile = path.join(tempDir, "session.jsonl");

6105+

const workspaceDir = path.join(tempDir, "workspace");

6106+

const harness = createStartedThreadHarness();

6107+

const params = createParams(sessionFile, workspaceDir);

6108+

params.messageChannel = "discord";

6109+

params.messageProvider = "discord";

6110+

const run = runCodexAppServerAttempt(params);

6111+6112+

await harness.waitForMethod("turn/start");

6113+

await harness.completeTurn({ threadId: "thread-1", turnId: "turn-1" });

6114+

const result = await run;

6115+6116+

expect(result.promptError).toBeNull();

6117+

expect(agentEnd).toHaveBeenCalledTimes(1);

6118+

releaseAgentEnd();

6119+

});

6120+6121+

it("waits for agent_end hooks before rejecting local codex turn-start failures", async () => {

6122+

let releaseAgentEnd: () => void = () => undefined;

6123+

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

6124+

releaseAgentEnd = resolve;

6125+

});

6126+

const agentEnd = vi.fn(() => agentEndSettled);

6127+

initializeGlobalHookRunner(

6128+

createMockPluginRegistry([{ hookName: "agent_end", handler: agentEnd }]),

6129+

);

6130+

const sessionFile = path.join(tempDir, "session.jsonl");

6131+

const workspaceDir = path.join(tempDir, "workspace");

6132+

createStartedThreadHarness(async (method) => {

6133+

if (method === "turn/start") {

6134+

throw new Error("turn start exploded");

6135+

}

6136+

return undefined;

6137+

});

6138+

const run = runCodexAppServerAttempt(createParams(sessionFile, workspaceDir));

6139+

let rejected = false;

6140+

void run.catch(() => {

6141+

rejected = true;

6142+

});

6143+6144+

await vi.waitFor(() => expect(agentEnd).toHaveBeenCalledTimes(1), fastWait);

6145+

await new Promise<void>((resolve) => setImmediate(resolve));

6146+6147+

expect(rejected).toBe(false);

6148+

releaseAgentEnd();

6149+

await expect(run).rejects.toThrow("turn start exploded");

6150+

expect(rejected).toBe(true);

6151+

});

6152+60676153

it("forwards Codex app-server verbose tool summaries and completed output", async () => {

60686154

const onToolResult = vi.fn();

60696155

const sessionFile = path.join(tempDir, "session.jsonl");

@@ -6663,6 +6749,7 @@ describe("runCodexAppServerAttempt", () => {

66636749

expect(harness.requests.map((request) => request.method)).toEqual([

66646750

"thread/start",

66656751

"turn/start",

6752+

"thread/unsubscribe",

66666753

]);

66676754

const binding = await readCodexAppServerBinding(sessionFile);

66686755

expect(binding?.threadId).toBe("thread-existing");

@@ -6689,6 +6776,7 @@ describe("runCodexAppServerAttempt", () => {

66896776

expect(harness.requests.map((request) => request.method)).toEqual([

66906777

"thread/resume",

66916778

"turn/start",

6779+

"thread/unsubscribe",

66926780

]);

66936781

const binding = await readCodexAppServerBinding(sessionFile);

66946782

expect(binding?.threadId).toBe("thread-existing");