Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Session JSONL write-lock timeouts block main, cron-nested, and subagent lanes, then surface as delivery/lifecycle failures without enough owner diagnostics.
Steps to reproduce
- Run OpenClaw with main-session and subagent delivery lanes writing to session JSONL files.
- Contend a session write lock long enough for lane tasks and final delivery to hit the write-lock timeout.
- Observe lane errors and direct announce failure logs.
Expected behavior
Write-lock timeouts should preserve enough owner liveness/starttime/staleness evidence for recovery triage, and subagent final output should remain durable even when direct announce cannot acquire the lock.
Actual behavior
Gateway logs showed 161 SessionWriteLockTimeoutError lines, 41 subagent lane rejections, and repeated main-session lane errors in the 2026-05-23T14:42:08Z through 2026-05-25T14:42:08Z window.
OpenClaw version
2026.5.25 dev checkout
Operating system
Linux WSL2
Install method
pnpm dev
Model
NOT_ENOUGH_INFO
Provider / routing chain
NOT_ENOUGH_INFO
Additional provider/model setup details
NOT_ENOUGH_INFO
Logs, screenshots, and evidence
Window analyzed: 2026-05-23T14:42:08Z through 2026-05-25T14:42:08Z
Counts:
- 161 lines contained: SessionWriteLockTimeoutError
- 41 lines contained: lane task rejected after timeout
- 158 lines contained: lane task error
Redacted excerpts:
lane task rejected after timeout: lane=subagent timeoutMs=31000 error="SessionWriteLockTimeoutError: session file locked (timeout 60000ms): pid=[redacted pid] [redacted session lock path]"
lane task error: lane=cron-nested durationMs=380507 error="SessionWriteLockTimeoutError: session file locked (timeout 60000ms): pid=[redacted pid] [redacted session lock path]"
[warn] Subagent completion direct announce failed for run [redacted run id]: SessionWriteLockTimeoutError: session file locked (timeout 60000ms): pid=[redacted pid] [redacted session lock path]: code=OPENCLAW_SESSION_WRITE_LOCK_TIMEOUTImpact and severity
Affected: main session, cron-nested, and subagent delivery lanes.
Severity: High, because completion output can fail after child work is otherwise done.
Frequency: 161 timeout lines were observed in the analyzed two-day log window.
Consequence: lifecycle delivery and direct announce can fail behind a session write lock.
Additional information
The implicated code paths were src/agents/session-write-lock.ts timeout reporting and subagent final-delivery persistence.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 25, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 21, 2026, 8:15 AM ET / 12:15 UTC.
Summary
Keep open: current main and v2026.6.9 still retain the 60s session write-lock timeout class and still clear durable fallback completion text during suspended-delivery expiry; the linked closing PR remains open and unmerged, with later comments adding fresh v2026.6.8 production reports.
Reproducibility: yes. at source level: current main still has the 60s write-lock acquire timeout and clears completion fallback during suspended-delivery expiry, and the thread includes fresh v2026.6.8 live reports. I did not run the timing-sensitive gateway race in this read-only review.
Root-cause cluster
Relationship:
canonicalCanonical: #86538
Summary: This issue remains the canonical tracker for unresolved session write-lock timeout plus subagent completion delivery loss; related items either feed into it, partially overlap it, or are candidate fixes.
Members:
fixed_by_candidate: fix: preserve subagent delivery after lock stalls #86540 - The open PR uses closing syntax for this issue and directly changes session-write-lock diagnostics and suspended delivery fallback preservation.same_root_cause: [Bug]: Subagent terminal reconciliation can expire suspended final delivery #86537 - The companion issue tracks suspended final-delivery expiry discarding final payload, which is one of this issue's durable delivery-loss paths.superseded: Session file lock timeout when multiple subagent completion events arrive concurrently #88383 - The narrower concurrent completion lock issue is closed and redirected remaining lock-loss behavior to this canonical issue.superseded: [Bug]: sessions_yield abort-settle timeout (2000ms) leaks session write lock on 2026.6.5 — session bricked for minutes, announces lost, staleness never fires (holder pid = gateway, alive=true) #92459 - The sessions_yield abort-settle lock report was closed as duplicate/superseded by this issue while preserving its traces here.partial_overlap: Subagent completion delivery can fail when requester run is inactive and session transcript is locked #92076 - It tracks requester-inactive completion delivery failures when the transcript is locked, overlapping message-loss symptoms but with a distinct direct-message fallback scope.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
A linked closing PR already owns the narrow repair, and maintainer review is needed before starting another fix lane.
Review details
Best possible solution:
Review and rebase the linked repair or an equivalent narrow replacement, preserve final subagent text before suspended-delivery expiry, improve lock owner diagnostics, and explicitly track broader run-aware ownership or requester-session serialization as follow-up if out of scope.
Do we have a high-confidence way to reproduce the issue?
Yes, at source level: current main still has the 60s write-lock acquire timeout and clears completion fallback during suspended-delivery expiry, and the thread includes fresh v2026.6.8 live reports. I did not run the timing-sensitive gateway race in this read-only review.
Is this the best way to solve the issue?
Unclear as a final shape. The linked PR is a plausible narrow repair for durable fallback and diagnostics, but maintainers still need to decide whether broader run-aware lock ownership or requester-session serialization belongs in this fix cluster.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 12c34fc3a951.
Label changes
Label changes:
clawsweeper:fix-shape-clear: Current issue advisory state no longer selects this label.clawsweeper:needs-maintainer-review: Current issue advisory state no longer selects this label.Label justifications:
P1: The issue affects real multi-subagent and channel delivery workflows with repeated production reports across recent releases.impact:session-state: The failure is rooted in session JSONL write-lock ownership and suspended subagent completion state.impact:message-loss: Subagent final output or requester-visible replies can fail, be delayed, or require manual recovery before delivery.Evidence reviewed
What I checked:
AGENTS.md:1, 12c34fc3a951)src/agents/session-write-lock.ts:51, 12c34fc3a951)src/agents/session-write-lock.ts:728, 12c34fc3a951)src/agents/subagent-registry.ts:823, 12c34fc3a951)src/agents/subagent-announce-output.ts:363, 12c34fc3a951)docs/tools/subagents.md. (docs/tools/subagents.md:65, 12c34fc3a951)Likely related people:
src/agents/session-write-lock.ts,src/agents/subagent-registry.ts,src/agents/subagent-registry-run-manager.ts)src/agents/session-write-lock.ts,src/agents/subagent-registry.ts,src/agents/subagent-announce-delivery.ts)src/agents/session-write-lock.ts,src/agents/session-write-lock.test.ts,src/agents/subagent-registry.ts)src/agents/subagent-announce-delivery.ts,src/agents/subagent-announce-delivery.test.ts)src/agents/subagent-registry.ts,src/agents/subagent-registry-run-manager.ts,src/agents/subagent-registry.test.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.robertdonnellyiii commentedon May 29, 2026
Me-too repro on
2026.5.28-beta.1, macOS 25.5.0, requester session = webchat dashboard, model =anthropic/claude-opus-4-7.User spawned 5 parallel research subagents (council pattern) on Opus 4.7 via
sessions_spawnfrom a webchat main session. All 5 children completed cleanly, wrote their deliverables to disk, and ended with substantive (~10KB) final assistant text.openclaw tasksshows the consistent signature:Gateway log shows the announce path hitting the 180s ceiling, exactly 4 retries, then giving up:
…repeated for each of the 5 children. No completion ever delivered to the parent webchat session. From the user's perspective: parent session went silent after
sessions_yield; user had to manually nudge ("did it land without an announcement again?") for the parent to discover, viasubagents/openclaw tasks, that the children had in fact succeeded.Two extra data points worth noting:
Failure-status completions DO deliver. A separate diagnostic spawn the same session crashed early with
FailoverError: Unknown model: anthropic/claude-haiku-4-5(separate model-whitelist issue). Itsstatus: failedcompletion event delivered to the parent webchat without issue. So the SessionWriteLockTimeout appears to bite specifically on success-path announce-writes carrying real payload, not on failure-path short events. Useful narrowing if the linked PR doesn't already cover both lanes.5/5 children hit the same write-lock window. Five concurrent direct-announce writes targeting the same parent webchat session JSONL appear to mutually contend for the parent's write lock. The N-concurrent-spawn case might warrant explicit serialization of announce-writes against a single requester session even after the underlying timeout fix, since 60s × 5 children > 180s ceiling on its own.
User-side impact: durable artifact loss is small (children write deliverables to disk before final reply, so files persist), but trust impact is real — the parent agent looks like it silently abandoned the work, and discovers success only by polling
openclaw tasks. Until this lands, our workaround is to instruct the parent to alwaysopenclaw tasks+ read the lane files itself on the next user turn rather than trust the announce path, which defeats the point ofsessions_yield.Happy to capture full raw gateway log slice if useful — the four
[warn]lines per child are the only emitted signal at default log level.itanyplus commentedon Jun 8, 2026
Friendly ping — this is causing daily production outages
Pinging for visibility since this is P1 and has a linked PR open.
As of v2026.6.1 (the latest stable), this bug is still fully reproducible. The user-facing experience in Feishu/Telegram channels is:
This error now appears on nearly every multi-subagent workflow. The only recovery is manually deleting
.lockfiles and restarting the gateway. Sub-agents finishing concurrently is not an edge case — it is the normal operating mode for any non-trivial task.Is the linked PR still on track? Is there anything blocking the merge? Happy to help test a branch if needed.
itanyplus commentedon Jun 9, 2026
Just hit this again on v2026.6.5-beta.6 (Jun 9) — daily production impact, not a corner case.
Gateway log from minutes ago:
Classic pattern: subagent holds the session JSONL write lock (maxHoldMs=1020000 = 17min), next user message arrives, main session waits 60s for the lock → timeout → user sees:
This happens every single time a subagent runs longer than ~60 seconds. With complex tasks (web search + analysis + file writes), that is the norm, not the exception.
Three stale .lock files sitting right now, all held by the gateway PID itself:
The mismatch is clear: 17-minute lock hold vs 60-second wait timeout. Any subagent doing real work will blow past 60s.
This is P1 with a linked PR open. It has been causing daily production outages for weeks. Can we get the PR reviewed and merged? Happy to test a fix build if needed.
itanyplus commentedon Jun 10, 2026
Ping — 2026.6.5 stable shipped without this fix, production impact continues
v2026.6.5 stable just released, but PR #86540 is still unmerged. This P1 bug keeps impacting daily production.
Latest reproduction (v2026.6.5 stable, identical to v2026.6.5-beta.6):
Every time
sessions_spawnruns parallel subagent work, the main session almost inevitably triggers a write-lock timeout. Users see:Subagents finish their work, write deliverables to disk, but the delivery announce fails due to lock timeout — results are lost.
The root contradiction remains unchanged:
maxHoldMs=1020000(17 min) vsacquireSessionWriteLock timeout=60000ms(60 s). Subagents hold the JSONL lock far longer than the acquire timeout, so any subsequent announce on the parent session is guaranteed to fail.PR #86540 has Azure Crabbox proof + maintainer code review (galiniliev verified at
f9c6fc7d, martingarramon commented on the lock diagnostics). It has been stuck onstatus: 📣 needs prooffor 12 days with no follow-up.Questions:
session-write-lock.ts?This bug makes
sessions_spawn+sessions_yieldessentially unusable in production — subagent output is silently lost on lock contention, which defeats the entire parallel workflow pattern.itanyplus commentedon Jun 11, 2026
Still reproducing on
2026.6.6-beta.1(commit99648bb).MainThread/dist/index.js gateway).Previously reproduced on
2026.6.5-beta.6,2026.6.5, and2026.6.1. The issue persists across all tested versions where#86540has not landed.itanyplus commentedon Jun 12, 2026
Still reproducing on
2026.6.6-beta.1(commit99648bb, built from source 2026-06-10).New reproduction — model fallback chain triggers write-lock timeout (2026-06-12)
A Feishu P2P user message arrived at 16:26:31 CST. The gateway started processing and the model call chain took ~3 minutes due to a primary model timeout + fallback:
Lock state at time of error:
{ "pid": 38158, "createdAt": "2026-06-12T08:26:31.408Z", "maxHoldMs": 300000, "starttime": 17444257 }Why this is a design issue, not a config issue:
Normal LLM call chains routinely exceed 60s. Primary model timeout → fallback is a common pattern. The
acquireTimeoutMs=60000default is fundamentally too short for production use with multi-model fallback.The turn-level queue (
replyRunRegistry) already serializes correctly — it waits indefinitely for the active turn to finish. But the file-level write lock operates independently and surfaces a scary error to the user instead of quietly queuing.The lock owner is the gateway itself (PID 38158 =
MainThread/dist/index.js gateway). Background operations (compaction, tool-result-truncation, transcript mirroring) all try to acquire the same per-session.jsonl.lockindependently of the turn admission queue, causing self-deadlock-like contention.Current config:
Workaround: Setting
acquireTimeoutMsto matchmaxHoldMs(300000) prevents the error, but this just masks the issue — background writes should coordinate with the turn queue rather than independently racing for the same lock.Environment:
2026.6.6-beta.1(commit99648bb, source build)aleps001 commentedon Jun 13, 2026
Cross-posting detailed
sessions_yieldabort-settle → session-write-lock traces here, as requested when #92459 was closed as duplicate/superseded by this canonical issue. Captured on a production WhatsApp gateway (OpenClaw 2026.6.5, systemd user service, WSL2, node 22), agent topologymain→workflow-lead→ domain leads. Timestamps are local-03:00.1.
sessions_yield abort settle timed out (timeoutMs=2000)— 7× in one day (2026-06-11), 3 sessions0bbed05d34cd9ea8e92c1fd434cd9ea8fd7fa2e834cd9ea8537ed53a4987297d76f9ce514987297d0a90a0809a34ce0fea032c2e9a34ce0f2. Downstream cascade — session bricked,
alive=trueso owner-liveness recovery never firesEach settle-timeout is followed by
SessionWriteLockTimeoutErroron that session's.jsonl.lock, with the holder pid being the gateway process itself (alive=true), so any liveness-based staleness check passes and the lock is never reclaimed:3. Lost subagent delivery (the data-loss mode this issue tracks)
On session
9a34ce0fthe leaked lock blocked a real subagent completion announce for ~minutes; it retried 3× against the gateway-held lock and then gave up, dropping the child's result:Observed
ageMsup to 585355 (~9.75 min) on a single hold; the worst real incident left the user-facing session unable to reply for ~20 min until the leaked in-flight await resolved on its own.4. Still reproduces on 2026.6.6 (different surface)
After upgrading to 2026.6.6 the lock-contention class persists, now visible as an orphan → restart-sweep →
cancelledchain: longeffectuatesubagent runs complete their work but the completion announce fails withcompletion agent did not produce a visible reply→Subagent announce give up (retry-limit), leaving the tracking task orphaned with no clean terminal. On the next gateway restart the sweeper settles those orphans ascancelled, and (subagent defaultnotify=done_only) delivers a burst ofBackground task cancellednotices to the channel for work that had actually succeeded. (The false-notice misclassification specifically was fixed in #92448 / #92631; the underlying lock contention + lost-delivery tracked here is the part that remains.)Note on the fix shape
Agreeing with the review on #92459: force-releasing the lock file or merely bumping the 2000 ms settle timeout would mask contention rather than fix it. The defect is run-aware ownership — distinguishing a legitimately long-held lock from ownership retained by an aborted/abandoned run whose holder pid is the live gateway — plus durable subagent-completion delivery, which is what #86540 is going after.
3 remaining items
itanyplus commentedon Jun 18, 2026
Fresh Feishu direct-chat repro on
2026.6.8— same gateway-owned lock, still user-visibleAdding another live production data point on the current stable release. This is a Feishu direct-chat failure, not Slack/subagent-specific, and it still matches the core
SessionWriteLockTimeoutErrorpath tracked here while PR #86540 remains labeledstatus: 📣 needs proof.Environment
2026.6.8 (844f405)— npm global install7.0.0-22-generic/usr/bin/node /usr/lib/node_modules/openclaw/dist/index.js gateway --port 18789agent:main:feishu:direct:ou_b21751e6f615d213220a7290f8157fce/home/itany/.openclaw/agents/main/sessions/81d6a0a4-7ad3-4ad8-ac1e-74416b3ffb26.jsonlUser-visible error
At
2026-06-18 18:19 CST, Feishu showed:The same message was seen again a few minutes later from the same Feishu direct session.
Lock evidence captured during the incident
{ "pid": 150880, "createdAt": "2026-06-18T10:17:49.870Z", "maxHoldMs": 300000, "starttime": 70505493 }Gateway process at capture time:
Another session lock from the same gateway PID was also present at the same time:
{ "pid": 150880, "createdAt": "2026-06-18T10:19:38.720Z", "maxHoldMs": 300000, "starttime": 70505493 }Why this is useful proof
This reproduces the same mismatch on latest stable:
pid=150880 alive=true)maxHoldMs: 300000(5 minutes)timeout 60000ms(60 seconds)ageMs=180210(~3 minutes), i.e. well inside the lock holder's 5-minute allowed window but already 3× longer than the requester write-lock timeoutSo this is not just stale lock cleanup. The active gateway can legally hold the session write lock long enough that normal incoming channel traffic times out before reply. This remains reproducible on
2026.6.8.itanyplus commentedon Jun 21, 2026
Still happening on 2026.6.8 — with new
EmbeddedAttemptSessionTakeoverErrorvariantReporting that session file lock issues persist on 2026.6.8 (844f405, stable), with both the original lock timeout AND a new error class appearing.
Errors observed today (2026-06-21, UTC+8)
Error 1 — Lock timeout (the usual):
Error 2 — Fence takeover (NEW since ~2026.5.x):
This is
EmbeddedAttemptSessionTakeoverError— the fence detects the session file was modified while the embedded prompt lock was released, but it cannot distinguish legitimate concurrent writes (subagent announce, auto-compaction, cron delivery) from external tampering.Context
sessions_spawn+sessions_yield) running long-running document processing tasks.jsonl.lockfile does not help — gateway immediately reacquires it because the run is still active.Root cause analysis (from related issues)
The fence mechanism in
assertSessionFileFence(see #88703 for the most detailed analysis) has a fundamental design flaw:sessions_yieldreleases the write lock — when the main run yields (e.g., waiting for subagent/image generation), it releases the session file write lock and records a fence fingerprint.assertSessionFileFencedetects the fingerprint mismatch. TheownedSessionFileWritesandtrustedSessionFileStateschecks fail because the second run's writes used a separate lock controller instance.EmbeddedAttemptSessionTakeoverErrorthrown — treated as a model failure, cascading through the fallback chain (see [Bug]: Session file lock errors cascade through model fallback chain #66646 — 46% of fallback decisions in one fleet are lock-based, not model-based).Why this is urgent
Suggested fix priorities
adoptCompactionTranscript— calllockGuard.refreshAfterOwnedSessionWrite()after compaction swaps the session file (see EmbeddedAttemptSessionTakeoverError: auto-compaction at reason=threshold trips fence on rewritten session jsonl #90729's suggested fix).isStreaming()=falsecannot be woken, forcingsendSubagentAnnounceDirectlyto launch a new run (see session file changed while embedded prompt lock was released #88703).Related issues
itanyplus commentedon Jun 22, 2026
Still happening on v2026.6.9 (npm release, not dev checkout). Same session locked by the gateway process itself for 2+ minutes while the lock acquire timeout is 60s.
Today's incident (2026-06-22, Asia/Shanghai)
Three cascading failures on the same feishu direct session
521e74fd:SessionWriteLockTimeoutErrorEmbeddedAttemptSessionTakeoverError(compound: lock timeout + file changed)SessionWriteLockTimeoutErrorAll held by
pid=222612(gateway main process, alive=true), same lock file521e74fd-634d-4680-b88b-1e01ef4359d5.jsonl.lock.Trigger chain
Plus the secondary:
feishu-dedup: persistent state error, falling back to memory: openKeyedStore is only available for trusted pluginsDeath spiral
Larger session JSONL files (~10MB for this session) → slower compaction → higher lock timeout risk. The most productive sessions doing the most real work are the ones most likely to break.
PR #86540
ClawSweeper re-reviewed yesterday (Jun 21) and still says: blocked until real behavior proof from a real setup is added. The proof requested is "after-fix live gateway/session replay."
This is a catch-22: we can't provide "after-fix" proof without the fix merged. The abundant before-proof (multiple production incidents across weeks, multiple OpenClaw versions) should be sufficient to demonstrate severity.
This bug makes long-running feishu direct sessions effectively unusable after they accumulate enough context.
itanyplus commentedon Jun 26, 2026
Cross-posting fresh Feishu production evidence because this thread is related. Context for this thread: Main/canonical session write-lock + subagent delivery lane issue.
Additional production evidence from Feishu DM lane (2026-06-26)
I'm adding fresh production evidence from a Feishu direct-message session on OpenClaw
2026.6.10.Environment
2026.6.107.0.0-22-genericx6424.17.0kuaipao-gpt/gpt-5.5sessions_spawnchild runs for paper-reading tasks, with completion announcements back to the Feishu requester sessionSummary
The Feishu lane repeatedly became unable to reliably receive normal user messages or subagent completion announcements while a long-running/compacting requester session was active. The failures were not isolated to one child run; they formed a cascade:
SessionWriteLockTimeoutError,EmbeddedAttemptSessionTakeoverError, or gateway request timeout.Counts from today's Feishu-related gateway logs
From
journalctl --user -u openclaw-gateway --since '2026-06-26 00:00:00', filtered for Feishu/session-lock/subagent/compaction terms:SessionWriteLockTimeoutError: 12Embedded agent failed before reply: 12EmbeddedAttemptSessionTakeoverError: 13Subagent completion direct announce failed: 38Subagent announce give up: 8Active requester session could not be woken: 24Compaction timed out: 12Full summarization failed: 9per-chat task exceeded 300000ms cap: 5lane wait exceeded: 45long-running session: 2Some early entries are provider/rate-limit failures, but the afternoon cluster below is specifically session lock / takeover / completion delivery related.
Representative timeline excerpt, redacted
Lock file state observed during the incident
The active Feishu requester session lock was owned by the live Gateway process, not an orphaned PID:
{ "pid": <gateway-pid>, "createdAt": "2026-06-26T06:52:28.443Z", "maxHoldMs": 300000, "starttime": 131306136 }The important mismatch remained: callers were failing after
timeout 60000mswhile the live lock could remain valid much longer (maxHoldMs: 300000in this release; previously observed as 1020000 in older releases).User-visible impact
The workflow was a serial paper-reading chain (
P01..P20) where each child writes a note file and the parent should announce completion and spawn the next child. During the incident:read_p11.md, so some child work completed;Why this seems relevant here
This looks like the same family as the session write-lock / long-turn / subagent delivery lane issues, but today's evidence adds two details:
2026.6.10, the lockmaxHoldMsis now300000, yet callers still fail at60000ms, so the timeout mismatch still creates user-visible failures.EmbeddedAttemptSessionTakeoverErrorappear to amplify the problem: once the requester session is busy/compacting, subagent completion delivery can fail repeatedly and eventually give up even though the child output exists.If useful, I can provide a fuller redacted log bundle, but I avoided pasting full paths, Feishu IDs, or local project contents here.
itanyplus commentedon Jun 26, 2026
Linking #96975: metadata-only subagent completion would reduce session write-lock and delivery-lane pressure by avoiding large child payload writes into the parent/requester session.
aleps001 commentedon Jun 26, 2026
Cross-channel corroboration: same
EmbeddedAttemptSessionTakeoverErroron WhatsApp direct (2026.6.10), on the intelligence/ingest subagent chainAdding a fresh, log-verified repro on a different channel and workload than the Feishu evidence above — same error, so it is not isolated to Feishu or to the paper-reading pattern.
Environment
gpt-5.5; chain workersgpt-5.4main->workflow-lead(an IP-ingest / IB-FM evaluation batch over 3 docs) ->intelligence-leadsubagent as step_1What happened
The
workflow-leadrun reached its first step (spawnintelligence-lead) and that embedded run failed with:It crashed before producing any routing output (no
routing-*.json), so the workflowcompletedwith no deliverable and the user saw the workflow stall. A retry in a "clean lane" then hit the same error, and the batch's routing decisions were never produced (the 3 documents remained unevaluated).Refs / timing (BRT) — same error recurring across the run and the retry:
workflow-leadrunc1d4149b...,intelligence-leadsubagent2a278381...EmbeddedAttemptSessionTakeoverErrorat09:16:30,09:17:22,09:24:03,09:27:03Why this is the same family
session file changed while embedded prompt lock was released) as the Feishu evidence, on 2026.6.10.workflow-lead/intelligence chain) is busy/large while the embedded child's prompt lock is released-and-reacquired, and the child's session file changes underneath it -> takeover error -> the step dies before output.This supports the #96975 direction (metadata-only completion to reduce session write-lock / delivery-lane pressure): heavy multi-agent chains where the requester session is large are exactly where the embedded prompt-lock release window gets clobbered.
(Phone number and internal IDs redacted.)
liuhaiyang14 commentedon Jun 29, 2026
Adding one more production/root-cause data point from a macOS local gateway. This matches the canonical class here, but the useful distinction is that the observed lock was held by the live gateway process itself, not by a dead PID or an orphan
.lockfile.Environment / incident shape:
2026.6.5during the incident; later static upgrade checks through2026.6.10still showed the same core risk shapes.22.22.1.agents/research/sessions/<session>.jsonl.lock.pid=<gateway pid>,maxHoldMs=1020000.lsofshowed the same gateway node process holding the lock FD, and the process was alive.Observed cascade:
The same session-write-lock timeout could block main-session replies, subagent completion announcements, and follow-up writes after
sessions_yield.Implementation shape observed in the packaged runtime:
60000ms.config.session.writeLock.*orOPENCLAW_SESSION_WRITE_LOCK_*; unrelated agent-default lock settings do not change this path.promptActiveSessionwrapsactiveSession.prompt(...)inside owned transcript-write context.releaseEmbeddedAttemptSessionLockForAbort(...)is fire-and-forget.sessions_yieldabort settle defaults to2000ms, so cleanup can time out while later transcript writes and direct announce still race the lock.Why this is not solved by only increasing timeouts:
Raising
session.writeLock.acquireTimeoutMsmakes callers wait longer, but does not fix the root contradiction: long provider/tool/yield/abort work can keep the session writer unavailable while other legitimate delivery lanes need to append. It can reduce visible failures in one lane while making head-of-line blocking worse.Suggested fix direction:
This is a production confirmation that the lock owner can be the live gateway itself (
alive=true), so recovery logic that only handles dead owners/orphan lock files cannot resolve the failure class.itanyplus commentedon Jun 29, 2026
Additional live reproduction from a Feishu direct session on 2026-06-29.
Environment:
openclaw statusagent:main:feishu:direct:...)openclaw status.Observed user-facing error at 2026-06-29 14:46 GMT+8:
Important detail:
pid=346578is the live gateway process itself fromopenclaw status, not a dead PID or orphaned lock owner.A few minutes later the same lock path still existed. Its metadata was:
{ "pid": 346578, "createdAt": "2026-06-29T06:51:09.800Z", "maxHoldMs": 300000, "starttime": 131306136 }Operational context from
openclaw statusaround the same time:This looks like same-process/live-gateway session lock contention or unreleased/reentrant lock behavior rather than stale dead-PID cleanup.
This seems to match the issue scope here: write-lock timeouts blocking channel/session delivery lanes, with the lock owner still alive and equal to the gateway process.
steipete commentedon Jul 11, 2026
Write-lock timeout pileups blocking delivery lanes were reported against the file-store write path; that path is now short SQLite transactions with structured contention telemetry, changing the whole contention profile.
Sessions and transcripts moved from JSON/JSONL files to per-agent SQLite on main (
0a8e3604ba24, plus follow-up4eef09dc3f5d), and the storage rework removed or rewrote the code paths implicated here. We're closing storage-implicated reports optimistically as part of that cleanup since we can't re-verify every historical environment. If this still reproduces on current main or the next release, please open a fresh issue with new logs and link back to this one.