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

推荐订阅源

L
LangChain Blog
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
博客园 - 司徒正美
罗磊的独立博客
D
Docker
Last Week in AI
Last Week in AI
爱范儿
爱范儿
M
MIT News - Artificial intelligence
V
V2EX
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Apple Machine Learning Research
Apple Machine Learning Research
Microsoft Security Blog
Microsoft Security Blog
T
Tailwind CSS Blog
MyScale Blog
MyScale Blog
V
Visual Studio Blog
博客园 - 叶小钗
B
Blog RSS Feed
A
About on SuperTechFans
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
Martin Fowler
Martin Fowler
P
Proofpoint News Feed

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(agents): handle preflight compaction no-op budgets (#...
mcaxtr · 2026-05-26 · via Recent Commits to openclaw:main

@@ -170,7 +170,7 @@ import {

170170

import { splitSdkTools } from "./tool-split.js";

171171

import { readTranscriptFileState } from "./transcript-file-state.js";

172172

import type { EmbeddedPiCompactResult } from "./types.js";

173-

import { mapThinkingLevel } from "./utils.js";

173+

import { mapThinkingLevel, normalizeContextTokenBudget } from "./utils.js";

174174

import { flushPendingToolResultsAfterIdle } from "./wait-for-idle-before-flush.js";

175175

export type { CompactEmbeddedPiSessionParams } from "./compact.types.js";

176176

@@ -697,10 +697,19 @@ async function compactEmbeddedPiSessionDirectOnce(

697697

modelContextWindow: runtimeModelWithContext.contextWindow,

698698

defaultTokens: DEFAULT_CONTEXT_TOKENS,

699699

});

700+

const resolvedContextTokenBudget =

701+

normalizeContextTokenBudget(ctxInfo.tokens) ?? DEFAULT_CONTEXT_TOKENS;

702+

const requestedContextTokenBudget =

703+

normalizeContextTokenBudget(params.contextTokenBudget) ??

704+

normalizeContextTokenBudget(params.tokenBudget);

705+

const contextTokenBudget = Math.min(

706+

requestedContextTokenBudget ?? resolvedContextTokenBudget,

707+

resolvedContextTokenBudget,

708+

);

700709

const effectiveModel = applyAuthHeaderOverride(

701710

applyLocalNoAuthHeaderOverride(

702-

ctxInfo.tokens < (runtimeModelWithContext.contextWindow ?? Infinity)

703-

? { ...runtimeModelWithContext, contextWindow: ctxInfo.tokens }

711+

contextTokenBudget < (runtimeModelWithContext.contextWindow ?? Infinity)

712+

? { ...runtimeModelWithContext, contextWindow: contextTokenBudget }

704713

: runtimeModelWithContext,

705714

apiKeyInfo,

706715

),

@@ -761,7 +770,7 @@ async function compactEmbeddedPiSessionDirectOnce(

761770

modelId,

762771

modelCompat: extractModelCompat(effectiveModel),

763772

modelApi: model.api,

764-

modelContextWindowTokens: ctxInfo.tokens,

773+

modelContextWindowTokens: contextTokenBudget,

765774

skillsSnapshot: skillsSnapshotForRun,

766775

modelAuthMode: resolveModelAuthMode(model.provider, params.config, undefined, {

767776

workspaceDir: effectiveWorkspace,

@@ -1012,7 +1021,7 @@ async function compactEmbeddedPiSessionDirectOnce(

10121021

agentId: sessionAgentId,

10131022

sessionKey: params.sessionKey,

10141023

config: params.config,

1015-

contextWindowTokens: ctxInfo.tokens,

1024+

contextWindowTokens: contextTokenBudget,

10161025

allowSyntheticToolResults: transcriptPolicy.allowSyntheticToolResults,

10171026

missingToolResultText:

10181027

model.api === "openai-responses" ||

@@ -1037,7 +1046,7 @@ async function compactEmbeddedPiSessionDirectOnce(

10371046

env: process.env,

10381047

workspaceDir: effectiveWorkspace,

10391048

}),

1040-

contextTokenBudget: ctxInfo.tokens,

1049+

contextTokenBudget,

10411050

});

10421051

// Sets compaction/pruning runtime state and returns extension factories

10431052

// that must be passed to the resource loader for the safeguard to be active.

@@ -1064,7 +1073,7 @@ async function compactEmbeddedPiSessionDirectOnce(

10641073

applyPiCompactionSettingsFromConfig({

10651074

settingsManager,

10661075

cfg: params.config,

1067-

contextTokenBudget: ctxInfo.tokens,

1076+

contextTokenBudget,

10681077

});

10691078

// contextEngineInfo is intentionally omitted: this guard runs inside the

10701079

// compaction LLM session, which is not the user-facing agent session and