openclaw - 💡(How to fix) Fix Bug: Control UI 聊天记录在 session 重启后丢失 [4 comments, 3 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#44491Fetched 2026-04-08 00:46:10
View on GitHub
Comments
4
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×4
RAW_BUFFERClick to expand / collapse

问题描述

Bug 1: Control UI 聊天记录在 session 重启后丢失

  • 旧 session 的聊天文件都保存在 ~/.openclaw/agents/main/sessions/*.jsonl
  • 但 Control UI 在 gateway 重启或心跳检测后,会清空对话框内容
  • 即使 session 文件完好,UI 也无法显示历史对话

Bug 2: Dashboard 界面语言不一致

  • 左侧边栏显示中文
  • 但点击各项进入后,内容全部是英文(如 Settings, Sessions 等页面)
  • HTML 使用 lang="en",没有跟随系统语言

Bug 3: Session 标签显示为 "heartbeat"

  • gateway 重启后,session 的标签被错误显示为 "heartbeat"
  • 应该显示为实际的连接来源(如 webchat, control-ui 等)

期望行为

  • gateway 重启或心跳检测后,应该保留/恢复之前的聊天记录
  • Dashboard UI 应该保持语言一致,跟随系统语言或用户设置
  • Session 标签应该正确显示连接来源

环境

  • OpenClaw: 2026.3.11
  • macOS: 26.3.1 (Darwin 25.3.0 arm64)
  • Channel: webchat

复现步骤

Bug 1

  1. 通过 Control UI 与 agent 对话
  2. 重启 gateway: openclaw gateway restart
  3. 观察对话框内容被清空

Bug 2

  1. 打开 Dashboard http://127.0.0.1:18789/
  2. 观察左侧边栏是中文
  3. 点击任意菜单项(如 Sessions, Settings)
  4. 观察内容区变成英文

Bug 3

  1. 打开 Dashboard
  2. 查看 Sessions 列表
  3. 观察 session 标签显示为 "heartbeat" 而不是 "webchat"

附加信息

  • Session 文件实际完好保存在 ~/.openclaw/agents/main/sessions/
  • 可以通过 openclaw sessions 看到历史 session 记录

extent analysis

Fix Plan

To address the issues, we'll focus on the following steps:

Bug 1: Preserve Chat History

  1. Modify the gateway restart script to reload session data from ~/.openclaw/agents/main/sessions/*.jsonl after restart.
  2. Update the Control UI to fetch and display historical chat data from the session files.

Example code snippet to load session data:

import json
import os

def load_session_data(session_dir):
    session_data = []
    for file in os.listdir(session_dir):
        if file.endswith('.jsonl'):
            with open(os.path.join(session_dir, file), 'r') as f:
                for line in f:
                    session_data.append(json.loads(line))
    return session_data

Bug 2: Language Consistency

  1. Set the HTML lang attribute to follow the system language or user setting.
  2. Update the Dashboard UI to use the same language for all content.

Example code snippet to set the lang attribute:

<html lang="{{ user_language }}">

Bug 3: Correct Session Label

  1. Update the session label to display the actual connection source (e.g., webchat, control-ui).
  2. Modify the gateway to store and retrieve the correct session label.

Example code snippet to update the session label:

def get_session_label(session):
    # Retrieve the connection source from the session data
    connection_source = session.get('connection_source')
    return connection_source if connection_source else 'Unknown'

Verification

  1. Restart the gateway and verify that the chat history is preserved.
  2. Check the Dashboard UI for language consistency.
  3. Verify that the session labels are correctly displayed.

Extra Tips

  • Ensure that the session files are properly backed up and stored.
  • Consider implementing a more robust session management system to handle gateway restarts and heartbeats.
  • Use a consistent language throughout the Dashboard UI to improve user experience.

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

openclaw - 💡(How to fix) Fix Bug: Control UI 聊天记录在 session 重启后丢失 [4 comments, 3 participants]