From deaef91b08bc2125bb9f7d022eb2a132a0737a15 Mon Sep 17 00:00:00 2001 From: "openclaw-docs-sync[bot]" Date: Sat, 2 May 2026 12:14:22 +0000 Subject: [PATCH] chore(sync): mirror docs from openclaw/openclaw@be2768433c75764dfec3f463a02de39b035a3f74 --- .openclaw-sync/source.json | 4 ++-- docs/cli/sessions.md | 4 ++++ docs/plugins/sdk-runtime.md | 9 +++++++-- docs/reference/session-management-compaction.md | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.openclaw-sync/source.json b/.openclaw-sync/source.json index 3a6d89e3f..d83c318be 100644 --- a/.openclaw-sync/source.json +++ b/.openclaw-sync/source.json @@ -1,5 +1,5 @@ { "repository": "openclaw/openclaw", - "sha": "084c4beb2e108182b4b3a2daa6474d5548288fba", - "syncedAt": "2026-05-02T12:02:19.417Z" + "sha": "be2768433c75764dfec3f463a02de39b035a3f74", + "syncedAt": "2026-05-02T12:12:32.883Z" } diff --git a/docs/cli/sessions.md b/docs/cli/sessions.md index 8f2219dfb..32f8cf23f 100644 --- a/docs/cli/sessions.md +++ b/docs/cli/sessions.md @@ -98,6 +98,10 @@ openclaw sessions cleanup --json - `--store `: run against a specific `sessions.json` file. - `--json`: print a JSON summary. With `--all-agents`, output includes one summary per store. +When a Gateway is reachable, enforcing cleanup for configured agent stores is +sent through the Gateway so it shares the same session-store writer as runtime +traffic. Use `--store ` for explicit offline repair of a store file. + `openclaw sessions cleanup --all-agents --dry-run --json`: ```json diff --git a/docs/plugins/sdk-runtime.md b/docs/plugins/sdk-runtime.md index 5668bf72e..1d36afe54 100644 --- a/docs/plugins/sdk-runtime.md +++ b/docs/plugins/sdk-runtime.md @@ -114,11 +114,16 @@ Provider and channel execution paths must use the active runtime config snapshot ```typescript const storePath = api.runtime.agent.session.resolveStorePath(cfg); - const store = api.runtime.agent.session.loadSessionStore(cfg); - await api.runtime.agent.session.saveSessionStore(cfg, store); + const store = api.runtime.agent.session.loadSessionStore(storePath); + await api.runtime.agent.session.updateSessionStore(storePath, (nextStore) => { + // Patch one entry without replacing the whole file from stale state. + nextStore[sessionKey] = { ...nextStore[sessionKey], thinkingLevel: "high" }; + }); const filePath = api.runtime.agent.session.resolveSessionFilePath(cfg, sessionId); ``` + Prefer `updateSessionStore(...)` or `updateSessionStoreEntry(...)` for runtime writes. They route through the Gateway-owned session-store writer, preserve concurrent updates, and reuse the hot cache. `saveSessionStore(...)` remains available for compatibility and offline maintenance-style rewrites. + Default model and provider constants: diff --git a/docs/reference/session-management-compaction.md b/docs/reference/session-management-compaction.md index 2e8312066..d6346b767 100644 --- a/docs/reference/session-management-compaction.md +++ b/docs/reference/session-management-compaction.md @@ -85,7 +85,7 @@ Session persistence has automatic maintenance controls (`session.maintenance`) f - `maxDiskBytes`: optional sessions-directory budget - `highWaterBytes`: optional target after cleanup (default `80%` of `maxDiskBytes`) -Normal Gateway writes batch `maxEntries` cleanup for production-sized caps, so a store may briefly exceed the configured cap before the next high-water cleanup rewrites it back down. Session store reads do not prune or cap entries during Gateway startup; use writes or `openclaw sessions cleanup --enforce` for cleanup. `openclaw sessions cleanup --enforce` still applies the configured cap immediately. +Normal Gateway writes flow through a per-store session writer that serializes in-process mutations without taking a runtime file lock. Hot-path patch helpers borrow the validated mutable cache while they hold that writer slot, so large `sessions.json` files are not cloned or reread for every metadata update. Runtime code should prefer `updateSessionStore(...)` or `updateSessionStoreEntry(...)`; direct whole-store saves are compatibility and offline-maintenance tools. When a Gateway is reachable, `openclaw sessions cleanup --enforce` delegates maintenance to the Gateway so cleanup joins the same writer queue; `--store ` is the explicit offline repair path for direct file maintenance. `maxEntries` cleanup is still batched for production-sized caps, so a store may briefly exceed the configured cap before the next high-water cleanup rewrites it back down. Session store reads do not prune or cap entries during Gateway startup; use writes or `openclaw sessions cleanup --enforce` for cleanup. `openclaw sessions cleanup --enforce` still applies the configured cap immediately. Maintenance keeps durable external conversation pointers such as group sessions and thread-scoped chat sessions, but synthetic runtime entries for cron, hooks,