fix: strip XML wrapper from replayed user messages#150
Merged
Conversation
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>
There was a problem hiding this comment.
💡 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).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 theUserMessageChunkreplay 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
🤖 Generated with Claude Code