mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
fix: remove duplicate context budget resolution
This commit is contained in:
@@ -109,33 +109,6 @@ export async function compactEmbeddedPiSession(
|
||||
let checkpointSnapshot: CapturedCompactionCheckpointSnapshot | null = null;
|
||||
let checkpointSnapshotRetained = false;
|
||||
try {
|
||||
const resolvedCompactionTarget = resolveEmbeddedCompactionTarget({
|
||||
config: params.config,
|
||||
provider: params.provider,
|
||||
modelId: params.model,
|
||||
authProfileId: params.authProfileId,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
defaultModel: DEFAULT_MODEL,
|
||||
});
|
||||
// Resolve token budget from the effective compaction model so engine-
|
||||
// owned /compact implementations see the same target as the runtime.
|
||||
const ceProvider = resolvedCompactionTarget.provider ?? DEFAULT_PROVIDER;
|
||||
const ceModelId = resolvedCompactionTarget.model ?? DEFAULT_MODEL;
|
||||
const { model: ceModel } = await resolveModelAsync(
|
||||
ceProvider,
|
||||
ceModelId,
|
||||
agentDir,
|
||||
params.config,
|
||||
);
|
||||
const ceRuntimeModel = ceModel as ProviderRuntimeModel | undefined;
|
||||
const ceCtxInfo = resolveContextWindowInfo({
|
||||
cfg: params.config,
|
||||
provider: ceProvider,
|
||||
modelId: ceModelId,
|
||||
modelContextTokens: readPiModelContextTokens(ceModel),
|
||||
modelContextWindow: ceRuntimeModel?.contextWindow,
|
||||
defaultTokens: DEFAULT_CONTEXT_TOKENS,
|
||||
});
|
||||
// When the context engine owns compaction, its compact() implementation
|
||||
// bypasses compactEmbeddedPiSessionDirect (which fires the hooks internally).
|
||||
// Fire before_compaction / after_compaction hooks here so plugin subscribers
|
||||
|
||||
Reference in New Issue
Block a user