mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 12:00:44 +00:00
fix(webchat): keep runtime context out of visible transcripts
Keep WebChat runtime context available to the model while persisting only the transcript-facing user prompt across gateway, CLI, queued follow-up, and embedded Pi paths. Adds regression coverage for history sanitization, CLI transcript persistence, media-only auto-reply prompts, and embedded Pi prompt rewrite against a real SessionManager file. Co-authored-by: 91wan <91wan@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b20208fa4c
commit
6e985a421d
@@ -16,6 +16,7 @@ file is backed up alongside the session file.
|
||||
|
||||
Scope includes:
|
||||
|
||||
- Runtime-only prompt context staying out of user-visible transcript turns
|
||||
- Tool call id sanitization
|
||||
- Tool call input validation
|
||||
- Tool result pairing repair
|
||||
@@ -30,6 +31,20 @@ If you need transcript storage details, see:
|
||||
|
||||
---
|
||||
|
||||
## Global rule: runtime context is not user transcript
|
||||
|
||||
Runtime/system context can be added to the model prompt for a turn, but it is
|
||||
not end-user-authored content. OpenClaw keeps a separate transcript-facing
|
||||
prompt body for Gateway replies, queued followups, ACP, CLI, and embedded Pi
|
||||
runs. Stored visible user turns use that transcript body instead of the
|
||||
runtime-enriched prompt.
|
||||
|
||||
For legacy sessions that already persisted runtime wrappers, Gateway history
|
||||
surfaces apply a display projection before returning messages to WebChat,
|
||||
TUI, REST, or SSE clients.
|
||||
|
||||
---
|
||||
|
||||
## Where this runs
|
||||
|
||||
All transcript hygiene is centralized in the embedded runner:
|
||||
|
||||
@@ -24,7 +24,8 @@ Status: the macOS/iOS SwiftUI chat UI talks directly to the Gateway WebSocket.
|
||||
|
||||
- The UI connects to the Gateway WebSocket and uses `chat.history`, `chat.send`, and `chat.inject`.
|
||||
- `chat.history` is bounded for stability: Gateway may truncate long text fields, omit heavy metadata, and replace oversized entries with `[chat.history omitted: message too large]`.
|
||||
- `chat.history` is also display-normalized: inline delivery directive tags
|
||||
- `chat.history` is also display-normalized: runtime-only OpenClaw context,
|
||||
inbound envelope wrappers, inline delivery directive tags
|
||||
such as `[[reply_to_*]]` and `[[audio_as_voice]]`, plain-text tool-call XML
|
||||
payloads (including `<tool_call>...</tool_call>`,
|
||||
`<function_call>...</function_call>`, `<tool_calls>...</tool_calls>`,
|
||||
|
||||
Reference in New Issue
Block a user