mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-22 12:18:11 +00:00
Compaction Runner: fix review follow-ups
This commit is contained in:
committed by
Josh Lehman
parent
fc7b6103f3
commit
e51de09c2d
@@ -320,7 +320,7 @@ function mergeConfig(
|
||||
);
|
||||
const deltaBytes = clampInt(sync.sessions.deltaBytes, 0, Number.MAX_SAFE_INTEGER);
|
||||
const deltaMessages = clampInt(sync.sessions.deltaMessages, 0, Number.MAX_SAFE_INTEGER);
|
||||
const postCompactionForce = sync.sessions.postCompactionForce ?? true;
|
||||
const postCompactionForce = sync.sessions.postCompactionForce;
|
||||
return {
|
||||
enabled,
|
||||
sources,
|
||||
|
||||
@@ -536,6 +536,67 @@ describe("compactEmbeddedPiSessionDirect hooks", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("skips post-compaction memory sync when the mode is off", async () => {
|
||||
const sync = vi.fn(async () => {});
|
||||
getMemorySearchManagerMock.mockResolvedValue({ manager: { sync } });
|
||||
|
||||
const result = await compactEmbeddedPiSessionDirect({
|
||||
sessionId: "session-1",
|
||||
sessionKey: "agent:main:session-1",
|
||||
sessionFile: "/tmp/session.jsonl",
|
||||
workspaceDir: "/tmp",
|
||||
customInstructions: "focus on decisions",
|
||||
config: {
|
||||
agents: {
|
||||
defaults: {
|
||||
compaction: {
|
||||
postIndexSync: "off",
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
expect(resolveSessionAgentIdMock).not.toHaveBeenCalled();
|
||||
expect(getMemorySearchManagerMock).not.toHaveBeenCalled();
|
||||
expect(sync).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("fires post-compaction memory sync without awaiting it in async mode", async () => {
|
||||
let resolveSync: (() => void) | undefined;
|
||||
const syncGate = new Promise<void>((resolve) => {
|
||||
resolveSync = resolve;
|
||||
});
|
||||
const sync = vi.fn(() => syncGate);
|
||||
getMemorySearchManagerMock.mockResolvedValue({ manager: { sync } });
|
||||
|
||||
const result = await compactEmbeddedPiSessionDirect({
|
||||
sessionId: "session-1",
|
||||
sessionKey: "agent:main:session-1",
|
||||
sessionFile: "/tmp/session.jsonl",
|
||||
workspaceDir: "/tmp",
|
||||
customInstructions: "focus on decisions",
|
||||
config: {
|
||||
agents: {
|
||||
defaults: {
|
||||
compaction: {
|
||||
postIndexSync: "async",
|
||||
},
|
||||
},
|
||||
},
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
expect(sync).toHaveBeenCalledWith({
|
||||
reason: "post-compaction",
|
||||
force: true,
|
||||
});
|
||||
resolveSync?.();
|
||||
await syncGate;
|
||||
});
|
||||
|
||||
it("registers the Ollama api provider before compaction", async () => {
|
||||
resolveModelMock.mockReturnValue({
|
||||
model: {
|
||||
|
||||
@@ -108,6 +108,11 @@ export const FIELD_LABELS: Record<string, string> = {
|
||||
"gateway.remote.tlsFingerprint": "Remote Gateway TLS Fingerprint",
|
||||
"gateway.auth.token": "Gateway Token",
|
||||
"gateway.auth.password": "Gateway Password",
|
||||
"gateway.push": "Gateway Push Delivery",
|
||||
"gateway.push.apns": "Gateway Push APNs",
|
||||
"gateway.push.apns.relay": "Gateway Push APNs Relay",
|
||||
"gateway.push.apns.relay.baseUrl": "Gateway Push APNs Relay Base URL",
|
||||
"gateway.push.apns.relay.timeoutMs": "Gateway Push APNs Relay Timeout (ms)",
|
||||
browser: "Browser",
|
||||
"browser.enabled": "Browser Enabled",
|
||||
"browser.cdpUrl": "Browser CDP URL",
|
||||
|
||||
Reference in New Issue
Block a user