mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 00:59:21 +00:00
* fix(context-engine): pass deferred maintenance token budget Thread tokenBudget through the after-turn runtime context so background context-engine maintenance reuses the real model context window instead of falling back to 128k. Also pass through a best-effort currentTokenCount from the latest call total and make the runtime context type explicit about both fields. Regeneration-Prompt: | OpenClaw already passed the real context token budget into direct context-engine calls like afterTurn and assemble, but deferred maintain() reused only the runtimeContext object and that object did not carry tokenBudget. Lossless Claw therefore fell back to 128k during background maintenance, which made budget-trigger fire much more aggressively than the live model context warranted. Thread the real contextTokenBudget into buildAfterTurnRuntimeContext so deferred maintenance receives the same budget, and pass a straightforward best-effort currentTokenCount from the latest call total while the relevant data is already in scope. Keep the change additive, update the runtime-context type, and cover the background maintenance/runtime-context behavior with focused tests. * fix(context-engine): use prompt usage for deferred maintenance |
||
|---|---|---|
| .. | ||
| context-engine.test.ts | ||
| delegate.ts | ||
| index.ts | ||
| init.ts | ||
| legacy.registration.ts | ||
| legacy.ts | ||
| registry.ts | ||
| types.ts | ||