diff --git a/.openclaw-sync/source.json b/.openclaw-sync/source.json index fa8aa730a..2978246c3 100644 --- a/.openclaw-sync/source.json +++ b/.openclaw-sync/source.json @@ -1,5 +1,5 @@ { "repository": "openclaw/openclaw", - "sha": "dc5ab602dfa374413f2f42ba37d7b7dda6fb5113", - "syncedAt": "2026-04-23T03:37:54.932Z" + "sha": "35ec4a9991fd03d7e3a9848bc9fbfeb20fd8504e", + "syncedAt": "2026-04-23T03:58:29.373Z" } diff --git a/docs/concepts/agent-loop.md b/docs/concepts/agent-loop.md index 5671016f5..b4f0768c0 100644 --- a/docs/concepts/agent-loop.md +++ b/docs/concepts/agent-loop.md @@ -2,6 +2,7 @@ summary: "Agent loop lifecycle, streams, and wait semantics" read_when: - You need an exact walkthrough of the agent loop or lifecycle events + - You are changing session queueing, transcript writes, or session write lock behavior title: "Agent Loop" --- @@ -48,13 +49,21 @@ wired end-to-end. - This prevents tool/session races and keeps session history consistent. - Messaging channels can choose queue modes (collect/steer/followup) that feed this lane system. See [Command Queue](/concepts/queue). +- Transcript writes are also protected by a session write lock on the session file. The lock is + process-aware and file-based, so it catches writers that bypass the in-process queue or come from + another process. +- Session write locks are non-reentrant by default. If a helper intentionally nests acquisition of + the same lock while preserving one logical writer, it must opt in explicitly with + `allowReentrant: true`. ## Session + workspace preparation - Workspace is resolved and created; sandboxed runs may redirect to a sandbox workspace root. - Skills are loaded (or reused from a snapshot) and injected into env and prompt. - Bootstrap/context files are resolved and injected into the system prompt report. -- A session write lock is acquired; `SessionManager` is opened and prepared before streaming. +- A session write lock is acquired; `SessionManager` is opened and prepared before streaming. Any + later transcript rewrite, compaction, or truncation path must take the same lock before opening or + mutating the transcript file. ## Prompt assembly + system prompt