Skip to content

[Bug]: Control UI webchat routes user input into :heartbeat-suffixed session when main session is pruned #75203

Description

@JakeSc

Summary

When aggressive session pruning removes agent:main:main from sessions, the Control UI session picker no longer shows the primary session. Heartbeat ticks keep agent:main:main:heartbeat alive, so that becomes the only visible session in the picker. The webchat input then routes user messages directly into the heartbeat-suffixed session — resulting in human↔AI conversation accumulating in a background session rather than the intended main session.

When the next heartbeat tick fires, the Control UI swaps to a newer heartbeat sessionId, effectively clobbering the conversation view mid-chat.

Steps to Reproduce

  1. Configure session maintenance with aggressive pruning:
    maintenance: { mode: "enforce", pruneAfter: "3d", maxEntries: 50 }
  2. Configure heartbeat with isolatedSession: true, model: "anthropic/claude-haiku-4-5", lightContext: true, target unset (defaults to "none").
  3. Wait for daily session reset (or trigger prune) — agent:main:main gets pruned from sessions.json.
  4. Heartbeat ticks continue to run, keeping agent:main:main:heartbeat alive.
  5. Open Control UI webchat. Observe session picker.
  6. Type a user message in the chat input.

Expected Behavior

  • The session picker should always surface agent:main:main (or auto-create it if missing/pruned).
  • Webchat input should be bound to the primary (main:main) session by default.
  • Heartbeat-suffixed sessions (:heartbeat) should be hidden from the picker, or clearly labeled as "background" / read-only, so users cannot accidentally route input into them.

Actual Behavior

  • Session picker only showed main:heartbeat (no main:main).
  • User typed messages; webchat routed input into agent:main:main:heartbeat.
  • Hours of human↔AI conversation accumulated in the heartbeat session.
  • On the next heartbeat tick, Control UI swapped to a newer heartbeat sessionId, appearing to clobber the conversation view.

Environment

  • OpenClaw version: 2026.4.27 (cbc2ba0)
  • Channel: webchat (Control UI)
  • Heartbeat config: every: "1h", model: "anthropic/claude-haiku-4-5", lightContext: true, isolatedSession: true, target not set
  • Session maintenance config (at time of issue): mode: "enforce", pruneAfter: "3d", maxEntries: 50

Workaround

Relax session pruning so agent:main:main is never pruned (e.g., increase pruneAfter / maxEntries, or exempt the primary session from pruning rules).

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions