Skip to content

Subagent abort-settle fails to release .jsonl.lock, permanently breaking the session #95833

Description

@richwilson-bloom

Summary

When an embedded subagent run exceeds stuckSessionAbortMs (default 900s, 90s in our environment), the abort-settle mechanism times out but does not release the session .jsonl.lock file. Once locked, every subsequent message to that session returns "Something went wrong" until the lock file is manually removed.

Reproduction

  1. Set stuckSessionAbortMs to a low value (e.g., 90s)
  2. Trigger an embedded subagent run (via sessions_spawn with runtime="subagent") that takes longer than that threshold
  3. Observe the log: "embedded abort settle timed out"
  4. Observe that the session .jsonl.lock file persists for minutes after the run has "ended"
  5. Send any new message to that session — it returns "Something went wrong"
  6. Manually removing the .jsonl.lock file restores the session

Root Cause

Two bugs:

Bug 1 — Abort-settle does not release lock. When the abort-settle process itself times out (stuck waiting for a subagent that will not respond), it exits without cleaning up the lock file. The lock file should always be released on every exit path.

Bug 2 — Default stuckSessionAbortMs is too high. The default is 900s (15 minutes). A user has to wait 15 minutes before the system even attempts an abort, during which time the session is completely unresponsive. A more reasonable default would be 30-60s.

Impact

  • Session is permanently broken until manual intervention (lock file removal)
  • Every user message to a locked session silently fails with "Something went wrong"
  • No error raised to the user about the actual problem
  • Workaround: a watchdog cron that periodically scans for stale lock files and removes them

Environment

  • OpenClaw version: the version including the stuckSessionAbortMs configuration option
  • Host: Linux 6.8.0-124-generic (x64) on Vultr VPS
  • Trigger: sessions_spawn with runtime="subagent" where the subagent exceeded the abort timeout

Workaround

A watchdog process running on a cron timer that finds .jsonl.lock files older than stuckSessionAbortMs + buffer and removes them. This is fragile and should not be necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions