openclaw - 💡(How to fix) Fix [Bug]: `openclaw sessions --json` hangs when stdout is not a TTY on 2026.4.5 [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62076Fetched 2026-04-08 03:09:19
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Participants
Timeline (top)
cross-referenced ×3commented ×2

openclaw sessions --json hangs indefinitely when stdout is not a TTY on OpenClaw 2026.4.5.

This reproduces consistently on macOS (arm64) with Volta-managed Node. The same machine does not reproduce the issue on 2026.3.28.

Error Message

  • sessions --json > file hangs and leaves a 0-byte output file
  • sessions --json | head hangs with no output
  • subprocess.run(..., stdout=PIPE) hangs until timeout
  • no useful stderr is emitted

Root Cause

Additional note

This looks like a regression in 2026.4.5 rather than a local config/data corruption issue, because:

  1. 2026.3.28 works on the same machine
  2. 2026.4.5 reproduces the hang in isolated execution
  3. other commands such as health --json, config validate, doctor, and gateway status --json still work

Code Example

openclaw sessions --json > /tmp/sessions.json
openclaw sessions --json | head -n 5
python3 - <<'PY2'
import subprocess
subprocess.run(
    ["openclaw", "sessions", "--json"],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    timeout=20,
)
PY2

---

openclaw health --json > /tmp/health.json
RAW_BUFFERClick to expand / collapse

Summary

openclaw sessions --json hangs indefinitely when stdout is not a TTY on OpenClaw 2026.4.5.

This reproduces consistently on macOS (arm64) with Volta-managed Node. The same machine does not reproduce the issue on 2026.3.28.

Environment

  • OpenClaw: 2026.4.5 (3e72c03)
  • Previous working version on same machine: 2026.3.28 (f9b1079)
  • OS: macOS / Darwin 25.2.0 (arm64)
  • Node: v22.22.1
  • Install method: Volta-managed CLI

Impact

This breaks non-interactive / automation use of the sessions CLI, including:

  • shell redirection
  • pipes
  • subprocess capture in Python / other runtimes
  • cron / scripts / audit tooling

health --json still works under the same non-TTY conditions, so this appears specific to the sessions --json code path rather than a generic JSON-output failure.

Reproduction

The following all hang on 2026.4.5:

openclaw sessions --json > /tmp/sessions.json
openclaw sessions --json | head -n 5
python3 - <<'PY2'
import subprocess
subprocess.run(
    ["openclaw", "sessions", "--json"],
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE,
    timeout=20,
)
PY2

Control case that succeeds on the same machine:

openclaw health --json > /tmp/health.json

Observed behavior

  • sessions --json > file hangs and leaves a 0-byte output file
  • sessions --json | head hangs with no output
  • subprocess.run(..., stdout=PIPE) hangs until timeout
  • no useful stderr is emitted

Expected behavior

openclaw sessions --json should emit JSON and exit normally regardless of whether stdout is a TTY, pipe, redirect target, or captured stream.

Additional note

This looks like a regression in 2026.4.5 rather than a local config/data corruption issue, because:

  1. 2026.3.28 works on the same machine
  2. 2026.4.5 reproduces the hang in isolated execution
  3. other commands such as health --json, config validate, doctor, and gateway status --json still work

extent analysis

TL;DR

Downgrade to OpenClaw version 2026.3.28 to avoid the regression in sessions --json that causes it to hang indefinitely when stdout is not a TTY.

Guidance

  • Verify that the issue is indeed specific to version 2026.4.5 by testing other versions, especially 2026.3.28, which is known to work.
  • Test if other commands like health --json continue to work as expected in non-TTY environments to confirm the issue's scope.
  • Consider using the working version (2026.3.28) in automation scripts and cron jobs as a temporary workaround until the issue is resolved in newer versions.
  • If possible, test the sessions --json command in a TTY environment with version 2026.4.5 to see if the issue is strictly related to non-TTY output.

Example

No specific code example is provided as the issue seems to be related to the OpenClaw version rather than a code snippet that can be modified.

Notes

The exact cause of the regression is not specified, but given that 2026.3.28 works and other commands like health --json are unaffected, it suggests a version-specific issue with the sessions --json command.

Recommendation

Apply workaround: Downgrade to version 2026.3.28. This is because the specified version is known to work correctly with sessions --json in non-TTY environments, and downgrading avoids the regression introduced in version 2026.4.5.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

openclaw sessions --json should emit JSON and exit normally regardless of whether stdout is a TTY, pipe, redirect target, or captured stream.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING