fix(gateway): invalidate bootstrap cache on session rollover (openclaw#38535)

Verified:
- pnpm install --frozen-lockfile
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: yfge <1186273+yfge@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
拐爷&&老拐瘦
2026-03-07 13:46:02 +08:00
committed by GitHub
parent e802840b62
commit 2e31aead39
7 changed files with 63 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import crypto from "node:crypto";
import { listAgentIds } from "../../agents/agent-scope.js";
import { clearBootstrapSnapshotOnSessionRollover } from "../../agents/bootstrap-cache.js";
import type { MsgContext } from "../../auto-reply/templating.js";
import {
normalizeThinkLevel,
@@ -144,6 +145,11 @@ export function resolveSession(opts: {
opts.sessionId?.trim() || (fresh ? sessionEntry?.sessionId : undefined) || crypto.randomUUID();
const isNewSession = !fresh && !opts.sessionId;
clearBootstrapSnapshotOnSessionRollover({
sessionKey,
previousSessionId: isNewSession ? sessionEntry?.sessionId : undefined,
});
const persistedThinking =
fresh && sessionEntry?.thinkingLevel
? normalizeThinkLevel(sessionEntry.thinkingLevel)