mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 09:15:31 +00:00
Compaction Runner: add post-sync mode scaffold
This commit is contained in:
@@ -242,6 +242,23 @@ function classifyCompactionReason(reason?: string): string {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
function resolvePostCompactionIndexSyncMode(config?: OpenClawConfig): "off" | "async" | "await" {
|
||||
const mode = config?.agents?.defaults?.compaction?.postIndexSync;
|
||||
if (mode === "off" || mode === "async" || mode === "await") {
|
||||
return mode;
|
||||
}
|
||||
return "async";
|
||||
}
|
||||
|
||||
async function syncPostCompactionSessionMemory(params: {
|
||||
config?: OpenClawConfig;
|
||||
mode: "off" | "async" | "await";
|
||||
}): Promise<void> {
|
||||
if (params.mode === "off" || !params.config) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Core compaction logic without lane queueing.
|
||||
* Use this when already inside a session/global lane to avoid deadlocks.
|
||||
@@ -667,6 +684,10 @@ export async function compactEmbeddedPiSessionDirect(
|
||||
session.compact(params.customInstructions),
|
||||
);
|
||||
emitSessionTranscriptUpdate(params.sessionFile);
|
||||
await syncPostCompactionSessionMemory({
|
||||
config: params.config,
|
||||
mode: resolvePostCompactionIndexSyncMode(params.config),
|
||||
});
|
||||
// Estimate tokens after compaction by summing token estimates for remaining messages
|
||||
let tokensAfter: number | undefined;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user