fix: use active auth profile for auto-compaction
This commit is contained in:
@@ -17,6 +17,7 @@ Docs: https://docs.clawd.bot
|
|||||||
- Telegram: use wrapped fetch for long-polling on Node to normalize AbortSignal handling. (#1639)
|
- Telegram: use wrapped fetch for long-polling on Node to normalize AbortSignal handling. (#1639)
|
||||||
- Exec: keep approvals for elevated ask unless full mode. (#1616) Thanks @ivancasco.
|
- Exec: keep approvals for elevated ask unless full mode. (#1616) Thanks @ivancasco.
|
||||||
- Agents: auto-compact on context overflow prompt errors before failing. (#1627) Thanks @rodrigouroz.
|
- Agents: auto-compact on context overflow prompt errors before failing. (#1627) Thanks @rodrigouroz.
|
||||||
|
- Agents: use the active auth profile for auto-compaction recovery.
|
||||||
- Gateway: reduce log noise for late invokes + remote node probes; debounce skills refresh. (#1607) Thanks @petter-b.
|
- Gateway: reduce log noise for late invokes + remote node probes; debounce skills refresh. (#1607) Thanks @petter-b.
|
||||||
- macOS: default direct-transport `ws://` URLs to port 18789; document `gateway.remote.transport`. (#1603) Thanks @ngutman.
|
- macOS: default direct-transport `ws://` URLs to port 18789; document `gateway.remote.transport`. (#1603) Thanks @ngutman.
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ export type CompactEmbeddedPiSessionParams = {
|
|||||||
messageChannel?: string;
|
messageChannel?: string;
|
||||||
messageProvider?: string;
|
messageProvider?: string;
|
||||||
agentAccountId?: string;
|
agentAccountId?: string;
|
||||||
|
authProfileId?: string;
|
||||||
/** Group id for channel-level tool policy resolution. */
|
/** Group id for channel-level tool policy resolution. */
|
||||||
groupId?: string | null;
|
groupId?: string | null;
|
||||||
/** Group channel label (e.g. #general) for channel-level tool policy resolution. */
|
/** Group channel label (e.g. #general) for channel-level tool policy resolution. */
|
||||||
@@ -130,6 +131,7 @@ export async function compactEmbeddedPiSessionDirect(
|
|||||||
const apiKeyInfo = await getApiKeyForModel({
|
const apiKeyInfo = await getApiKeyForModel({
|
||||||
model,
|
model,
|
||||||
cfg: params.config,
|
cfg: params.config,
|
||||||
|
profileId: params.authProfileId,
|
||||||
agentDir,
|
agentDir,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ vi.mock("../model-auth.js", () => ({
|
|||||||
ensureAuthProfileStore: vi.fn(() => ({})),
|
ensureAuthProfileStore: vi.fn(() => ({})),
|
||||||
getApiKeyForModel: vi.fn(async () => ({
|
getApiKeyForModel: vi.fn(async () => ({
|
||||||
apiKey: "test-key",
|
apiKey: "test-key",
|
||||||
|
profileId: "test-profile",
|
||||||
source: "test",
|
source: "test",
|
||||||
})),
|
})),
|
||||||
resolveAuthProfileOrder: vi.fn(() => []),
|
resolveAuthProfileOrder: vi.fn(() => []),
|
||||||
@@ -207,6 +208,9 @@ describe("overflow compaction in run loop", () => {
|
|||||||
const result = await runEmbeddedPiAgent(baseParams);
|
const result = await runEmbeddedPiAgent(baseParams);
|
||||||
|
|
||||||
expect(mockedCompactDirect).toHaveBeenCalledTimes(1);
|
expect(mockedCompactDirect).toHaveBeenCalledTimes(1);
|
||||||
|
expect(mockedCompactDirect).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ authProfileId: "test-profile" }),
|
||||||
|
);
|
||||||
expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);
|
expect(mockedRunEmbeddedAttempt).toHaveBeenCalledTimes(2);
|
||||||
expect(log.warn).toHaveBeenCalledWith(
|
expect(log.warn).toHaveBeenCalledWith(
|
||||||
expect.stringContaining("context overflow detected; attempting auto-compaction"),
|
expect.stringContaining("context overflow detected; attempting auto-compaction"),
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ export async function runEmbeddedPiAgent(
|
|||||||
messageChannel: params.messageChannel,
|
messageChannel: params.messageChannel,
|
||||||
messageProvider: params.messageProvider,
|
messageProvider: params.messageProvider,
|
||||||
agentAccountId: params.agentAccountId,
|
agentAccountId: params.agentAccountId,
|
||||||
|
authProfileId: lastProfileId,
|
||||||
sessionFile: params.sessionFile,
|
sessionFile: params.sessionFile,
|
||||||
workspaceDir: params.workspaceDir,
|
workspaceDir: params.workspaceDir,
|
||||||
agentDir,
|
agentDir,
|
||||||
|
|||||||
Reference in New Issue
Block a user