Repository navigation
Description
Summary
After upgrading to 2026.5.3-1, the CLI transcript persistence path again throws
CLI transcript persistence failed ... Context engine "legacy" is not registered
This was previously reported and fixed under #75546 (closed 2026-05-01) and the related /subagents regression #74865. The same symptom resurfaced on a freshly-running gateway today (2026-05-04) on this version, so it looks like a regression — or at minimum the fix from #75546 does not cover the CLI claude-cli runtime path that this deployment uses.
Environment
- OpenClaw:
2026.5.3-1 - Node:
v22.22.1, npm:10.9.4 - OS: Ubuntu (Linux 6.8), systemd user service
openclaw-gateway.service - Runtime: claude-cli OAuth (Anthropic API provider explicitly disabled)
- Gateway:
pid 982659,state=active, healthy ongateway status
Symptom
Whenever an assistant turn completes inside the agent:main:main session and OpenClaw tries to persist the CLI-side transcript line, the gateway emits:
CLI transcript persistence failed ... Context engine "legacy" is not registered
Functionally:
- The CLI session keeps running (Telegram messages are still sent and the inter-session
sessions_sendpath works). - But the per-turn transcript that
sessions_historyexposes can become incomplete — assistant tool-use traces are dropped from the file under~/.openclaw/agents/main/sessions/<id>.jsonl, while thesessions.jsonindex still advances. This makes post-mortem of pipeline failures (the kind that motivated Image tool: opaque "Failed to optimize image" when sharp is not installed #73148) much harder, because the agent's own action log isn't there.
Why this looks like a regression vs. #75546
- CLI transcript persistence fails with "Context engine \"legacy\" is not registered" #75546 was closed 2026-05-01 with the registration path fixed for the
sessions_spawn//subagentsflow. - The transcript-write path used by the main session's claude-cli adapter still goes through a code path that asks for the
"legacy"engine by name. In 2026.5.3-1 that lookup returnsnot registered, even thoughsessions_spawnworks. - So the registration fix from CLI transcript persistence fails with "Context engine \"legacy\" is not registered" #75546 didn't reach
appendAssistantMessageToSessionTranscript(or its CLI-runtime equivalent).
Reproduction
- Install OpenClaw
2026.5.3-1globally. - Configure a single agent (
main) using the claude-cli runtime, no Anthropic API plugin. - Start the gateway as a systemd user service.
- Send any user message into
agent:main:main. Let the assistant produce a tool-using reply. - Tail the gateway log — the warning appears on every assistant turn.
- Diff the file under
~/.openclaw/agents/main/sessions/<id>.jsonlagainst what the assistant actually emitted in the chat: tool calls and intermediate assistant text are missing.
Impact
- Operator-facing: post-mortems and
sessions_historysummaries omit the agent's action log, which makes incidents like Image tool: opaque "Failed to optimize image" when sharp is not installed #73148 (a missing native dep) noticeably harder to diagnose. Today I had to reconstruct what a sub-agent did frommedia/outboundmtimes and the social-director's own session file because main's CLI transcript was sparse. - Inter-agent: anything that relies on a downstream agent reading back a recent main-session decision via
sessions_historymay see stale or partial state.
Suggested next step
Either reopen #75546 with a note that the CLI runtime path was missed, or treat this as a fresh regression and add a legacy-engine-registered check to the gateway boot path (and ideally to openclaw doctor).
Happy to attach a redacted log snippet on request.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon May 4, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve.
Summary
Keep open: this looks like a valid fresh regression, not a duplicate close of the earlier subagent fix. Current main has a CLI compaction path that resolves the default
legacycontext engine without first initializing built-in engines, while the repairedsessions_spawnpath explicitly initializes before resolving.Reproducibility: yes. at source level: a CLI turn with
sessionFileandcontextTokensentersrunCliTurnCompactionLifecycle, then callsresolveContextEnginewithout the initializer that registerslegacy. I did not perform the live claude-cli gateway run, so this is not marked as fully reproduced.Next step
This is a narrow regression with clear owner files and an existing fixed pattern to copy from the subagent path.
Review details
Best possible solution:
Mirror the subagent fix in the CLI compaction lifecycle by initializing built-in context engines before resolving the context engine, then add a regression test that fails if the default
legacyengine is resolved before initialization.Do we have a high-confidence way to reproduce the issue?
Yes, at source level: a CLI turn with
sessionFileandcontextTokensentersrunCliTurnCompactionLifecycle, then callsresolveContextEnginewithout the initializer that registerslegacy. I did not perform the live claude-cli gateway run, so this is not marked as fully reproduced.Is this the best way to solve the issue?
Yes: the narrow maintainable fix is to call the existing context-engine initialization guard in the CLI compaction path and cover that ordering in
cli-compaction.test.ts. A doctor check may be useful later, but it is not needed to fix the runtime regression.Acceptance criteria:
What I checked:
2026.5.3-1claude-cli/systemd reproduction and explicitly distinguishes this path from the earlier closedsessions_spawnreports CLI transcript persistence fails with "Context engine \"legacy\" is not registered" #75546 and [Bug]: Regression: /subagents spawn fails (legacy context engine not initialized) #74865.runCliTurnCompactionLifecyclecallsresolveContextEnginedirectly after checkingsessionFileandcontextTokens; there is noensureContextEnginesInitialized()call in this module. (src/agents/command/cli-compaction.ts:199, 29a3e71106ac)Context engine "<id>" is not registeredwhen the default slot is missing, and the built-in initializer is the code that registers the legacy engine. (src/context-engine/registry.ts:521, 29a3e71106ac)ensureContextEnginesInitialized()beforeresolveContextEngine, and its regression test covers the exactlegacy is not registeredordering failure. (src/agents/subagent-spawn.ts:445, 29a3e71106ac)resolveContextEngine, so it proves compaction behavior but not the default registry initialization path that failed in production. (src/agents/command/cli-compaction.test.ts:113, 29a3e71106ac)fee91fefce; current-main blame attributes the CLI compaction/context-engine files and subagent regression test to37c0520a0b; CLI transcript persistence dates tob8ef507cc0with follow-up commits898fd0482aand3a3fae0eac. (src/agents/command/cli-compaction.ts:1, 37c0520a0b9c)Likely related people:
fee91fefceintroduced the ContextEngine registry, legacy engine, initialization guard, and context-engine lifecycle integration. (role: introduced context-engine architecture; confidence: high; commits: fee91fefceb4; files:src/context-engine/registry.ts,src/context-engine/init.ts,src/context-engine/legacy.ts)37c0520a0b. (role: recent current-main maintainer; confidence: medium; commits: 37c0520a0b9c; files:src/agents/command/cli-compaction.ts,src/context-engine/init.ts,src/context-engine/registry.ts)b8ef507cc0,898fd0482a, and3a3fae0eac. (role: CLI transcript persistence history; confidence: high; commits: b8ef507cc082, 898fd0482a40, 3a3fae0eac0f; files:src/agents/command/attempt-execution.ts,src/agents/agent-command.ts)c240e718e9touching the main-session durable delivery/agent-command area adjacent to the warning and persistence path. (role: recent adjacent maintainer; confidence: medium; commits: c240e718e91e; files:src/agents/agent-command.ts,src/agents/command/attempt-execution.ts)Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 29a3e71106ac.
nikolaykazakovvs-ux commentedon May 4, 2026
Closing — opened prematurely without diff against 2026.5.3-1 release artefacts vs. the fix in #75546. The local symptom may well be my own workflow / config rather than a true regression. Will reopen only after I confirm the fix commit shipped in 5.3-1 and the CLI-runtime path still bypasses it.