Skip to content

fix: strip XML wrapper from replayed user messages#150

Merged
tellaho merged 5 commits intomainfrom
fix/strip-xml-replay-user-message
Apr 10, 2026
Merged

fix: strip XML wrapper from replayed user messages#150
tellaho merged 5 commits intomainfrom
fix/strip-xml-replay-user-message

Conversation

@tellaho
Copy link
Copy Markdown
Collaborator

@tellaho tellaho commented Apr 10, 2026

Category: fix
User Impact: Reloading a previous chat session no longer shows raw XML markup in the user's message bubble.

Problem: When a session is replayed (e.g. clicking a chat in session history), the user message bubble renders raw XML tags like <persona-instructions>, <project-settings>, and <user-message> instead of showing just the user's input. This happens because the Tauri backend wraps the user's prompt with XML context before sending it to the goose binary, which stores the full wrapped string. On replay, that string is emitted to the frontend as-is.

Solution: Add an extract_user_message() helper in the dispatcher replay path that parses out just the <user-message> content before emitting it to the frontend. Falls back to the full string for messages that aren't wrapped (backward compat).

Screenshot 2026-04-10 at 10 36 46 AM
File changes

src-tauri/src/services/acp/manager/dispatcher.rs
Added extract_user_message() to extract the inner content from <user-message> XML tags. Applied it in the UserMessageChunk replay path so only the user's actual input is sent to the frontend. Added three unit tests covering: wrapped messages with persona instructions, multiline content, and plain unwrapped messages.

Reproduction Steps

  1. Open the app with a project that has a persona configured (this triggers the XML wrapping path).
  2. Send a message like "hello" in a new conversation.
  3. Navigate away from the chat, then click back on it in session history to trigger a replay.
  4. Before this fix: the user bubble shows the full XML markup. After: it shows just "hello".
  5. Verify that sessions without a persona also replay correctly (the fallback path).

🤖 Generated with Claude Code

tellaho and others added 4 commits April 10, 2026 08:50
When loading a previous session, user messages were displayed with raw
XML tags (<persona-instructions>, <user-message>, etc.) because the
goose binary stores the full wrapped prompt in its session history.

Add extract_user_message() to parse out just the <user-message> content
before emitting it to the frontend during session replay.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…imit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tellaho tellaho marked this pull request as ready for review April 10, 2026 21:00
@tellaho tellaho requested a review from wesbillman as a code owner April 10, 2026 21:00
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08f9429f5f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

…nput

Addresses review feedback: if a user's message literally contains
"</user-message>", the previous find()-based approach would truncate.
Now we require the close tag to be at the end of the string, matching
the backend's wrapping format exactly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tellaho tellaho merged commit 90b0eb9 into main Apr 10, 2026
8 checks passed
@tellaho tellaho deleted the fix/strip-xml-replay-user-message branch April 10, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant