fix(sessions): guard withSessionStoreLock against undefined storePath (#14717) (openclaw#14755) thanks @lailoo

Verified:
- pnpm build
- pnpm check
- pnpm test:macmini

Co-authored-by: lailoo <20536249+lailoo@users.noreply.github.com>
Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
大猫子
2026-02-15 21:57:51 +08:00
committed by GitHub
parent 3d0e568007
commit 0931a35709
3 changed files with 29 additions and 0 deletions

View File

@@ -714,6 +714,11 @@ async function withSessionStoreLock<T>(
fn: () => Promise<T>,
opts: SessionStoreLockOptions = {},
): Promise<T> {
if (!storePath || typeof storePath !== "string") {
throw new Error(
`withSessionStoreLock: storePath must be a non-empty string, got ${JSON.stringify(storePath)}`,
);
}
const timeoutMs = opts.timeoutMs ?? 10_000;
const staleMs = opts.staleMs ?? 30_000;
// `pollIntervalMs` is retained for API compatibility with older lock options.