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:
Peter Steinberger
2026-04-24 22:17:03 +01:00
committed by GitHub
parent b20208fa4c
commit 6e985a421d
23 changed files with 341 additions and 9 deletions

View File

@@ -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: