fix(gateway): hide CLI reseed wrappers in history#99651
Closed
lin-hongkuan wants to merge 1 commit into
Closed
Conversation
|
Closing this PR because the author has more than 20 active PRs in this repo. Please reduce the active PR queue and reopen or resubmit once it is back under the limit. You can close your own PRs to get back under the limit. |
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.
Closes #99646
What Problem This Solves
Fixes an issue where Claude CLI users who resume from OpenClaw's raw transcript reseed prompt could later see the entire internal reseed wrapper rendered as a user chat bubble in chat history. The visible bubble could include the
<conversation_history>replay and the<next_user_message>wrapper instead of only the message the user actually typed.Why This Change Was Made
The Claude CLI transcript importer now recognizes OpenClaw's reseed envelope when it appears as an imported Claude user row and projects only the wrapped
<next_user_message>text into OpenClaw chat history. This keeps the model-facing reseed prompt unchanged while preventing history-API clients from displaying internal prompt scaffolding or replayed prior turns.User Impact
Users reloading chat history after a Claude CLI session invalidation/resume now see their actual message, not a fake long user bubble containing OpenClaw reseed instructions and prior transcript context. Existing normal Claude CLI user messages, assistant messages, and tool-call coalescing behavior are preserved.
Evidence
node scripts/run-vitest.mjs src/gateway/cli-session-history.test.ts— PASS, 4 files / 80 tests.node scripts/run-vitest.mjs src/gateway/cli-session-history.test.ts src/gateway/server.chat.gateway-server-chat-b.test.ts— PASS, 6 files / 168 tests.corepack pnpm exec oxfmt --check src/gateway/cli-session-history.claude.ts src/gateway/cli-session-history.test.ts— PASS.corepack pnpm exec oxlint --config .oxlintrc.json --tsconfig config/tsconfig/oxlint.core.json src/gateway/cli-session-history.claude.ts src/gateway/cli-session-history.test.ts— PASS, 0 warnings/errors.git diff --check— PASS.SECRET_SCAN_MATCHES 0).