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

推荐订阅源

博客园 - 叶小钗
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
博客园 - 聂微东
有赞技术团队
有赞技术团队
The Cloudflare Blog
T
Tailwind CSS Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
T
The Blog of Author Tim Ferriss
D
Docker
L
LangChain Blog
Vercel News
Vercel News
C
Check Point Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
人人都是产品经理
人人都是产品经理

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(status): avoid stale session context windows (#93220)...
hxy91819 · 2026-06-15 · via Recent Commits to openclaw:main

@@ -735,10 +735,28 @@ export function buildStatusMessage(args: StatusArgs): string {

735735

typeof entry?.contextTokens === "number" && entry.contextTokens > 0

736736

? entry.contextTokens

737737

: undefined;

738+

const persistedContextMatchesActiveModel = (() => {

739+

if (persistedContextTokens === undefined) {

740+

return false;

741+

}

742+

const entryProvider = normalizeLowercaseStringOrEmpty(entry?.modelProvider);

743+

const entryModel = normalizeLowercaseStringOrEmpty(entry?.model);

744+

const lookupProvider = normalizeLowercaseStringOrEmpty(contextLookupProvider);

745+

const lookupModel = normalizeLowercaseStringOrEmpty(contextLookupModel);

746+

if (!entryModel || !lookupModel || entryModel !== lookupModel) {

747+

return false;

748+

}

749+

if (entryProvider && lookupProvider && entryProvider !== lookupProvider) {

750+

return false;

751+

}

752+

return !runtimeDiffersFromSelected || initialFallbackState.active;

753+

})();

738754

const cappedPersistedContextTokens =

739755

typeof persistedContextTokens === "number" && typeof activeContextTokens === "number"

740756

? Math.min(persistedContextTokens, activeContextTokens)

741-

: persistedContextTokens;

757+

: persistedContextMatchesActiveModel

758+

? persistedContextTokens

759+

: undefined;

742760

const agentContextTokens =

743761

typeof args.agent?.contextTokens === "number" && args.agent.contextTokens > 0

744762

? args.agent.contextTokens

@@ -778,17 +796,40 @@ export function buildStatusMessage(args: StatusArgs): string {

778796

const contextTokens = runtimeDiffersFromSelected

779797

? (explicitRuntimeContextTokens ??

780798

(() => {

781-

if (persistedContextTokens !== undefined) {

799+

const runtimeSnapshotHasFallbackProvenance =

800+

initialFallbackState.active ||

801+

hasSessionAutoModelFallbackProvenance(entry) ||

802+

areRuntimeModelRefsEquivalent(activeModelLabel, modelRefs.selected.label || "unknown");

803+

if (!runtimeSnapshotHasFallbackProvenance) {

804+

if (typeof selectedContextTokens === "number") {

805+

if (explicitConfiguredContextTokens !== undefined) {

806+

return Math.min(explicitConfiguredContextTokens, selectedContextTokens);

807+

}

808+

if (agentContextTokens !== undefined) {

809+

return Math.min(agentContextTokens, selectedContextTokens);

810+

}

811+

return selectedContextTokens;

812+

}

813+

if (explicitConfiguredContextTokens !== undefined) {

814+

return explicitConfiguredContextTokens;

815+

}

816+

if (agentContextTokens !== undefined) {

817+

return agentContextTokens;

818+

}

819+

return DEFAULT_CONTEXT_TOKENS;

820+

}

821+

if (cappedPersistedContextTokens !== undefined) {

822+

const trustedPersistedContextTokens = cappedPersistedContextTokens;

782823

const persistedLooksSelectedWindow =

783824

typeof selectedContextTokens === "number" &&

784-

persistedContextTokens === selectedContextTokens;

825+

trustedPersistedContextTokens === selectedContextTokens;

785826

const activeWindowDiffersFromSelected =

786827

typeof selectedContextTokens === "number" &&

787828

typeof activeContextTokens === "number" &&

788829

activeContextTokens !== selectedContextTokens;

789830

const explicitConfiguredMatchesPersisted =

790831

typeof explicitConfiguredContextTokens === "number" &&

791-

explicitConfiguredContextTokens === persistedContextTokens;

832+

explicitConfiguredContextTokens === trustedPersistedContextTokens;

792833

if (

793834

persistedLooksSelectedWindow &&

794835

activeWindowDiffersFromSelected &&

@@ -797,9 +838,9 @@ export function buildStatusMessage(args: StatusArgs): string {

797838

return activeContextTokens;

798839

}

799840

if (typeof activeContextTokens === "number") {

800-

return Math.min(persistedContextTokens, activeContextTokens);

841+

return Math.min(trustedPersistedContextTokens, activeContextTokens);

801842

}

802-

return persistedContextTokens;

843+

return trustedPersistedContextTokens;

803844

}

804845

if (cappedConfiguredContextTokens !== undefined) {

805846

return cappedConfiguredContextTokens;