Skip to content

Session transcript file_lock_stale persists on 2026.5.19 with no remaining lockfile or file holder #87217

Closed

Description

@ruben2000de

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.lock left on disk
  • lsof / fuser show 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=false was 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_stale error: 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_stale as 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.

Activity

  1. clawsweeper commented on May 27, 2026

    @clawsweeper
    Contributor

    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

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    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:

    • The report is from 2026.5.19 while current main contains newer lock-owner and transcript-write changes, so a fix should first prove whether the latest code still reproduces the stale-lock failure.
    • The exact dependency-level stale recovery behavior comes from @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:

    • add 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.
    • add impact:message-loss: The report describes repeated tool-result failures during assistant runs, which can suppress or lose user-visible run output.
    • add impact:session-state: The failure is centered on active session transcript and trajectory JSONL persistence state.
    • add issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add 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:

    • Reporter evidence: The issue body reports repeated file_lock_stale failures on active session transcript and trajectory JSONL files in OpenClaw 2026.5.19, with no remaining <session>.jsonl.lock, no lsof/fuser holder, and a later direct lock test succeeding.
    • Plugin lock still exposes stale errors: Current main still defines FILE_LOCK_STALE_ERROR_CODE and normalizes dependency stale-lock errors into public file_lock_stale errors, so that error family is still a real runtime surface. (src/plugin-sdk/file-lock.ts:27, cc704caa08ad)
    • Transcript appends use the session write-lock path: Current transcript appends route through an owned write-lock runner or acquire a session transcript write lock before writing, which is the surface most directly related to the reported active transcript JSONL failures. (src/config/sessions/transcript-append.ts:277, cc704caa08ad)
    • Session lock timeout handling is narrower than the report: The current session write-lock acquisition converts file_lock_timeout to SessionWriteLockTimeoutError, but the reviewed source did not establish a current-main path that safely retries or diagnoses file_lock_stale races on disappearing lockfiles. (src/agents/session-write-lock.ts:810, cc704caa08ad)
    • Documented behavior expects bounded busy handling: The current docs say transcript mutations use a session write lock, wait up to 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)
    • Current main has unreleased related lock changes: A diff from latest release v2026.5.22 to 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:

    • @steipete: Peter Steinberger introduced the single-writer session file lock path and appears repeatedly in session lock and transcript history, including later lock-budget and cleanup work. (role: introduced behavior and area owner; confidence: high; commits: 6668805aca17, 1becebe188eb, fb6e415d0c52; files: src/agents/session-write-lock.ts, src/config/sessions/transcript-append.ts, src/agents/pi-embedded-runner/run/attempt.session-lock.ts)
    • @vincentkoc: Current blame in the reviewed checkout points recent lock, transcript append, and plugin lock lines at Vincent Koc's current-main boundary commit, and the current branch contains post-release lock changes in these files. (role: recent area contributor; confidence: medium; commits: 6afe3e89523d, 5a2200b28003; files: src/agents/session-write-lock.ts, src/config/sessions/transcript-append.ts, src/plugin-sdk/file-lock.ts)
    • bmendonca3: The history includes targeted work to reclaim orphan self-pid session lock files, which is adjacent to this report's no-holder/no-lockfile stale recovery symptom. (role: adjacent owner; confidence: medium; commits: 4985c561dfc4; files: src/agents/session-write-lock.ts)
    • Vishal Doshi: Earlier history includes stale session lock release and watchdog work on the same session-lock surface. (role: adjacent owner; confidence: medium; commits: e91a5b021648; files: src/agents/session-write-lock.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. added
    P2Normal backlog priority with limited blast radius.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on May 27, 2026
  3. ruben2000de commented on May 27, 2026

    @ruben2000de
    Author

    Authorship note: This follow-up was written by Otti, Ruben’s OpenClaw assistant, at Ruben’s request.

    Thanks — the needs-info ask makes sense.

    Current status from my side:

    • I can confirm the production evidence is from OpenClaw 2026.5.19.
    • I have not yet reproduced this on current main/latest release.
    • We cannot safely move this production instance back to 2026.5.22 right now: it was rolled back after severe local instability in this setup. So I do not want to claim a latest-release repro until we can test that safely.
    • I also do not have a live lock payload sample for the affected transcript lock, because when I checked after the failures there was no matching <session>.jsonl.lock left on disk.
    • The only remaining sidecar lockfile in the sessions directory at check time was unrelated:
      /home/node/.openclaw/agents/main/sessions/.usage-cost-cache.json.lock
      
    • For affected transcript paths, lsof/fuser returned no holder after the failures.

    Runtime/model detail, in case it matters:

    • The instance is configured to use the OpenClaw Pi Default runtime for openai/gpt-* models.
    • The live current session status now shows:
      OpenClaw 2026.5.19
      Model: openai-codex/gpt-5.5
      Runtime: OpenClaw Pi Default
      Context: 155k/272k
      Think: high
      
    • The openai-codex/gpt-5.5 display/auth path is part of this instance's OpenAI/OAuth compatibility state; the intended runtime path is Pi Default, not the new Codex runtime.
    • Some affected sessions had mixed persisted metadata (modelProvider=openai-codex on some sessions, modelProvider=openai on 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:

    • Expected: active session transcript/trajectory writes either queue/retry/recover safely, or emit diagnostics that identify the lock owner/payload and why recovery was denied.
    • Actual: repeated file lock stale for <session>.jsonl tool-result failures accumulate; after the run, the matching lockfile is gone, lsof/fuser show no holder, and the same path can be locked successfully later.

    What I can do next:

    1. Keep watching the instance for another file_lock_stale occurrence.
    2. If it happens again, immediately capture:
      • OpenClaw version / gateway status
      • affected session id and transcript path
      • matching .lock file contents if present
      • stat/mtime for transcript + lock
      • lsof / fuser on the transcript and lock path
      • surrounding log / trajectory excerpts
      • runtime/model metadata for the affected session
    3. If we later upgrade this instance to a newer release/current main and the issue still reproduces, I’ll add that as a fresh repro.

    A 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.

  4. ruben2000de commented on May 27, 2026

    @ruben2000de
    Author

    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 stale occurrence and several closely related session/lock takeover failures on the same day.

    Fresh 2026.5.26 file lock stale evidence

    A new file lock stale event was captured after the 2026.5.26 upgrade:

    timestamp: 2026-05-27T11:20:39.133Z
    sessionKey: agent:main:main
    sessionId: 73b01ef6-bdea-4b01-b8a9-e9c35341bc43
    affected transcript: /home/node/.openclaw/agents/main/sessions/2026-05-27T10-03-27-878Z_73b01ef6-bdea-4b01-b8a9-e9c35341bc43.jsonl
    surface/tool context: WebChat/Main, tool read
    

    Forensics immediately after capture:

    matching .jsonl.lock: not present by capture time
    lsof: no open holder for the affected transcript
    fuser: not available in the container
    

    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:

    [context-overflow-midturn-precheck] sessionKey=agent:main:main provider=openai-codex/gpt-5.5 route=compact_then_truncate estimatedPromptTokens=336212 promptBudgetBeforeReserve=255616 overflowTokens=80596 ... sessionFile=/home/node/.openclaw/agents/main/sessions/2026-05-27T10-03-27-878Z_73b01ef6-bdea-4b01-b8a9-e9c35341bc43.jsonl
    
    context overflow detected (attempt 1/3); attempting auto-compaction for openai-codex/gpt-5.5
    
    [compaction] rotated active transcript after compaction (sessionKey=agent:main:main)
    
    [context-overflow-precheck] post-compaction tool-result truncation succeeded for openai-codex/gpt-5.5; truncated 29 tool result(s)
    
    auto-compaction succeeded for openai-codex/gpt-5.5; retrying prompt
    
    post-compaction guard armed for 3 attempts
    

    Then the run failed/stuck with:

    embedded attempt cleanup detected session takeover after prompt failure; preserving prompt error:
    runId=fa8556ed-8432-47ab-a4d3-c974799acfb7
    sessionId=2db1193f-200c-428f-a2ed-b3aec6047bbf
    promptError=LLM idle timeout (300s): no response from model
    cleanupError=session file changed while embedded prompt lock was released:
    /home/node/.openclaw/agents/main/sessions/2026-05-27T13-13-05-473Z_2db1193f-200c-428f-a2ed-b3aec6047bbf.jsonl
    
    lane task error: lane=main durationMs=1311449 error="EmbeddedAttemptSessionTakeoverError: LLM idle timeout (300s): no response from model"
    
    lane task error: lane=session:agent:main:main durationMs=1311450 error="EmbeddedAttemptSessionTakeoverError: LLM idle timeout (300s): no response from model"
    
    Embedded agent failed before reply: LLM idle timeout (300s): no response from model | session file changed while embedded prompt lock was released: /home/node/.openclaw/agents/main/sessions/2026-05-27T13-13-05-473Z_2db1193f-200c-428f-a2ed-b3aec6047bbf.jsonl
    

    I saw the same basic pattern more than once. Another run later failed similarly:

    embedded attempt cleanup detected session takeover after prompt failure;
    runId=655e67c8-8ec8-42a4-866f-a684983be285
    sessionId=73b01ef6-bdea-4b01-b8a9-e9c35341bc43
    promptError=LLM idle timeout (300s): no response from model
    cleanupError=session file changed while embedded prompt lock was released:
    /home/node/.openclaw/agents/main/sessions/2026-05-27T10-03-27-878Z_73b01ef6-bdea-4b01-b8a9-e9c35341bc43.jsonl
    
    lane task error: lane=main durationMs=331190 error="EmbeddedAttemptSessionTakeoverError: LLM idle timeout (300s): no response from model"
    

    During these failures the session also showed repeated diagnostic warnings like:

    stalled session: sessionId=73b01ef6-bdea-4b01-b8a9-e9c35341bc43 sessionKey=agent:main:main state=processing ... reason=active_work_without_progress classification=stalled_agent_run activeWorkKind=model_call ... recovery=none
    

    Operational impact

    After these stuck/timeout/takeover states, Telegram messages routed to the same agent:main:main session 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:

    • context-overflow precheck / tool-result truncation
    • auto-compaction and transcript rotation
    • retrying from current/new transcript
    • long OpenAI/Codex app-server timeout (https://chatgpt.com/backend-api/codex/responses)
    • embedded cleanup detecting that the session file changed while the prompt lock was released
    • the session remaining/staying in a stuck processing state, which can block later channel messages

    If useful, I can continue capturing these as separate artifacts, but the current blocker remains that the actual .jsonl.lock payload is gone by the time post-failure inspection runs.

  5. ruben2000de commented on May 27, 2026

    @ruben2000de
    Author

    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 stale sample, but it adds one important data point to the earlier 2026.5.26 update: the failure is no longer only visible in the long/compacted agent:main:main session. 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:

    session.dmScope=per-channel-peer
    models.providers.openai.timeoutSeconds=300
    models.providers.openai-codex.timeoutSeconds=300
    agents.defaults.thinkingDefault=high
    

    A new inbound Telegram DM created/used a separate session instead of agent:main:main:

    sessionKey: agent:main:telegram:direct:13247585
    sessionId: fba415dd-ce7a-4ac8-ab39-f81b0594c90e
    sessionFile: /home/node/.openclaw/agents/main/sessions/fba415dd-ce7a-4ac8-ab39-f81b0594c90e.jsonl
    created: 2026-05-27T16:31:29Z
    model snapshot in session JSONL: provider=openai-codex, modelApi=openai-codex-responses, modelId=gpt-5.5
    

    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:

    2026-05-27T18:37:13.859+02:00 stalled session: sessionId=fba415dd-ce7a-4ac8-ab39-f81b0594c90e sessionKey=agent:main:telegram:direct:13247585 state=processing age=129s queueDepth=1 reason=active_work_without_progress classification=stalled_agent_run activeWorkKind=model_call lastProgress=model_call:started lastProgressAge=129s recovery=none
    
    2026-05-27T18:37:43.859+02:00 stalled session: ... age=159s ...
    2026-05-27T18:38:13.859+02:00 stalled session: ... age=189s ...
    2026-05-27T18:38:43.860+02:00 stalled session: ... age=219s ...
    2026-05-27T18:39:13.859+02:00 stalled session: ... age=249s ...
    2026-05-27T18:39:43.861+02:00 stalled session: ... age=279s ...
    

    Then the configured 300s provider timeout fired against the Codex Responses endpoint:

    2026-05-27T18:40:04.796+02:00 fetch timeout reached; aborting operation
    operation=fetchWithSsrFGuard
    timeoutMs=300000
    elapsedMs=300002
    url=https://chatgpt.com/backend-api/codex/responses
    

    Immediately after that, embedded cleanup hit the same session-file-changed/takeover pattern:

    2026-05-27T18:40:04.972+02:00 embedded attempt cleanup detected session takeover after prompt failure; preserving prompt error:
    runId=8a9a2a0d-eabd-4412-9556-3965c0016cad
    sessionId=fba415dd-ce7a-4ac8-ab39-f81b0594c90e
    promptError=LLM idle timeout (300s): no response from model
    cleanupError=session file changed while embedded prompt lock was released: /home/node/.openclaw/agents/main/sessions/fba415dd-ce7a-4ac8-ab39-f81b0594c90e.jsonl
    
    2026-05-27T18:40:04.976+02:00 lane task error: lane=session:agent:main:telegram:direct:13247585 durationMs=329393 error="EmbeddedAttemptSessionTakeoverError: LLM idle timeout (300s): no response from model"
    
    2026-05-27T18:40:04.978+02:00 Embedded agent failed before reply: LLM idle timeout (300s): no response from model | session file changed while embedded prompt lock was released: /home/node/.openclaw/agents/main/sessions/fba415dd-ce7a-4ac8-ab39-f81b0594c90e.jsonl
    

    The transcript confirms the timeout was recorded inside the same isolated Telegram session:

    line 27: assistant stop=aborted err="LLM idle timeout (300s): no response from model"
    

    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:main session to reproduce the timeout/takeover shape.

    Interpretation

    This adds two distinctions to the previous update:

    1. session.dmScope=per-channel-peer did isolate Telegram away from agent:main:main at the session-key level.
    2. A fresh isolated Telegram session with much lower context still hit backend-api/codex/responses silence for 300s, followed by EmbeddedAttemptSessionTakeoverError / 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.

  6. chearmstrong commented on May 29, 2026

    @chearmstrong

    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:

    • the stale-lock symptom still reproduces after restarting the gateway onto 2026.5.20
    • the failing path is the active main-session transcript JSONL:
      • /Users/chearmstrong/.openclaw/agents/main/sessions/6a4d280b-fc53-4c01-9c8c-4d77a60bfa97.jsonl
    • there is usually no persistent .jsonl.lock file left behind after the failure
    • when watched directly, the lock file appears only very briefly and is then removed cleanly
    • sequential tool calls in the same live session succeed
    • parallel tool fan-out in the same turn can reproduce the stale-lock failure

    Most useful repro detail:

    1. Use a live main session (Telegram direct in this case)
    2. Trigger parallel tool calls in one turn (for example multiple reads / parallel tool fan-out)
    3. Observe one tool result succeed while another can surface:
      • file lock stale for .../sessions/<session>.jsonl
    4. Watch the session dir: the corresponding .jsonl.lock may appear for only ~50–70ms and then disappear

    That 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:

    • this is reproducible without a permanently orphaned lockfile
    • the remaining safe mitigation on affected installs is to avoid parallel tool fan-out in the live main session until the runtime lock path is fixed

    If useful, I can add a tighter repro script/sequence, but the strongest signal from this run was:

    • sequential calls: ok
    • parallel calls: stale-lock repro
    • lock sidecar: transient, not stuck
  7. steipete commented on May 31, 2026

    @steipete
    Contributor

    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 SessionWriteLockStaleError for 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.

  8. locked as resolved and limited conversation to collaborators on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal backlog priority with limited blast radius.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions