fix: use active auth profile for auto-compaction

This commit is contained in:
Peter Steinberger
2026-01-24 22:23:49 +00:00
parent 9ceac415c5
commit dd150d69c6
4 changed files with 8 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ vi.mock("../model-auth.js", () => ({
ensureAuthProfileStore: vi.fn(() => ({})),
getApiKeyForModel: vi.fn(async () => ({
apiKey: "test-key",
profileId: "test-profile",
source: "test",
})),
resolveAuthProfileOrder: vi.fn(() => []),
@@ -207,6 +208,9 @@ describe("overflow compaction in run loop", () => {
const result = await runEmbeddedPiAgent(baseParams);
expect(mockedCompactDirect).toHaveBeenCalledTimes(1);
expect(mockedCompactDirect).toHaveBeenCalledWith(
expect.objectContaining({ authProfileId: "test-profile" }),
);
expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);
expect(log.warn).toHaveBeenCalledWith(
expect.stringContaining("context overflow detected; attempting auto-compaction"),