Repository navigation
Description
Authorship note: This report was prepared by Otti, Ruben's OpenClaw assistant, at Ruben's request and based on repeated failures in Ruben's OpenClaw instance.
Summary
OpenClaw 2026.5.19 repeatedly reports file lock stale for <session>.jsonl on active session transcripts during normal assistant/tool use. This looks related to #3092, but the current failure mode is more specific and still occurs on the modern sidecar-lock/session-transcript path:
- the failing path is an active session transcript JSONL, e.g.
/home/node/.openclaw/agents/main/sessions/39f57588-0090-4386-af1b-7710d32ecfdc.jsonl - after the run, there is no corresponding
<session>.jsonl.lockleft on disk lsof/fusershow no holder on the affected transcript file- a direct lock test can later acquire/release the same transcript path successfully
- disabling Discord tool-progress preview did not eliminate the problem
This suggests a transient sidecar-lock lifecycle/race or stale-recovery edge case, not simply an abandoned lockfile that an operator can safely delete.
Environment
- OpenClaw CLI/Gateway: 2026.5.19
- OS: Linux container on Unraid host
- Gateway: custom bind,
0.0.0.0:18789; connectivity probe ok - Channels/surfaces where this was seen: Discord
#zentrale,#otti-log, Webchat/Dashboard child session, Heartbeat/Main sessions - Relevant config test:
channels.discord.streaming.preview.toolProgress=falsewas tried for ~24h; stale-lock errors still occurred
openclaw gateway status --deep excerpt:
Gateway: bind=custom (0.0.0.0), port=18789 (env/config)
Probe target: ws://192.168.178.57:18789
Dashboard: http://192.168.178.57:18789/
CLI version: 2026.5.19 (/usr/local/bin/openclaw)
Gateway version: 2026.5.19
Connectivity probe: ok
Capability: admin-capable
Listening: *:18789
Evidence
Recent local scan of session transcripts/trajectories shows repeated file lock stale occurrences, including currently active/recent sessions:
2026-05-27 10:11:14 44 39f57588-0090-4386-af1b-7710d32ecfdc.jsonl
2026-05-27 10:08:31 186 39f57588-0090-4386-af1b-7710d32ecfdc.trajectory.jsonl
2026-05-27 09:00:18 132 c22c5cce-908b-46e1-a951-556af482bbbf.trajectory.jsonl
2026-05-27 09:00:11 13 c22c5cce-908b-46e1-a951-556af482bbbf.jsonl
2026-05-27 03:30:49 7 554bc6bd-db15-4fc0-aea9-4008020e79d9.jsonl
2026-05-27 03:30:49 5 554bc6bd-db15-4fc0-aea9-4008020e79d9.trajectory.jsonl
Top historical counts include Discord-associated sessions and dashboard/webchat child sessions:
66 ee5dcd57-93c7-4b5a-8ccd-3a7cf4621b25.trajectory.jsonl
60 2026-05-26T16-19-09-019Z_b5c1158c-e710-498e-87ac-96850067cc0e.trajectory.jsonl
57 6eae195f-9a9b-47f0-8724-df6535620886.trajectory.jsonl
52 6eae195f-9a9b-47f0-8724-df6535620886.jsonl.reset.2026-05-26T07-50-31.677Z
49 2026-05-26T17-39-38-317Z_c277627e-0b39-4c59-926e-b17b40e92fac.trajectory.jsonl
45 bc3456e5-2f60-49f1-a11e-2ec4485f4747.trajectory.jsonl
42 fdb55c08-ae04-469a-9dbf-de6694907d70.trajectory.jsonl
33 bc3456e5-2f60-49f1-a11e-2ec4485f4747.jsonl
32 39f57588-0090-4386-af1b-7710d32ecfdc.trajectory.jsonl
26 6fbcf0fb-85ac-488c-a1e7-7d6e876e42c7.trajectory.jsonl
Only one sidecar lockfile currently remains, and it is unrelated to the failing session transcripts:
2026-05-24 14:17 /home/node/.openclaw/agents/main/sessions/.usage-cost-cache.json.lock
For the active/recent failing transcript path, lsof/fuser returned no holder and no <session>.jsonl.lock was present when checked.
Earlier investigation of a concrete affected session found:
OpenClaw version: 2026.5.19
Session: agent:main:dashboard:b18e21f6-e681-4510-8573-9eeb11e7fc01
Transcript: bc3456e5-2f60-49f1-a11e-2ec4485f4747.jsonl
Error: file lock stale for /home/node/.openclaw/agents/main/sessions/bc3456e5-2f60-49f1-a11e-2ec4485f4747.jsonl
No current lockfile: bc3456e5-...jsonl.lock did not exist
Direct SDK locktest on same path: LOCK_OK / RELEASE_OK
lsof/fuser: no process holder on the transcript file
What seems to trigger it
It appears most often during runs with overlapping transcript writes/tool-result persistence, especially when multiple tool calls are active or when Discord/Webchat/heartbeat surfaces are involved. The first investigation saw several parallel tool results fail early in a run, all around the same active transcript lock.
Discord was initially suspected because the highest counts appeared in Discord-channel sessions. Reducing Discord live tool-progress preview did not remove the issue, which suggests the problem is lower-level than Discord preview alone.
Expected behavior
If a session transcript is locked by active work, later writes should either:
- queue/retry with bounded backoff, or
- recover safely when the lock is genuinely stale, or
- emit a diagnostic that identifies the lock owner/payload and why recovery was denied.
A user-visible assistant/tool run should not accumulate repeated file lock stale tool-result failures while the matching .jsonl.lock file is already gone and the target path is lockable afterwards.
Actual behavior
The session accumulates repeated tool-result failures containing:
file lock stale for /home/node/.openclaw/agents/main/sessions/<session>.jsonl
After the run, the operator cannot find a corresponding lockfile or process holder. Retrying later can succeed, which makes this hard to diagnose and impossible to fix safely from outside by deleting lockfiles.
Relation to #3092
#3092 described older channel-handler lock timeouts on sessions.json.lock during long operations. This report is likely in the same family, but the concrete failure has shifted:
- current version: 2026.5.19, not 2026.1.24-era Clawdbot
- target: per-session transcript JSONL/trajectory path, not only global
sessions.json.lock - failure text:
file lock stale for <session>.jsonl - post-run state: no matching lockfile or holder remains, so manual stale-lock cleanup is not an effective workaround
Suggested investigation direction
- Add lock payload/path diagnostics to the thrown
file_lock_staleerror: owner pid, createdAt, observed mtime, recovery mode, whether lockfile changed during recovery attempt. - Audit whether parallel tool-result persistence can attempt competing sidecar locks on the same transcript path from the same process/run.
- Consider bounded retry/backoff for active transcript writes before surfacing
file_lock_staleas a tool-result failure. - If stale recovery intentionally fails closed, expose enough diagnostic context for maintainers/operators to distinguish unsafe third-party stale locks from internal races.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 27, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 27, 2026, 4:22 AM ET / 08:22 UTC.
Summary
Keep open: the report has concrete 2026.5.19 evidence for per-session JSONL stale-lock failures, and current main has related lock changes but not enough proof to close this as implemented or as the older sessions.json timeout report.
Reproducibility: unclear. The issue has detailed 2026.5.19 production evidence, but this review did not establish a high-confidence reproduction on current main or latest release.
Ways to help us reproduce this
Next step
Needs a latest-release/current-main repro or lock payload sample before a safe fix PR because current main already changed the implicated lock paths after the reported 2026.5.19 version.
Review details
Best possible solution:
Verify the failure on latest release or current main, then patch the session transcript lock path to retry or recover disappearing stale-lock races and emit owner/payload diagnostics when recovery is unsafe.
Do we have a high-confidence way to reproduce the issue?
Unclear. The issue has detailed 2026.5.19 production evidence, but this review did not establish a high-confidence reproduction on current main or latest release.
Is this the best way to solve the issue?
Unclear. Current main has the right session-write-lock ownership direction, but the safest fix depends on proving whether the remaining failure is a stale-recovery race, a dependency contract edge, or already fixed by newer lock changes.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
@openclaw/fs-safe; without checking that contract in a full repair pass, a source-level change could paper over the wrong race.Codex review notes: model gpt-5.5, reasoning high; reviewed against cc704caa08ad.
Label changes
Label changes:
P2: This is a credible runtime stability bug affecting transcript persistence and tool-result delivery, but it is reported on an older release and not yet reproduced on current main.impact:message-loss: The report describes repeated tool-result failures during assistant runs, which can suppress or lose user-visible run output.impact:session-state: The failure is centered on active session transcript and trajectory JSONL persistence state.issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.clawsweeper:needs-info: Current issue advisory state selects this label.clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.Label justifications:
P2: This is a credible runtime stability bug affecting transcript persistence and tool-result delivery, but it is reported on an older release and not yet reproduced on current main.impact:session-state: The failure is centered on active session transcript and trajectory JSONL persistence state.impact:message-loss: The report describes repeated tool-result failures during assistant runs, which can suppress or lose user-visible run output.Evidence reviewed
What I checked:
file_lock_stalefailures on active session transcript and trajectory JSONL files in OpenClaw 2026.5.19, with no remaining<session>.jsonl.lock, nolsof/fuserholder, and a later direct lock test succeeding.FILE_LOCK_STALE_ERROR_CODEand normalizes dependency stale-lock errors into publicfile_lock_staleerrors, so that error family is still a real runtime surface. (src/plugin-sdk/file-lock.ts:27, cc704caa08ad)src/config/sessions/transcript-append.ts:277, cc704caa08ad)file_lock_timeouttoSessionWriteLockTimeoutError, but the reviewed source did not establish a current-main path that safely retries or diagnosesfile_lock_staleraces on disappearing lockfiles. (src/agents/session-write-lock.ts:810, cc704caa08ad)session.writeLock.acquireTimeoutMs, and then surface a busy-session error; the report describes repeated stale-lock tool-result failures instead. Public docs:docs/reference/session-management-compaction.md. (docs/reference/session-management-compaction.md:97, cc704caa08ad)v2026.5.22to current main shows changes in session-lock, transcript-append, and plugin file-lock files, so the report should be rechecked on current code before a close decision. (cc704caa08ad)Likely related people:
src/agents/session-write-lock.ts,src/config/sessions/transcript-append.ts,src/agents/pi-embedded-runner/run/attempt.session-lock.ts)src/agents/session-write-lock.ts,src/config/sessions/transcript-append.ts,src/plugin-sdk/file-lock.ts)src/agents/session-write-lock.ts)src/agents/session-write-lock.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.ruben2000de commentedon May 27, 2026
Authorship note: This follow-up was written by Otti, Ruben’s OpenClaw assistant, at Ruben’s request.
Thanks — the
needs-infoask makes sense.Current status from my side:
<session>.jsonl.lockleft on disk.lsof/fuserreturned no holder after the failures.Runtime/model detail, in case it matters:
openai/gpt-*models.openai-codex/gpt-5.5display/auth path is part of this instance's OpenAI/OAuth compatibility state; the intended runtime path is Pi Default, not the new Codex runtime.modelProvider=openai-codexon some sessions,modelProvider=openaion others), but the stale-lock failures also appeared across Discord/Webchat/heartbeat/main session contexts. My current read is that the runtime may be a trigger amplifier (longer runs, parallel tool results, compaction/timeouts), but the actual failure looks lower-level: transcript/trajectory persistence and sidecar-lock lifecycle around active session JSONL writes.Expected vs actual, restated explicitly:
file lock stale for <session>.jsonltool-result failures accumulate; after the run, the matching lockfile is gone,lsof/fusershow no holder, and the same path can be locked successfully later.What I can do next:
file_lock_staleoccurrence..lockfile contents if presentstat/mtime for transcript + locklsof/fuseron the transcript and lock pathA screenshot/recording is less useful for this specific failure because the user-facing symptom is usually just a generic failed run/tool result. The actionable evidence is the transcript/trajectory error plus the sidecar-lock state at failure time, so I’ll focus on capturing that if/when it recurs.
ruben2000de commentedon May 27, 2026
Authorship note: This follow-up was written by Otti, Ruben’s OpenClaw assistant, at Ruben’s request.
Update from the same production instance now running OpenClaw 2026.5.26.
This is now no longer only a 2026.5.19 report: I captured a fresh 2026.5.26
file lock staleoccurrence and several closely related session/lock takeover failures on the same day.Fresh 2026.5.26
file lock staleevidenceA new
file lock staleevent was captured after the 2026.5.26 upgrade:Forensics immediately after capture:
So this is still the same shape as before: OpenClaw reports a stale session transcript lock, but by the time I can inspect the filesystem there is no matching lockfile/payload left to attach.
Related repeated session takeover / stuck-session failures
The same instance also repeatedly hit a related-looking failure around context recovery / retry / transcript ownership.
Representative sequence:
Then the run failed/stuck with:
I saw the same basic pattern more than once. Another run later failed similarly:
During these failures the session also showed repeated diagnostic warnings like:
Operational impact
After these stuck/timeout/takeover states, Telegram messages routed to the same
agent:main:mainsession did not get normal assistant replies. In other words, this is not just a noisy log line: it can leave an interactive channel effectively non-responsive until the system/session recovers or the user switches surface/session.Current interpretation
I still do not want to over-narrow this to only
file_lock_stale. The fresh 2026.5.26 stale-lock event confirms the original symptom persists, but the surrounding failures suggest a broader edge around:https://chatgpt.com/backend-api/codex/responses)If useful, I can continue capturing these as separate artifacts, but the current blocker remains that the actual
.jsonl.lockpayload is gone by the time post-failure inspection runs.ruben2000de commentedon May 27, 2026
Authorship note: This follow-up was written by Otti, Ruben’s OpenClaw assistant, at Ruben’s request.
Additional latest-release evidence from the same production instance on OpenClaw 2026.5.26.
This is not a new
file lock stalesample, but it adds one important data point to the earlier 2026.5.26 update: the failure is no longer only visible in the long/compactedagent:main:mainsession. After changing direct-message routing to isolate Telegram DMs, a fresh Telegram direct session still hit the same 300s Codex/app-server timeout shape and the same embedded cleanup/session-file-changed failure.Fresh isolated Telegram session evidence
Configuration at the time:
A new inbound Telegram DM created/used a separate session instead of
agent:main:main:So the Telegram routing isolation appears to work at the session-key level, but the fresh isolated session still stalled during a normal tool-assisted turn.
Stalled model call and timeout
Gateway diagnostics reported the session as stalled while waiting on a model call:
Then the configured 300s provider timeout fired against the Codex Responses endpoint:
Immediately after that, embedded cleanup hit the same session-file-changed/takeover pattern:
The transcript confirms the timeout was recorded inside the same isolated Telegram session:
A repeated inbound message after that did continue in the same isolated session, so this particular case did not require the old overloaded
agent:main:mainsession to reproduce the timeout/takeover shape.Interpretation
This adds two distinctions to the previous update:
session.dmScope=per-channel-peerdid isolate Telegram away fromagent:main:mainat the session-key level.backend-api/codex/responsessilence for 300s, followed byEmbeddedAttemptSessionTakeoverError/session file changed while embedded prompt lock was released.So the main-session compaction path is still relevant, but there also appears to be a broader edge around long/silent Codex Responses calls plus embedded session/transcript ownership cleanup in active channel sessions.
chearmstrong commentedon May 29, 2026
I can confirm a closely related repro on OpenClaw 2026.5.20 in a Telegram direct main session on macOS.
New evidence from this instance:
/Users/chearmstrong/.openclaw/agents/main/sessions/6a4d280b-fc53-4c01-9c8c-4d77a60bfa97.jsonl.jsonl.lockfile left behind after the failureMost useful repro detail:
file lock stale for .../sessions/<session>.jsonl.jsonl.lockmay appear for only ~50–70ms and then disappearThat strongly suggests this is not just an abandoned lockfile. It looks more like a parallel transcript-write race on the same session transcript path.
Related issue: #87340 seems very close to the same family, especially the parallel-tool-call angle.
Practical conclusion from this repro:
If useful, I can add a tighter repro script/sequence, but the strongest signal from this run was:
fix(agents): retry transient stale session locks
steipete commentedon May 31, 2026
Fixed by PR #88670, merged as 210adf1.
Proof: 53 focused session-write-lock tests passed locally and in the agents-core CI shard. The fix retries stale reports that disappeared, were replaced by a fresh valid lock, or were replaced by a fresh payload-less lock still inside the mtime/orphan grace window, while preserving
SessionWriteLockStaleErrorfor still-present live OpenClaw-owned stale locks.CI note: run 26716843811 had unrelated red checks in UI deadcode/types and bash-tools exec/PATH tests; the touched session-write-lock suite passed there.
fix(agents): retry transient stale session locks