openclaw - 💡(How to fix) Fix [Bug]: raw external session keys can still split after sessions_send / nested agent canonicalization [1 pull requests]

Official PRs (…)
ON THIS PAGE

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…

This is a refreshed report for #63005. I am closing the old issue only because it has gone stale in triage; the underlying raw-key versus canonical-key session continuity problem still appears unresolved on current main.

Stable external session keys that do not start with agent-prefixed namespaces like agent: can split one logical conversation into multiple OpenClaw session records after internal sessions_send / nested agent activity touches the same logical conversation.

Root Cause

This is a refreshed report for #63005. I am closing the old issue only because it has gone stale in triage; the underlying raw-key versus canonical-key session continuity problem still appears unresolved on current main.

Fix Action

Fixed

Code Example

conversation:pair:user_a::user_b:space:space_123
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

This is a refreshed report for #63005. I am closing the old issue only because it has gone stale in triage; the underlying raw-key versus canonical-key session continuity problem still appears unresolved on current main.

Stable external session keys that do not start with agent-prefixed namespaces like agent: can split one logical conversation into multiple OpenClaw session records after internal sessions_send / nested agent activity touches the same logical conversation.

Current main status

Checked against current main at 7fbca96 on 2026-05-26.

The old issue still matches the current source shape:

  • Explicit inbound SessionKey values can remain raw in the reply/session path.
  • Gateway session-store resolution canonicalizes non-agent, non-main, non-global raw keys into agent-scoped keys.
  • Gateway migration can promote the canonical key and prune noncanonical candidates.
  • Later inbound traffic with the same explicit raw key can miss the pruned raw entry and create a new session record.

Steps to reproduce

  1. Configure an external integration that delivers inbound messages into OpenClaw using a stable raw session key that does not start with agent:.

Example shape:

conversation:pair:user_a::user_b:space:space_123
  1. Let inbound traffic create and continue a normal session under that raw key.
  2. During that conversation, trigger internal sessions_send behavior that causes nested agent activity to touch the same logical conversation.
  3. Send another normal inbound message for the same raw external session key.
  4. Inspect sessions.json, transcript files, and session continuity.

Expected behavior

A raw external session key with an existing active session entry should continue to resolve to the same logical OpenClaw session.

Internal sessions_send / nested agent activity should not cause the next inbound message on that same external key to start a fresh sessionId unless a real reset or freshness rollover happened.

Actual behavior

One logical conversation can be split into multiple session records and transcript files without a true reset boundary.

Observed shape:

  • transcript A continues normally under a session created from raw external inbound
  • internal nested agent / sessions_send activity touches the same conversation
  • later inbound on the same raw key starts transcript B with a new sessionId
  • transcript A is not archived as reset history
  • sessions.json now reflects a new raw-key entry, while the internal canonicalized key may already exist separately

Prior evidence and discussion carried forward

Old issue: #63005

Prior ClawSweeper review kept #63005 open and summarized the source repro as: seed a store row under a structured raw key, let a gateway path resolve and prune that key through canonicalization, then send another inbound turn with the same explicit raw SessionKey; current main can miss the pruned raw entry.

Important design point from the old review: a shared raw-alias lookup and synchronization contract in gateway/session-store code is the narrow maintainable fix. Closing the old issue before the linked PR landed risked hiding the active implementation path; this refreshed issue carries that context forward.

Related people mentioned by the old review included stainlu, steipete, Takhoffman, pgondhi987, and thomasxm; this is context, not an ownership assignment.

Related PRs and issues

  • #83368 (fix(gateway): preserve raw external session aliases) is the active implementation path.
  • As of this refresh, #83368 is still open and has failing build/type/lint/extension lanes, so it needs rebase/fix/review before this can close.
  • The original report noted this is related to, but broader than, #49202.

Impact and severity

Affected: external integrations that rely on stable structured session or conversation keys.

Severity: High.

Frequency: Intermittent, but reproducible when internal sessions_send / nested agent activity touches the same logical conversation.

Consequence: one logical conversation can be split across multiple sessionIds and transcript files, breaking history continuity and making session behavior difficult to reason about.

Suggested fix direction

Make raw-key handling consistent across inbound/session-init and gateway canonicalization paths, or preserve raw external aliases that future inbound traffic still depends on.

The fix should avoid treating structured external keys as disposable legacy aliases when those keys remain the integration's stable inbound addressing contract.

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

A raw external session key with an existing active session entry should continue to resolve to the same logical OpenClaw session.

Internal sessions_send / nested agent activity should not cause the next inbound message on that same external key to start a fresh sessionId unless a real reset or freshness rollover happened.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: raw external session keys can still split after sessions_send / nested agent canonicalization [1 pull requests]