Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
In the macOS app on current main, the first chat message after a fresh onboarding fails with "This host is low on memory, so it could not start another session." The Mac has plenty of memory. The packaged Gateway runs on Bun, and under Bun process.availableMemory() returns only truly free pages, so the 1 GiB Claude CLI live-session guard trips on a healthy Mac.
Steps to reproduce
- Build the macOS app from
mainat d29fad4 (scripts/package-mac-app.sh, debug, arm64) and launch it on a fresh profile (OPENCLAW_PROFILE=onboarding). - Complete onboarding with a local Gateway, using Claude Code (
claude-cli/claude-opus-5-5) as the AI. - Choose Talk to my agent and send
hi.
Expected behavior
The agent replies. The host was a 48 GB Apple silicon MacBook Pro, and memory_pressure reported "System-wide memory free percentage: 70%" at the time.
Actual behavior
The turn fails before any model call. The chat shows "This host is low on memory, so it could not start another session. Try again after active conversations finish." with Try again / Report a bug.
Gateway log (~/.openclaw-onboarding/logs/openclaw-onboarding-2026-11-16.log):
lane task error: lane=cli:claude-cli:owner:… durationMs=5 error="Host memory is too low for another CLI live session."
cli terminal failure: provider=claude-cli model=claude-opus-5-5 durationMs=344 … error=Host memory is too low for another CLI live session.
model fallback decision: … reason=rate_limit status=429 code=cli_live_session_host_memory … fallbackStepFinalOutcome=chain_exhausted fallbackConfigured=false
Embedded agent failed before reply: Host memory is too low for another CLI live session.
The same Mac, measured with the bundled runtime and with Node at the same moment:
| Runtime | process.availableMemory() |
os.freemem() |
os.totalmem() |
|---|---|---|---|
Bundled Bun 1.4.4 (~/.openclaw-onboarding/runtime/…/bin/bun) |
548,831,232 (0.55 GB) | 548,831,232 | 51,539,607,552 |
| Node 26.12.1 | 19,644,563,456 (19.6 GB) | 548,831,232 | — |
Under Bun on macOS, process.availableMemory() is identical to os.freemem(). macOS keeps truly free pages low, so most Macs in normal use read below 1 GiB.
OpenClaw version
main d29fad4 (2026.11.4, app build 2611160101)
Operating system
macOS 26.5.1 (arm64)
Install method
mac app (locally packaged from main, isolated OPENCLAW_PROFILE)
Model
claude-cli/claude-opus-5-5 (shown in the UI as anthropic/claude-opus-5-5)
Provider / routing chain
openclaw (mac app, local Gateway on Bun) -> claude-cli live session -> Anthropic
Additional provider/model setup details
No fallback model configured (fresh onboarding default).
Logs
See Actual behavior.
Screenshots, recordings, and evidence
Code at the tested commit:
src/infra/host-memory.ts#L8-L14:readHostFreeMemoryBytes()usesprocess.availableMemory()on darwin. Its doc comment assumes Node semantics ("Node's available-memory reading includes inactive and purgeable pages").src/agents/cli-runner/cli-live-session-registry.ts#L19and#L196-L224:ensureCliLiveSessionMemorythrowscli_live_session_host_memorywhen that reading is below 1 GiB.src/agents/failover/user-copy.ts#L66: user-facing copy.
Impact and severity
- Who: every macOS app user whose first agent runs through the Claude CLI live session. The packaged Gateway always runs on Bun.
- Severity: blocks the first message after onboarding. The user is told their Mac is out of memory when it is not. The error is categorized as
rate_limit/429, so it is retried or reported as capacity instead of a bug. - Release exposure: the guard is on
mainonly. It is not in v2026.11.1–v2026.11.3 or v2026.11.5-beta.1. It will ship in the next release cut frommainunless fixed.
Additional information
Contributing changes. Each change was reasonable on its own; the failure is in how they combine.
- feat(macos): run the private app runtime on the OpenClaw Bun fork #161603 (merged 2026-09-30, first shipped in v2026.10.1) moved the macOS app's private runtime, including the local Gateway, to the OpenClaw Bun fork.
- fix(devices): report available host memory #144535 (merged 2026-10-10, shipped in v2026.10.10) added
readHostFreeMemoryBytes()with a macOS branch that relies on Node'sprocess.availableMemory(). The app had already been running on Bun for ten days. At that point the only effect was understated free memory in device/host stats. - fix(cli): host runs out of memory when several Claude CLI conversations start at once #192534 (merged 2026-11-04, unreleased) added the blocking 1 GiB guard on top of that helper. Its description states the helper reads
process.availableMemory()on macOS. Its proof simulated memory at the helper/os.freememseam, so the packaged macOS app on Bun was never exercised.
Process gaps:
- Nothing tests the host-memory helper under the runtime the macOS app actually ships (Bun). Unit tests mock the reading.
- No packaged-app smoke test sends a first message after a fresh onboarding. A single "fresh install → first reply" check would have caught this before merge.
- The failure maps to
rate_limit, which hides a local guard decision behind a provider-capacity category.
Other callers with the same Bun-on-macOS assumption. These are not user-blocking but read too low under Bun:
src/infra/worker-pool-sizing.tsresolveUpdateHashWorkerCount()(process.availableMemory(); only Bun on Linux is special-cased).src/commands/doctor-database-port-memory-concurrency.ts(readHostFreeMemoryBytes()→ undersized rebuild concurrency).src/gateway/server-methods/system.tsandsrc/node-host/host-stats.ts(reported free memory).isConstrainedProcessLowOnMemory()usesprocess.constrainedMemory(); verify its Bun/macOS behavior while fixing.
Suggested direction: on darwin, compute reclaimable memory independently of the JS runtime (Mach VM statistics: free + inactive + purgeable + speculative) or detect a Bun-equivalent reading. Cover it with a test that simulates Bun's availableMemory == freemem behavior. Optionally, stop classifying this guard as rate_limit.
Found during a fresh-install onboarding walkthrough of the macOS app.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Nov 17, 2026
Codex review: this still needs some work.
Summary
This issue identifies a current first-message blocker: the packaged Bun runtime reports only free pages, and OpenClaw treats that reading as available memory when admitting a new Claude CLI session.
Reproducibility: The reporter's 548,831,232-byte Bun reading necessarily fails the current 1 GiB guard, and the pinned runtime source confirms that reading excludes reclaimable memory; no reviewer-run macOS reproduction is claimed.
Regression provenance
Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.
Next step
A maintainer should authorize the supported-runtime repair, establish a failing Darwin regression and packaged-app first-reply proof, and provide inline recovery for affected users.
Review details
Best possible solution:
Correct the supported Bun runtime's memory semantics while retaining genuine pressure protection, and offer inline recovery for users already blocked.
Do we have a high-confidence way to reproduce the issue?
The reporter's 548,831,232-byte Bun reading necessarily fails the current 1 GiB guard, and the pinned runtime source confirms that reading excludes reclaimable memory; no reviewer-run macOS reproduction is claimed.
Is this the best way to solve the issue?
Repairing the supported runtime contract avoids duplicating native memory accounting in OpenClaw; lowering or removing the guard would weaken protection against the independently documented exhaustion incident.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning medium; reviewed against d46027380a18.
Label changes
Label changes:
No label changes.
Label justifications:
P0: The reported fresh-onboarding path cannot complete its first useful turn, and retrying cannot correct the runtime's memory reading.impact:ux-release-blocker: A first-time macOS app user receives a false low-memory error without an effective in-product recovery path.Evidence reviewed
What I checked:
src/infra/host-memory.ts:12, d46027380a18)src/agents/cli-runner/cli-live-session-registry.ts:217, d46027380a18)scripts/lib/openclaw-bun.json:3, d46027380a18)src/jsc/bindings/BunProcess.cpp:3673, 191755ec115e)src/jsc/bindings/OsBinding.cpp:20, 191755ec115e)src/agents/cli-runner/execute-plugin.test.ts:33, d46027380a18)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 explainto ask for more context, or@clawsweeper stopto stop active automation.Reviewed November 16, 2026, 8:26 PM ET / November 17, 2026, 01:26 UTC.
orinkepler commentedon Nov 21, 2026
This still reproduces on the latest stable release, v2026.11.6 (macOS app, packaged Bun gateway,
claude-cli/claude-opus-5-5), with the samecli_live_session_host_memoryfailure on every turn.It looks like the fix in #200373 was merged to
mainbut hasn't been picked into any release yet.src/infra/host-memory.tsat bothv2026.11.6andv2026.11.10-beta.1still callsprocess.availableMemory()directly inreadHostFreeMemoryBytes(), and the merge commit 71d835b isn't an ancestor of either tag.Numbers from a 24 GB Mac mini at the time of failure:
memory_pressure: 84% freeprocess.availableMemory(): ~0.12 GB → trips the 1 GiB guardhost_statistics(the fix: let the macOS app answer the first chat instead of reporting low memory #200373 approach): ~11.8 GBBackporting the #200373
host-memory.tschange onto the v2026.11.6 dist resolved it locally. Could this be reopened, or the fix cherry-picked into the next stable/beta?towler73 commentedon Nov 24, 2026
Confirmed this still affects the packaged 2026.11.6 (da6d981) macOS Gateway with Bun 1.4.4, using Claude Sonnet 4.6.
The new-live-session guard repeatedly rejects turns with
cli_live_session_host_memoryand classifies them asrate_limit/ 429, causing configured model fallback.Reproduction measurements on a 48 GiB Mac:
process.availableMemory()matchedos.freemem(): approximately 400–500 MiB.readHostFreeMemoryBytes()returned approximately 403 MiB, below the unchanged 1 GiB admission threshold.Locally backported the
src/infra/host-memory.tsimplementation from 71d835b / #200373, transpiled with the bundled Bun and preserving the installed module export aliases. No guard threshold or model configuration changes.Verification:
openclaw agent exec --model anthropic/claude-sonnet-4-6run starts a Claude CLI live session and returns the expected smoke-test response; result identifies Anthropic / Claude Sonnet 4.6, not the fallback model.The running service restart was deferred until active work drains; the successful end-to-end smoke test used a new embedded process loading the patched module.
Please include this fix in a supported stable release/backport. This corroborates the existing report that the source fix has not reached the 2026.11.6 packaged release. Local dist patches are overwritten by runtime updates.