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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
月光博客
月光博客
博客园_首页
博客园 - 叶小钗
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
量子位
小众软件
小众软件
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
IT之家
IT之家
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

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): log app-server compaction completion (#93463)...
goutamadwant · 2026-06-16 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -7,6 +7,8 @@ import { LiveSessionModelSwitchError } from "../../agents/live-model-switch-erro

77

import { MissingProviderAuthError } from "../../agents/model-auth.js";

88

import type { SessionEntry } from "../../config/sessions.js";

99

import type { ModelDefinitionConfig } from "../../config/types.models.js";

10+

import { resetLogger, setLoggerOverride } from "../../logging/logger.js";

11+

import { loggingState } from "../../logging/state.js";

1012

import { CommandLaneClearedError, GatewayDrainingError } from "../../process/command-queue.js";

1113

import {

1214

createUserTurnTranscriptRecorder,

@@ -5142,6 +5144,69 @@ describe("runAgentTurnWithFallback", () => {

51425144

expect(onBlockReply).not.toHaveBeenCalled();

51435145

});

51445146
5147+

it("logs Codex app-server compaction completion while notices stay silent by default", async () => {

5148+

const onBlockReply = vi.fn();

5149+

const consoleLog = vi.fn();

5150+

setLoggerOverride({ level: "silent", consoleLevel: "info", consoleStyle: "compact" });

5151+

loggingState.rawConsole = {

5152+

log: consoleLog,

5153+

info: vi.fn(),

5154+

warn: vi.fn(),

5155+

error: vi.fn(),

5156+

};

5157+

try {

5158+

state.runWithModelFallbackMock.mockImplementationOnce(

5159+

async (params: FallbackRunnerParams) => ({

5160+

result: await params.run("openai", "gpt-5.5"),

5161+

provider: "openai",

5162+

model: "gpt-5.5",

5163+

attempts: [{ provider: "anthropic", model: "claude", error: "rate limit" }],

5164+

}),

5165+

);

5166+

state.runEmbeddedAgentMock.mockImplementationOnce(async (params: EmbeddedAgentParams) => {

5167+

await params.onAgentEvent?.({

5168+

stream: "compaction",

5169+

data: {

5170+

phase: "start",

5171+

backend: "codex-app-server",

5172+

threadId: "thread-1",

5173+

turnId: "turn-1",

5174+

itemId: "compaction-1",

5175+

},

5176+

});

5177+

await params.onAgentEvent?.({

5178+

stream: "compaction",

5179+

data: {

5180+

phase: "end",

5181+

completed: true,

5182+

backend: "codex-app-server",

5183+

threadId: "thread-1",

5184+

turnId: "turn-1",

5185+

itemId: "compaction-1",

5186+

},

5187+

});

5188+

return { payloads: [{ text: "final" }], meta: {} };

5189+

});

5190+
5191+

const runAgentTurnWithFallback = await getRunAgentTurnWithFallback();

5192+

const result = await runAgentTurnWithFallback({

5193+

...createMinimalRunAgentTurnParams({

5194+

opts: { onBlockReply },

5195+

}),

5196+

});

5197+
5198+

expect(result.kind).toBe("success");

5199+

expect(onBlockReply).not.toHaveBeenCalled();

5200+

expect(consoleLog.mock.calls.map(([line]) => String(line)).join("\n")).toContain(

5201+

"codex app-server auto-compaction succeeded for openai/gpt-5.5; refreshed session context",

5202+

);

5203+

} finally {

5204+

loggingState.rawConsole = null;

5205+

setLoggerOverride(null);

5206+

resetLogger();

5207+

}

5208+

});

5209+
51455210

it("emits a compaction start notice when notifyUser is enabled", async () => {

51465211

const onBlockReply = vi.fn();

51475212

state.runEmbeddedAgentMock.mockImplementationOnce(async (params: EmbeddedAgentParams) => {

Original file line numberDiff line numberDiff line change

@@ -163,9 +163,26 @@ type AgentTurnTimingSummary = {

163163

};

164164
165165

const agentTurnTimingLog = createSubsystemLogger("auto-reply/agent-turn-timing");

166+

const agentCompactionLog = createSubsystemLogger("auto-reply/compaction");

167+

const CODEX_APP_SERVER_COMPACTION_BACKEND = "codex-app-server";

166168

const AGENT_TURN_TIMING_WARN_TOTAL_MS = 1_000;

167169

const AGENT_TURN_TIMING_WARN_STAGE_MS = 500;

168170
171+

function formatCompactionModelRef(provider?: string, model?: string): string {

172+

const normalizedProvider = normalizeOptionalString(provider);

173+

const normalizedModel = normalizeOptionalString(model);

174+

if (normalizedProvider && normalizedModel) {

175+

return `${sanitizeForLog(normalizedProvider)}/${sanitizeForLog(normalizedModel)}`;

176+

}

177+

if (normalizedProvider) {

178+

return sanitizeForLog(normalizedProvider);

179+

}

180+

if (normalizedModel) {

181+

return sanitizeForLog(normalizedModel);

182+

}

183+

return "unknown model";

184+

}

185+
169186

function createAgentTurnTimingTracker(options: { profilerEnabled?: boolean } = {}): {

170187

measure: <T>(name: string, run: () => Promise<T> | T) => Promise<T>;

171188

measureSync: <T>(name: string, run: () => T) => T;

@@ -2710,6 +2727,7 @@ export async function runAgentTurnWithFallback(params: {

27102727

}

27112728

if (evt.stream === "compaction") {

27122729

const phase = readStringValue(evt.data.phase) ?? "";

2730+

const backend = readStringValue(evt.data.backend);

27132731

const hookMessages = readCompactionHookMessages(evt.data.messages);

27142732

const sendCompactionUserNotices = async (

27152733

noticePhase: "start" | "end" | "incomplete",

@@ -2731,6 +2749,28 @@ export async function runAgentTurnWithFallback(params: {

27312749

const completed = evt.data?.completed === true;

27322750

if (completed) {

27332751

attemptCompactionCount += 1;

2752+

if (backend === CODEX_APP_SERVER_COMPACTION_BACKEND) {

2753+

const modelRef = formatCompactionModelRef(provider, model);

2754+

const consoleMessage =

2755+

`codex app-server auto-compaction succeeded for ${modelRef}; ` +

2756+

"refreshed session context";

2757+

agentCompactionLog.info(

2758+

"codex app-server auto-compaction succeeded",

2759+

{

2760+

event: "codex_app_server_compaction_succeeded",

2761+

backend,

2762+

provider,

2763+

model,

2764+

sessionKey: params.sessionKey,

2765+

sessionId: effectiveRun.sessionId,

2766+

threadId: readStringValue(evt.data.threadId),

2767+

turnId: readStringValue(evt.data.turnId),

2768+

itemId: readStringValue(evt.data.itemId),

2769+

compactionCount: attemptCompactionCount,

2770+

consoleMessage,

2771+

},

2772+

);

2773+

}

27342774

if (params.opts?.onCompactionEnd) {

27352775

await params.opts.onCompactionEnd();

27362776

}