openclaw - 💡(How to fix) Fix /new and /reset slash commands rotate openclaw session but do not archive the LCM conversation [1 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#75227Fetched 2026-05-01 05:36:39
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
closed ×1commented ×1

/new (and /reset) on Discord and Telegram channels rotates the openclaw session JSONL but does not archive the underlying LCM conversation. The same conversation_id keeps absorbing across "fresh" sessions, accumulating thousands of messages over hours/days. From a user perspective, "reset" doesn't actually reset — the next message inherits all prior LCM context, leading to context anchoring on stale topics, slow turns from huge cached prefixes, and eventually safeguard-triggered context-limit resets.

Root Cause

In one of our channels (agent:main:discord:channel:1485749137319268487), the user issued /new four times today (2026-04-30). After each /new, openclaw rotated the session file and updated sessions.json correctly. But the LCM conversations.conversation_id=239 stayed active=1 the whole time and grew from a few hundred messages → 17,886 messages over 22 hours, because each new openclaw session was just updating the session_id pointer on the same conv row.

Code Example

UPDATE conversations
SET active = 0,
    archived_at = datetime('now'),
    session_key = session_key || ':archived:' || strftime('%Y%m%d%H%M%S','now')
WHERE session_key = ? AND active = 1;
RAW_BUFFERClick to expand / collapse

Summary

/new (and /reset) on Discord and Telegram channels rotates the openclaw session JSONL but does not archive the underlying LCM conversation. The same conversation_id keeps absorbing across "fresh" sessions, accumulating thousands of messages over hours/days. From a user perspective, "reset" doesn't actually reset — the next message inherits all prior LCM context, leading to context anchoring on stale topics, slow turns from huge cached prefixes, and eventually safeguard-triggered context-limit resets.

Concrete repro / evidence

In one of our channels (agent:main:discord:channel:1485749137319268487), the user issued /new four times today (2026-04-30). After each /new, openclaw rotated the session file and updated sessions.json correctly. But the LCM conversations.conversation_id=239 stayed active=1 the whole time and grew from a few hundred messages → 17,886 messages over 22 hours, because each new openclaw session was just updating the session_id pointer on the same conv row.

Effects users see:

  • After /new, the bot still references topics from hours ago (LCM injects summarized context from the old conv into every new "fresh" prompt)
  • Eventually hits the safeguard reset: "Context limit exceeded. I've reset our conversation"
  • Per-turn cost balloons because LCM is injecting 70k-100k cached tokens of stale summaries

Why this is the load-bearing fix

The standard recovery recipe documented in our runbook is now a multi-step manual SQL update + file move + sessions.json edit:

  1. UPDATE conversations SET active=0, archived_at=datetime('now'), session_key=session_key||':archived:'||strftime('%Y%m%d%H%M%S','now') WHERE conversation_id=N
  2. Move <sid>.jsonl + .trajectory.jsonl + .trajectory-path.json aside
  3. Edit sessions.json to delete sessionId / sessionFile for the channel's session_key

Step 1 (the SQL update) is the one that actually severs the LCM continuity. Steps 2-3 alone (which is what /new already does) leave LCM unchanged.

We've documented this and built a script (lcm-reset.sh) to do all three steps, but the right place for it is in /new itself — when a user explicitly asks to start fresh, they expect a true reset, not a session-file rotation.

Suggested fix

In the discord/telegram slash-command handler for /new (and /reset), after rotating the session JSONL, also:

UPDATE conversations
SET active = 0,
    archived_at = datetime('now'),
    session_key = session_key || ':archived:' || strftime('%Y%m%d%H%M%S','now')
WHERE session_key = ? AND active = 1;

The session_key uniquification is necessary to satisfy the existing unique index conversations_active_session_key_idx.

Archived LCM data remains fully searchable via lcm_grep, lcm_describe, lcm_expand_query with allowCrossConversation: true or explicit conversationId, so this is non-destructive — the bot can still recall prior context on demand even after reset.

Optional follow-on: keep current behavior available

If existing behavior is intentional for some users (rotate session but preserve LCM continuity), expose the new behavior as /new --hard or /reset --hard and keep /new rotating-only. Or wire it via a config flag at agents.defaults.commands.newResetsLcm: true.

Either way: the current default of "rotate session but silently leave LCM unchanged" is surprising and produces the symptoms above repeatedly.

Related

  • We confirmed /lossless rotate is a deliberate "compact transcript while preserving LCM continuity" — that pattern has its place. The complaint is that /new and /reset advertise "fresh start" semantics but currently behave more like /lossless rotate from the user's perspective.
  • The runbook entry "LCM survives openclaw session rotation" in [openclaw-meridian-loop-runbook.md] documents this discovery and the manual fix recipe that this issue would automate.

Environment

  • openclaw 2026.4.26 (be8c246)
  • Affects discord + telegram slash commands
  • Reproduces with any channel session that has accumulated LCM history

extent analysis

TL;DR

Update the /new and /reset slash-command handlers to execute an SQL query that archives the underlying LCM conversation by setting active to 0 and updating the session_key to include an archive timestamp.

Guidance

  • Identify the SQL query that needs to be executed after rotating the session JSONL in the /new and /reset handlers: UPDATE conversations SET active = 0, archived_at = datetime('now'), session_key = session_key || ':archived:' || strftime('%Y%m%d%H%M%S','now') WHERE session_key = ? AND active = 1;
  • Verify that the session_key uniquification is necessary to satisfy the existing unique index conversations_active_session_key_idx.
  • Consider adding an optional flag or config setting to preserve the current behavior of rotating the session but preserving LCM continuity, e.g., /new --hard or agents.defaults.commands.newResetsLcm: true.
  • Test the updated handlers to ensure that the LCM conversation is properly archived and the user's experience is improved.

Example

UPDATE conversations
SET active = 0,
    archived_at = datetime('now'),
    session_key = session_key || ':archived:' || strftime('%Y%m%d%H%M%S','now')
WHERE session_key = ? AND active = 1;

This SQL query archives the LCM conversation by setting active to 0, updating the archived_at timestamp, and appending an archive timestamp to the session_key.

Notes

The suggested fix assumes that the SQL query is executed correctly and that the session_key uniquification is sufficient to satisfy the unique index constraint. Additionally, the fix may require modifications to the runbook entry "LCM survives openclaw session rotation" in [openclaw-meridian-loop-runbook.md] to reflect the automated solution.

Recommendation

Apply the workaround by

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING