Skip to content

Unclosed FileHandle on session JSONL lock crashes gateway on Node ≥24 under sustained session-store load #84820

Closed

Description

@cjalden

Summary

The gateway leaks unclosed fs.FileHandle references on session transcript .jsonl.lock files. On Node 22 (the supported LTS line per the 2026.5.18 release notes) this surfaces only as a deprecation warning, but on Node 24+ V8 promotes FileHandle GC to a fatal ERR_INVALID_STATE, which crashes the gateway process whenever the V8 GC happens to sweep one before OC closes it.

In our deployment this manifests as a chronic ~2-hour crash cadence on a single bot that accumulated a large session backlog (2,446 JSONL files in ~/.openclaw/agents/main/sessions/). Other bots on the same host / OC / Node version don't crash — they have 5–100 sessions on disk and don't generate enough open-handle pressure for V8 to ever GC a leaked one.

Environment

  • OC: 2026.5.18 (npm)
  • Node: 25.9.0 (three majors above the documented Node 22.19 minimum, but well within what users on rolling-release Homebrew get by default)
  • OS: macOS 26.4.1 arm64
  • Bot has been running ~30h under sustained activity; heartbeat interval is the gateway default 7,200,000ms (gateway/heartbeat: {"intervalMs":7200000} heartbeat: started)
  • Session count on disk: 2,446 .jsonl files; no stale .lock files at rest

Symptom

Every ~2h a stability bundle is written with reason: uncaught_exception and this error:

A FileHandle object was closed during garbage collection. This used to be allowed with a deprecation warning but is now considered an error. Please close FileHandle objects explicitly. File descriptor: <N> (/Users/<bot>/.openclaw/agents/main/sessions/<uuid>.jsonl.lock)

The FD number and session UUID rotate; the path pattern is invariant: always a .jsonl.lock file in the agent's `sessions/` directory.

On the next launchd-driven restart the gateway's `main-session-restart-recovery` logs:

```
warn marked 1 interrupted main session(s) from stale transcript locks
warn marked interrupted main session failed: agent:main:main:heartbeat (transcript tail is not resumable)
```

confirming the leaked handle was held by the heartbeat session.

After ~4 crashes in 8h, macOS launchd's anti-thrash kicks in (`Successfully spawned … because inefficient`) — downstream symptom, not the root cause.

Reproducer

  1. Run gateway on Node ≥24
  2. Accumulate ~2,000+ session JSONL files in the agent's sessions directory
  3. Let the default 2h heartbeat fire several times
  4. Crash typically occurs within 2–4 hours

Likely root cause

OC's session-store code opens FileHandles for transcript locks during heartbeat-session write / scan operations and doesn't always go through an explicit `.close()` on every return path (likely error paths or interrupted writes). On Node 22 this is harmless because GC-close was warn-only; on Node 24+ it's fatal.

The stability bundle includes the diagnostic-phase log up to seq=181 (load → normalize → plugins → channels) but does not include the throwing stack frame, since the crash is in V8's GC sweep rather than user code.

Suggested fix direction

Audit `FileHandle` open call sites in the session-store layer (anywhere transcript locks are taken) for non-explicit close paths, especially:

  • Error returns mid-write
  • Heartbeat-session interrupt handling on shutdown
  • Session metadata scans — the likely dominant pressure source given the 2,446-session correlation

Wrapping with `try { … } finally { await handle.close() }` or porting to `fs.promises.readFile`-style auto-closing helpers should close the leak.

Workaround for affected users

Either downgrade Node to the documented 22.19+ LTS line, or prune old session JSONL files until the on-disk count is in the low hundreds.

Stability bundle excerpt (sanitized)

```json
{
"version": 1,
"generatedAt": "2026-05-21T04:32:40.158Z",
"reason": "uncaught_exception",
"process": { "pid": 72273, "platform": "darwin", "arch": "arm64", "node": "25.9.0", "uptimeMs": 7208113 },
"error": {
"name": "Error",
"code": "ERR_INVALID_STATE",
"message": "A FileHandle object was closed during garbage collection. This used to be allowed with a deprecation warning but is now considered an error. Please close FileHandle objects explicitly. File descriptor: 38 (/Users//.openclaw/agents/main/sessions/.jsonl.lock)"
}
}
```

I have 10 stability bundles over a 31h window with the same error signature (different FD / UUID each time) — happy to share more if useful.

Activity

  1. clawsweeper commented on May 21, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.

    Latest ClawSweeper review: 2026-05-22 08:07 UTC / May 22, 2026, 4:07 AM ET.

    Workflow note: Future ClawSweeper reviews update this same comment in place.

    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.

    Summary
    Keep open: the report has credible crash-loop evidence and the current code still uses the session .jsonl.lock FileHandle path, but current main does not have enough macOS/Node 25 heartbeat-with-exec proof or a direct FileHandle-leak fix to close this as implemented.

    Reproducibility: no. high-confidence current-main reproduction is available yet. The reporter's production evidence is strong and now points to macOS Node 25 heartbeat sessions that run exec, but maintainer current-main Linux stress attempts did not reproduce the FileHandle GC crash.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Next step
    The report is credible and high impact, but the exact current-main leak path needs maintainer-led macOS/Node 25 reproduction before a safe automated repair PR.

    Review details

    Best possible solution:

    Build a macOS arm64 Node 25 heartbeat-with-exec stress reproduction with forced GC/open-handle observation, then fix the exact session lifecycle or fs-safe sidecar-lock path and validate it against Node 22 plus Node 24/25.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main reproduction is available yet. The reporter's production evidence is strong and now points to macOS Node 25 heartbeat sessions that run exec, but maintainer current-main Linux stress attempts did not reproduce the FileHandle GC crash.

    Is this the best way to solve the issue?

    Unclear. The suggested explicit-close direction is correct in principle, but current source and fs-safe already have centralized release paths, so the best fix should first isolate the leaking FileHandle instead of applying a broad speculative cleanup sweep.

    Label changes:

    • add issue-rating: 🦐 gold shrimp: Current issue advisory state selects this label.
    • add clawsweeper:needs-info: Current issue advisory state selects this label.
    • remove clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.
    • remove issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.

    Label justifications:

    • P1: The report describes repeated gateway crashes affecting an active bot under sustained session-store load on modern Node.
    • impact:crash-loop: The stability bundle evidence shows uncaught exceptions repeatedly terminating the gateway process.
    • impact:session-state: The failing path is the agent session transcript lock and restart recovery marks interrupted main sessions.

    Acceptance criteria:

    • MacOS arm64 Node 25 gateway heartbeat-with-exec soak/stress with forced GC and open FileHandle observation.
    • node scripts/run-vitest.mjs src/agents/session-write-lock.test.ts src/agents/pi-embedded-runner/run/attempt.session-lock.test.ts src/agents/pi-embedded-runner/run/attempt.subscription-cleanup.test.ts
    • If the root cause is in @openclaw/fs-safe, validate the package source/contract and bump the pinned dependency with lockfile/release proof.

    What I checked:

    • Reporter and maintainer discussion: The issue body reports 10 stability bundles over 31 hours on openclaw@2026.5.18/Node 25.9.0, all crashing with ERR_INVALID_STATE on .jsonl.lock; the latest reporter comment narrows the differentiator to heartbeat sessions that run child-process exec, while a maintainer comment says several AWS Linux Node 25 current-main stress probes did not reproduce the crash.
    • Current lock acquisition path remains live: acquireSessionWriteLock() still derives <session>.jsonl.lock and delegates to the process-wide SESSION_LOCKS.acquire(...) manager, so the reported lock-file path is still part of current main. (src/agents/session-write-lock.ts:716, 6981051682f2)
    • Dependency FileHandle contract: The pinned @openclaw/fs-safe@0.2.7 sidecar-lock implementation opens the lock with fs.open(..., "wx"), retains the FileHandle in the held-lock entry, and closes it in releaseHeldLock(); its docs tell callers to release in finally, which makes the dependency boundary relevant to the reported GC-close crash. (npm:@openclaw/fs-safe@0.2.7/dist/sidecar-lock.js:219, d649786af91d)
    • Attempt lifecycle has release paths but no crash proof: The embedded attempt lock controller releases before prompt I/O, reacquires around writes, and releases owned short locks in finally; this is relevant cleanup coverage, but it does not prove the macOS/Node 25 heartbeat/exec FileHandle GC crash is fixed. (src/agents/pi-embedded-runner/run/attempt.session-lock.ts:493, 6981051682f2)
    • Cleanup release is centralized: cleanupEmbeddedAttemptResources() releases its cleanup lock in a final finally block after session/tool/runtime cleanup, which supports the intended release shape but still leaves the exact leaking return path unidentified. (src/agents/pi-embedded-runner/run/attempt.subscription-cleanup.ts:115, 6981051682f2)
    • Existing tests do not cover the reported stress path: Current tests cover watchdog release, exit cleanup, prompt lock release/reacquire, and cleanup release ordering, but there is no Node 24+/25 forced-GC or macOS heartbeat-with-exec stress proof over a large session directory. (src/agents/session-write-lock.test.ts:313, 6981051682f2)

    Likely related people:

    • vincentkoc: Authored the session-lock exit-listener leak cleanup and appears in current session-lock history around the same cleanup surface. (role: recent area contributor; confidence: medium; commits: f00f0a95968f, 6981051682f2; files: src/agents/session-write-lock.ts, src/agents/session-write-lock.test.ts)
    • steipete: Authored session-lock contention/cleanup hardening and the current @openclaw/fs-safe dependency bump that owns the delegated FileHandle lock implementation. (role: recent area contributor; confidence: high; commits: 1becebe188eb, fb6e415d0c52, 1a7669bc63a0; files: src/agents/session-write-lock.ts, package.json, pnpm-lock.yaml)
    • Grynn: Authored the earlier watchdog/stale-lock recovery work for hung API calls and session .jsonl.lock cleanup, merged by Peter Steinberger. (role: feature-history contributor; confidence: medium; commits: e91a5b021648; files: src/agents/session-write-lock.ts, src/agents/session-write-lock.test.ts, src/gateway/server-startup-post-attach.ts)
    • moeedahmed: Authored recent embedded attempt cleanup/session-lock-adjacent work credited in the attempt lifecycle area, with review by jalehman. (role: recent adjacent contributor; confidence: medium; commits: 9c00268914b9; files: src/agents/pi-embedded-runner/run/attempt.session-lock.ts, src/agents/pi-embedded-runner/run/attempt.subscription-cleanup.ts, src/agents/pi-embedded-runner/run/attempt.ts)
    • tianxiaochannel-oss88: Authored the merged adjacent prompt-release session-write fix for in-process writes, which overlaps the heartbeat/post-prompt session-lock area but is not proven to fix this FileHandle crash. (role: adjacent proposed-fix contributor; confidence: medium; commits: 1b77145687ca; files: src/agents/pi-embedded-runner/run/attempt.session-lock.ts, src/agents/pi-embedded-runner/run/attempt.ts, src/config/sessions/transcript-write-context.ts)

    Remaining risk / open question:

    • The exact current-main leak path is still unproven because Linux Node 25 stress attempts did not reproduce while the reporter's latest lead is macOS arm64 heartbeat sessions that run child-process exec.
    • The issue may cross the OpenClaw session lifecycle and @openclaw/fs-safe sidecar-lock boundary, so a durable fix may require either local lifecycle changes or a dependency release and bump.
    • Adjacent session-fence fixes and the shipped fs-safe bump reduce suspicion in nearby code, but they do not provide direct FileHandle GC-leak proof for this crash signature.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 6981051682f2.

  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:crash-loopCrash, hang, restart loop, or process-level availability failure.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm 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 21, 2026
  3. self-assigned this
    on May 21, 2026
  4. joshavant commented on May 22, 2026

    @joshavant
    Collaborator

    Thanks for the detailed report. We tried several current-main reproductions on AWS Linux with Node 25.9.0, including large session directories, transcript append stress, real gateway/session soak, and gateway-shaped lock contention. So far we have not reproduced the unclosed .jsonl.lock FileHandle crash.

    Could you share a few more details to help narrow the remaining gap?

    • Is ~/.openclaw on local APFS, iCloud Drive, Dropbox, a network volume, or any synced filesystem?
    • What exact command/process manager starts the gateway?
    • Does the crash still happen if you run the same bot on Node 22.19.x for one heartbeat interval?
    • Can you share one redacted stability bundle plus the matching gateway logs around the preceding heartbeat?
    • Can you share one redacted .jsonl.lock payload if any lock file is present immediately after a crash?
    • Does pruning the sessions directory below a few hundred files stop the crash for more than one heartbeat interval?

    One current-main finding: lock contention between real OpenClaw-classified gateway processes behaves correctly in our probe: contenders time out, lock files are released, and we see no warning/uncaught/deleted lock FD signal. That points us toward a macOS-specific or real lifecycle-path reproduction rather than the normal transcript append lock path.

  5. removed their assignment
    on May 22, 2026
  6. cjalden commented on May 22, 2026

    @cjalden
    Author

    Thanks for digging in. Answers in order, with one promising lead at the bottom:

    1. Filesystem

    Local APFS, no sync layer:

    /dev/disk3s5 on /System/Volumes/Data (apfs, local, journaled, nobrowse, protect, root data)
    
    • The bot's home (/Users/<bot>/) is on the main data volume — same disk, not external.
    • No iCloud Drive (~/Library/CloudStorage doesn't exist on the bot account), no Dropbox in the bot's home, no network mounts touching .openclaw/.
    • No extended attributes on sessions/ or its files (xattr returns empty).
    • File ACLs are set (drwx------+) but that's just a single inherited ACE granting another local user read access — no kqueue/fsevents wedge that we know of.

    2. Process manager

    macOS launchd LaunchDaemon, KeepAlive=true, running as a non-admin local user:

    program = /opt/homebrew/bin/node
    arguments = { node, /opt/homebrew/lib/node_modules/openclaw/dist/index.js, gateway, --port, <port> }
    environment = { NODE_EXTRA_CA_CERTS=/etc/ssl/cert.pem, OPENCLAW_LAUNCHD_LABEL=..., OPENCLAW_SERVICE_KIND=gateway, OPENCLAW_GATEWAY_PORT=<port>, HOME=/Users/<bot>, TMPDIR=/tmp, PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin }
    umask = 77
    exit timeout = 5
    

    Nothing else (no pm2, no nodemon, no shell wrapper). After repeated crashes, launchd eventually inserts an "anti-thrash" SIGTERM-then-relaunch cycle with reason inefficient, but that's downstream of the crashes.

    3. Node 22 control

    Downgraded the same host from Node 25.9.0 to Node 22.22.3 (same 22 LTS line; didn't try 22.19.x specifically). The affected bot has been running ~13 hours and ~6 heartbeat intervals with zero new uncaught_exception stability bundles. Identical config, identical session directory, identical workload. So the crash is gated on Node ≥24's promotion of FileHandle GC to ERR_INVALID_STATE.

    4. Stability bundle + matching gateway log

    The interesting events from the snapshot leading up to the crash (full bundle available if you want it — happy to email or attach to the issue):

    { "seq": 100, "type": "session.state", "outcome": "processing", "reason": "run_started" }
    { "seq": 102, "type": "diagnostic.memory.sample", "memory": { "rssBytes": 856670208, "heapTotalBytes": 577814528, "heapUsedBytes": 452423000 } }
    { "seq": 103, "type": "diagnostic.liveness.warning", "level": "info", "eventLoopDelayMaxMs": 8262.8, "eventLoopUtilization": 0.436,
      "source": "agent:main:main:heartbeat(processing/model_call,q=0,age=13s last=model_call:started)" }
    { "seq": 104, "type": "diagnostic.heartbeat" }
    { "seq": 141, "type": "exec.process.completed", "target": "host", "mode": "child", "durationMs": 13, "exitCode": 0 }
    { "seq": 143, "type": "exec.process.completed", "target": "host", "mode": "child", "durationMs": 14, "exitCode": 0 }
    { "seq": 145, "type": "exec.process.completed", "target": "host", "mode": "child", "durationMs": 14, "exitCode": 0 }
    { "seq": 181, "type": "session.state", "outcome": "idle", "reason": "run_completed" }   // ts 1779337959888
    // 270 ms later, the crash:
    "error": { "code": "ERR_INVALID_STATE", "message": "... File descriptor: 38 (/Users/<bot>/.openclaw/agents/main/sessions/<uuid>.jsonl.lock)" }
    // process uptimeMs at crash: 7,208,113 (≈ 2h00m08s, i.e. exactly one heartbeat after start)

    The matching gateway log around the failing session (third-party plugin output redacted):

    04:32:20.412 INFO  plugins: <redacted plugin> starting
    04:32:20.419 INFO  plugins: before_model_resolve fired
                                          sessionKey=agent:main:m
                                          userMessage="<heartbeat prompt asking the agent to read a workspace context file and follow its instructions>"
                                          eventKeys=[prompt]
                                          ctxKeys=[runId,jobId,agentId,sessionKey,sessionId,workspaceDir,modelProviderId,modelId,trigger,messageProvider,channelId]
    ... (model call + 3 exec subprocesses, ~20s) ...
    04:32:40.154 ERROR openclaw: OpenClaw hit an unexpected runtime error.
    04:32:40.156 ERROR openclaw: A FileHandle object was closed during garbage collection ... File descriptor: 38 (...<uuid>.jsonl.lock)
    04:32:40.162 ERROR openclaw: wrote stability bundle
    04:32:40.662 INFO  gateway: loading configuration...   <- launchd relaunch
    

    5. .jsonl.lock payload

    No .lock files at rest in any agent's sessions dir right now (find ... -name "*.lock" returns empty). The on-restart main-session-restart-recovery sweep removes/marks the stale lock when the next gateway starts, so by the time anyone could grep for one it's already gone. The earlier log shows the recovery message: warn marked interrupted main session failed: agent:main:main:heartbeat (transcript tail is not resumable). Happy to instrument a wrapper to snapshot the lock between crash and relaunch if you'd like the contents — let me know.

    6. Prune-alone test

    Can't disambiguate cleanly from current data. We pruned the directory (2,446 → 204 .jsonl files) and the Node downgrade happened a few hours later — both interventions overlap the "no more crashes" window. To answer it properly I'd need to put Node 25 back with the pruned directory, which I'd rather not do while the bot is in service. If you want a controlled probe, I can stand it up on a side host.


    Lead worth chasing: heartbeat sessions that exec subprocesses

    We have a handful of bots on the same host, same OC version, same Node. Only one crashes. The differentiator isn't volume — it's that the affected bot's heartbeat session actually runs work. From the bundle: 3 exec.process.completed events fire during the heartbeat session's run, all mode: "child", target: "host". Every other bot's heartbeat is effectively a no-op (the heartbeat poll model_call returns "nothing to do") and never crashes, even on Node 25.9.0 with similarly-sized session histories.

    The crash happens 270 ms after session.state: idle, reason: run_completed — i.e. during the post-session GC sweep, not during transcript writes. That matches your finding that the normal transcript-append lock path is clean.

    Suggested reproducer to try on macOS arm64:

    1. Run gateway on Node ≥24 (any 25.x).
    2. Configure the heartbeat to do real work — at minimum, have the agent invoke the exec tool 2–3 times per heartbeat (any prompt that gets it to shell out a few times).
    3. Wait one heartbeat interval. The crash should land within ~250ms of run_completed.

    My best guess at the leak: somewhere in the heartbeat-session teardown path, a transcript-lock FileHandle is overshadowed/reassigned by a code path that ran child-process I/O, so the original handle has no live reference and gets GC'd before the cleanup ever calls .close() on it. macOS may be hitting this where Linux doesn't because of differences in how child_process.spawn interacts with parent FDs (or because of timing/GC scheduling differences in V8 on Darwin arm64).

    Will gladly run any additional probes you want, including reverting to Node 25 on a side instance to bisect prune-vs-runtime.

  7. added
    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.
    and removed
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    on May 22, 2026
  8. yaorenliang commented on May 23, 2026

    @yaorenliang

    Additional crash data — same pattern, Node 26

    Seeing the same crash on my setup with 3 stability snapshots in 2 days.

    Environment

    • OC: 2026.5.19 (Homebrew)
    • Node: 26.0.0
    • OS: macOS 15.5 arm64 (MacBook Air M-series)
    • Session count on disk: ~765 .jsonl files at time of crash (cleaned up from 1,580+)

    Crash log

    All 3 crashes are the same ERR_INVALID_STATE from FileHandle GC:

    Crash 1 — 2026-05-21T09:15:28Z (uptime: ~3.5h)

    A FileHandle object was closed during garbage collection. … File descriptor: 24 (/private/tmp/openclaw/openclaw-active-memory-3keG8m/session.jsonl.lock)

    Crash 2 — 2026-05-22T04:20:22Z (uptime: ~62s)

    A FileHandle object was closed during garbage collection. … File descriptor: 40 (/Users/yaorenliang/.openclaw/agents/main/sessions/27d414fb-884c-49f6-b157-d015d2b070f5.jsonl.lock)

    Crash 3 — 2026-05-22T04:21:24Z (uptime: ~62s, immediately after crash-restart)

    Same as crash 2, different FD number (31)

    Additional observations

    1. Memory pressure correlates with crash cadence: gateway RSS was at 4.2–4.5GB (threshold 3GB) before the crash series, with memory pressure: level=critical logged every 5 minutes.

    2. Cron jobs trigger the crash path: the 系统资源监控 cron job failed at 08:18 with No API key found for provider "tokenmp" after a hot-reload invalidated the auth profile — this suggests the session lock leak may be on error/timeout paths during cron session lifecycle, not just heartbeat.

    3. Active-memory plugin also affected: crash 1 points to the active-memory plugin's session lock in /tmp/, not just the main agent sessions directory.

    4. Subagent session accumulation accelerates the problem: 383 completed subagent sessions (330 done + 50 failed) were tracked in sessions.json alongside 97 dashboard sessions and 14 cron sessions — the sustained session-store load matches the original report's reproducer.

    Workaround attempt

    Deleted 707MB of old trajectory/bak/checkpoint files (892 trajectory + 152 bak + 60 checkpoint files). Disk usage dropped from 1GB to 146MB but did not resolve the CPU/memory pressure — the leak is in-process, not on-disk.

    Hope this helps narrow down the non-explicit close paths.

  9. RomneyDa commented on Jun 1, 2026

    @RomneyDa
    Member

    Fixed/de-risked on current main by the session-lock lifecycle fixes in #86427 and #87747.

    Additional maintainer proof run on macOS arm64:

    • Node v25.9.0 and v26.3.0 negative control intentionally leaked a .jsonl.lock FileHandle; both crashed with the expected ERR_INVALID_STATE, proving the harness catches this Node 24+ failure mode.
    • Current main forced-GC lifecycle proof passed on Node v24.16.0, v25.9.0, and v26.3.0 using real acquireSessionWriteLock, real createEmbeddedAttemptSessionLockController, and real cleanup paths.
    • Reporter-shaped soak passed on Node v25.9.0 and v26.3.0: macOS arm64, 2,446 seeded session .jsonl files, 80 heartbeat-style cycles per Node version, 3 child-process execs per cycle, forced GC after every cycle, periodic stale-lock sweeps, final .jsonl.lock count 0.
    • Focused regression tests passed under Node v24.16.0, v25.9.0, and v26.3.0:
      node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt.session-lock.test.ts src/agents/embedded-agent-runner/run/attempt.subscription-cleanup.test.ts src/agents/session-write-lock.test.ts --reporter=verbose
      Result: 3 files passed, 101 tests passed.

    This does not replay a full live-provider heartbeat interval, but it covers the reported FileHandle-GC crash class on the reported macOS arm64 + Node 25/26 axis with the real lock implementation and heartbeat/exec-shaped session lifecycle.

  10. removed
    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.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    on Jun 1, 2026
  11. RomneyDa commented on Jun 1, 2026

    @RomneyDa
    Member

    Closing as fixed/de-risked on current main by #86427 and #87747.

    Maintainer proof is recorded here: #84820 (comment)

    Please open a new issue or ask to reopen this one if a current main or post-fix release still reproduces the Node 24+ .jsonl.lock FileHandle GC crash with comparable stability-bundle evidence.

  12. locked as resolved and limited conversation to collaborators on Jun 4, 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

    P1High-priority user-facing bug, regression, or broken workflow.impact:crash-loopCrash, hang, restart loop, or process-level availability failure.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