diff --git a/src/agents/memory-search.ts b/src/agents/memory-search.ts index 67b07be0193..1cbc83b7781 100644 --- a/src/agents/memory-search.ts +++ b/src/agents/memory-search.ts @@ -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, diff --git a/src/agents/pi-embedded-runner/compact.hooks.test.ts b/src/agents/pi-embedded-runner/compact.hooks.test.ts index a166dac275c..2127fbf07ba 100644 --- a/src/agents/pi-embedded-runner/compact.hooks.test.ts +++ b/src/agents/pi-embedded-runner/compact.hooks.test.ts @@ -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((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: { diff --git a/src/config/schema.labels.ts b/src/config/schema.labels.ts index 6aa2ae40efd..15dcfd24ce1 100644 --- a/src/config/schema.labels.ts +++ b/src/config/schema.labels.ts @@ -108,6 +108,11 @@ export const FIELD_LABELS: Record = { "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",