Repository navigation
fix(gateway): chat history shows injected skill instructions on claude-cli sessions - #130269
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 2:25 PM ET / 18:25 UTC. ClawSweeper reviewWhat this changesThe PR filters Claude CLI transcript rows marked as internal metadata so gateway chat history does not present them as user messages. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep this PR open for the required user-visible proof. The shared Claude CLI transcript parser fix is correct and narrowly repairs current-main behavior, but the supplied terminal importer output does not meet the applicable gateway policy’s Control UI screenshot/recording requirement. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway chat history imports a bound Claude CLI JSONL transcript, merges its visible turns with local history, and returns the result to chat clients. The shared parser decides which external transcript rows are eligible to become visible messages. flowchart LR
A[Claude CLI transcript] --> B[Gateway snapshot reader]
B --> C[Shared transcript parser]
C --> D{Metadata or sidechain row?}
D -->|Yes| E[Omit internal row]
D -->|No| F[Merge visible turn]
F --> G[Chat history response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +36. Total +41 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the shared parser exclusion and attach a redacted before/after Control UI screenshot or short recording showing that a real gateway chat-history view omits the metadata row while preserving adjacent real turns. Do we have a high-confidence way to reproduce the issue? Yes—current main has a precise offline reproduction: a well-formed user-role JSONL row with isMeta true passes the visible-history guard and reaches the shared importer; the added regression case encodes that path. Is this the best way to solve the issue? Yes—the shared parser is the correct producer boundary because synchronous import, asynchronous chat-history snapshots, fallback seeding, and activity classification all reuse it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4cfadd6fa202. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Added the requested real-behavior proof to the PR body: a redacted before/after run of the actual importer entry point ( @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
d9b34bf to
7de3acd
Compare
Co-authored-by: Claude Fable 5 <[email protected]>
7de3acd to
2bf55f6
Compare
|
Thanks @brocktice! Proof: An isolated Claude Code 2.1.246 session produced one real command, one native metadata instruction row, and one assistant reply. The same transcript went through the production importer and an authenticated Gateway history request. Main returned all three rows. The repaired head returned only the real command and reply, with both native message identifiers unchanged. Sanitized Control UI captures confirm the visible result. Landed in f054203aba11ca430767a009e991e8f926077b3b.
Example
|
Prevent Claude harness-injected isMeta rows from entering visible session history while keeping real conversation and other context markers unchanged. Co-authored-by: Brock Tice <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #130268
What Problem This Solves
Claude Code marks injected skill bodies and other private harness input with
isMeta: true. OpenClaw imported those rows as ordinary user messages, sochat.historyreturned instructions that the operator did not write.Why This Change Was Made
Both Claude transcript import paths now reject
isMetarows before they create an OpenClaw message. The fix uses Claude's native marker and does not inspect message text.The repair keeps real user commands, assistant replies, compact summaries, transcript-only context, tool rows, and reseed handling on their existing paths.
Maintainer decision
Full omission is intentional.
isMetais private harness input, so it must not be inspectable throughchat.history. This replaces the collapsed-notice treatment forisMetaonly; compact summaries and transcript-only context keep that treatment.User Impact
Claude CLI session history now contains only the real conversation and the existing visible context rows. Private skill instructions no longer enter
chat.history, including after session-catalog adoption.Evidence
isMetainstruction row, and one assistant reply.345b2235e3c0b2f702bc1ccf06ce42a397dc0991: the production importer and an authenticated isolated Gatewaychat.historyrequest each returned three messages, including the injected instruction body.7de3acdc38379e2e30bd8c76c32754455ea67524: the same importer and Gateway request each returned only the real command and assistant reply; both native message identifiers remained stable.2bf55f694ee883ac8e3986796bf1b7ff7930c367is a patch-identical rebase onto main871b18dff5039484e86c76d282699a8defcb1654; stable patch ID:7b13b4157d151c06374494252ed1e33acce9bf06.pnpm check:changedpasses.Control UI
The head capture uses the proven pre-rebase head with the sanitized message set retained from the exact Gateway run. The current head has the same patch, and the UI renderer does not change in this pull request.
🤖 Generated with Claude Code