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

推荐订阅源

H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News
Apple Machine Learning Research
Apple Machine Learning Research
有赞技术团队
有赞技术团队
Y
Y Combinator Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
L
LangChain Blog
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
Hugging Face - Blog
Hugging Face - Blog
G
Google Developers Blog
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
Recent Announcements
Recent Announcements
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

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: use Codex runtime context budget for compaction · op...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -3,8 +3,10 @@ import fs from "node:fs";

33

import type { AgentMessage } from "@earendil-works/pi-agent-core";

44

import { resolveBootstrapWarningSignaturesSeen } from "../../agents/bootstrap-budget.js";

55

import { estimateMessagesTokens } from "../../agents/compaction.js";

6+

import { resolveAgentHarnessPolicy } from "../../agents/harness/policy.js";

67

import { runWithModelFallback } from "../../agents/model-fallback.js";

78

import { isCliProvider } from "../../agents/model-selection.js";

9+

import { resolveContextConfigProviderForRuntime } from "../../agents/openai-codex-routing.js";

810

import { resolveSandboxConfigForAgent, resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";

911

import {

1012

derivePromptTokens,

@@ -163,6 +165,50 @@ function resolveMemoryFlushModelFallbackOptions(

163165

};

164166

}

165167168+

function resolveFollowupContextConfigProvider(params: {

169+

cfg: OpenClawConfig;

170+

followupRun: FollowupRun;

171+

sessionEntry?: SessionEntry;

172+

sessionKey?: string;

173+

runtimePolicySessionKey?: string;

174+

}): string {

175+

const provider = params.followupRun.run.provider;

176+

const matchingSessionEntry =

177+

params.sessionEntry?.sessionId === params.followupRun.run.sessionId

178+

? params.sessionEntry

179+

: undefined;

180+

const persistedRuntimeOverride = normalizeOptionalString(

181+

matchingSessionEntry?.agentRuntimeOverride,

182+

);

183+

const persistedRuntimeId =

184+

persistedRuntimeOverride &&

185+

persistedRuntimeOverride !== "auto" &&

186+

persistedRuntimeOverride !== "default"

187+

? persistedRuntimeOverride

188+

: matchingSessionEntry?.agentHarnessId;

189+

if (persistedRuntimeId) {

190+

return resolveContextConfigProviderForRuntime({

191+

provider,

192+

runtimeId: persistedRuntimeId,

193+

});

194+

}

195+

const harnessPolicy = resolveAgentHarnessPolicy({

196+

provider,

197+

modelId: params.followupRun.run.model,

198+

config: params.cfg,

199+

agentId: params.followupRun.run.agentId,

200+

sessionKey:

201+

params.runtimePolicySessionKey ??

202+

params.sessionKey ??

203+

params.followupRun.run.runtimePolicySessionKey ??

204+

params.followupRun.run.sessionKey,

205+

});

206+

return resolveContextConfigProviderForRuntime({

207+

provider,

208+

runtimeId: harnessPolicy.runtime,

209+

});

210+

}

211+166212

function resolveVisibleMemoryFlushErrorPayloads(payloads?: ReplyPayload[]): ReplyPayload[] {

167213

return (payloads ?? []).filter(

168214

(payload) => payload.isError === true && isRenderablePayload(payload),

@@ -514,7 +560,13 @@ export async function runPreflightCompactionIfNeeded(params: {

514560515561

const contextWindowTokens = resolveMemoryFlushContextWindowTokens({

516562

cfg: params.cfg,

517-

provider: params.followupRun.run.provider,

563+

provider: resolveFollowupContextConfigProvider({

564+

cfg: params.cfg,

565+

followupRun: params.followupRun,

566+

sessionEntry: entry,

567+

sessionKey: params.sessionKey,

568+

runtimePolicySessionKey: params.runtimePolicySessionKey,

569+

}),

518570

modelId: params.followupRun.run.model ?? params.defaultModel,

519571

agentCfgContextTokens: params.agentCfgContextTokens,

520572

});

@@ -749,7 +801,13 @@ export async function runMemoryFlushIfNeeded(params: {

749801

(params.sessionKey ? params.sessionStore?.[params.sessionKey] : undefined);

750802

const contextWindowTokens = resolveMemoryFlushContextWindowTokens({

751803

cfg: params.cfg,

752-

provider: params.followupRun.run.provider,

804+

provider: resolveFollowupContextConfigProvider({

805+

cfg: params.cfg,

806+

followupRun: params.followupRun,

807+

sessionEntry: entry,

808+

sessionKey: params.sessionKey,

809+

runtimePolicySessionKey: params.runtimePolicySessionKey,

810+

}),

753811

modelId: params.followupRun.run.model ?? params.defaultModel,

754812

agentCfgContextTokens: params.agentCfgContextTokens,

755813

});