问题描述

我在使用 openclaw 时,本来用的好好的,突然发现无论在浏览器还是在 tui 里,输入/reset或者/new命令来新建会话时,都会出现异常。以浏览器为例,具体表现为:新建会话时,前面突然加了一堆系统提示:

System: [2026-04-21 00:12:25 GMT+8] Exec completed (calm-she, code 0) :: exec-1 done-1
System: [2026-04-21 00:12:27 GMT+8] Exec completed (warm-cru, code 0) :: exec-2 done-2
System: [2026-04-21 00:12:34 GMT+8] [Post-compaction context refresh]
System:
System: Session was just compacted. The conversation summary above is a hint, NOT a substitute for your startup sequence. Execute your Session Startup sequence now — read the required files before responding to the user.
System:
System: Critical rules from AGENTS.md:
System:
System: ## Session Startup
System:
System: Before doing anything else:
System:
System: 1. Read SOUL.md — this is who you are
System: 2. Read USER.md — this is who you're helping
System: 3. Read memory/2026-04-21.md (today + yesterday) for recent context
System: 4. If in MAIN SESSION (direct chat with your human): Also read MEMORY.md
System:
System: Don't ask permission. Just do it.
System:
System: ## Red Lines
System:
System: - Don't exfiltrate private data. Ever.
System: - Don't run destructive commands without asking.
System: - trash > rm (recoverable beats gone forever)
System: - When in doubt, ask.
System:
System: Current time: Tuesday, April 21st, 2026 — 12:12 AM (Asia/Shanghai) / 2026-04-20 16:12 UTC

A new session was started via /new or /reset. Execute your Session Startup sequence now - read the required files before responding to the user. Then greet the user in your configured persona, if one is provided. Be yourself - use your defined voice, mannerisms, and mood. Keep it to 1-3 sentences and ask what they want to do. If the runtime model differs from default_model in the system prompt, mention the default model. Do not mention internal steps, files, tools, or reasoning.
Current time: Tuesday, April 21st, 2026 — 12:16 AM (Asia/Shanghai) / 2026-04-20 16:16 UTC

此时继续对话,比如我发一个 hello,发送出去的消息会被自动加上系统提示的内容,变成:


System: [2026-04-21 00:11:31 GMT+8] [Post-compaction context refresh]
System:
System: Session was just compacted. The conversation summary above is a hint, NOT a substitute for your startup sequence. Execute your Session Startup sequence now — read the required files before responding to the user.
System:
System: Critical rules from AGENTS.md:
System:
System: ## Session Startup
System:
System: Before doing anything else:
System:
System: 1. Read SOUL.md — this is who you are
System: 2. Read USER.md — this is who you're helping
System: 3. Read memory/2026-04-21.md (today + yesterday) for recent context
System: 4. If in MAIN SESSION (direct chat with your human): Also read MEMORY.md
System:
System: Don't ask permission. Just do it.
System:
System: ## Red Lines
System:
System: - Don't exfiltrate private data. Ever.
System: - Don't run destructive commands without asking.
System: - trash > rm (recoverable beats gone forever)
System: - When in doubt, ask.
System:
System: Current time: Tuesday, April 21st, 2026 — 12:11 AM (Asia/Shanghai) / 2026-04-20 16:11 UTC

[Tue 2026-04-21 00:11 GMT+8] hello

这些提示导致每次都会调用工具去读取文件,有时甚至会直接忽略我发的内容。

而正常的对话虽然也会加一点前缀,但并不是上面这样的:

{"type":"message","id":"b2f4300d","parentId":"d45d8da2","timestamp":"2026-03-16T11:23:53.797Z","message":{"role":"user","content":[{"type":"text","text":"Sender (untrusted metadata):\n```json\n{\n  \"label\": \"openclaw-tui (gateway-client)\",\n  \"id\": \"gateway-client\",\n  \"name\": \"openclaw-tui\",\n  \"username\": \"openclaw-tui\"\n}\n```\n\n[Mon 2026-03-16 19:23 GMT+8] 你好"}],"timestamp":1773660233795}}

格式整理一下就是:

Sender (untrusted metadata):
```json
{
  "label": "openclaw-tui (gateway-client)",
  "id": "gateway-client",
  "name": "openclaw-tui",
   "username": "openclaw-tui"
}
```
[Mon 2026-03-16 19:23 GMT+8] 你好

解决方案

目前没有找到问题所在,即使删除工作空间的所有内容,或者重启 openclaw 之后,问题依然存在。

但是在某些情况下会短暂的恢复正常。比如新建的 session 里开头不会有这个问题:

openclaw tui --session agent:gpt:test

但继续对话之后又会出现这个问题。

以及明确告知它”你叫XXX”时,它会恢复正常一下,但继续对话之后又会出现这个问题。

openclaw gateway restart无法解决问题。

最后尝试了一种方式:

openclaw gateway stop
openclaw gateway uninstall
openclaw gateway install
openclaw gateway start

执行完之后问题就解决了。不过目前无法确定是等了一段时间自行恢复了,还是卸载重装之后就解决了。