Skip to content

Regression in 2026.5.3-1: CLI transcript persistence fails with "Context engine 'legacy' is not registered" #77531

Closed

Description

@nikolaykazakovvs-ux

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 on gateway 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_send path works).
  • But the per-turn transcript that sessions_history exposes can become incomplete — assistant tool-use traces are dropped from the file under ~/.openclaw/agents/main/sessions/<id>.jsonl, while the sessions.json index 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

Reproduction

  1. Install OpenClaw 2026.5.3-1 globally.
  2. Configure a single agent (main) using the claude-cli runtime, no Anthropic API plugin.
  3. Start the gateway as a systemd user service.
  4. Send any user message into agent:main:main. Let the assistant produce a tool-using reply.
  5. Tail the gateway log — the warning appears on every assistant turn.
  6. Diff the file under ~/.openclaw/agents/main/sessions/<id>.jsonl against what the assistant actually emitted in the chat: tool calls and intermediate assistant text are missing.

Impact

  • Operator-facing: post-mortems and sessions_history summaries 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 from media/outbound mtimes 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_history may 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.

Activity

  1. clawsweeper commented on May 4, 2026

    @clawsweeper
    Contributor

    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 legacy context engine without first initializing built-in engines, while the repaired sessions_spawn path explicitly initializes before resolving.

    Reproducibility: yes. at source level: a CLI turn with sessionFile and contextTokens enters runCliTurnCompactionLifecycle, then calls resolveContextEngine without the initializer that registers legacy. 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 legacy engine is resolved before initialization.

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

    Yes, at source level: a CLI turn with sessionFile and contextTokens enters runCliTurnCompactionLifecycle, then calls resolveContextEngine without the initializer that registers legacy. 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:

    • pnpm test src/agents/command/cli-compaction.test.ts src/agents/subagent-spawn.context.test.ts
    • pnpm exec oxfmt --check --threads=1 src/agents/command/cli-compaction.ts src/agents/command/cli-compaction.test.ts CHANGELOG.md
    • pnpm check:changed

    What I checked:

    Likely related people:

    • Josh Lehman: Commit fee91fefce introduced 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)
    • Pavan Kumar Gondhi: Current-main blame in this checkout attributes the CLI compaction module, context-engine init/registry files, and the subagent initialization regression test to 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)
    • Ayaan Zaidi: The CLI transcript persistence feature and immediate follow-ups appear in commits b8ef507cc0, 898fd0482a, and 3a3fae0eac. (role: CLI transcript persistence history; confidence: high; commits: b8ef507cc082, 898fd0482a40, 3a3fae0eac0f; files: src/agents/command/attempt-execution.ts, src/agents/agent-command.ts)
    • Mert Başar: Recent current-main history shows c240e718e9 touching 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:

    • I did not run a live claude-cli/systemd gateway reproduction, so the verdict is based on the reporter's concrete logs plus source-level reproduction of the missing initialization path.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against 29a3e71106ac.

  2. nikolaykazakovvs-ux commented on May 4, 2026

    @nikolaykazakovvs-ux
    Author

    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.

  3. locked as resolved and limited conversation to collaborators on May 7, 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

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions