Repository navigation
Conversation
The gateway persists the redacted form of a message while the bound claude-cli session file keeps the full text. mergeImportedChatHistoryMessages deduped on exact text equality, so any message carrying a redactable token survived the merge in both forms and rendered twice in the Control UI. Also accept the redacted form of the imported text. Masking is not idempotent, so only the import side is transformed; messages that differ beyond redaction still merge as separate entries. Signed-off-by: Yufeng He <[email protected]>
Co-authored-by: Yufeng He <[email protected]>
e16c7f2 to
f7fc964
Compare
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 5:55 AM ET / 09:55 UTC. ClawSweeper reviewWhat this changesThe PR updates gateway transcript merging to recognize redacted and full-text copies of the same CLI-bound message while retaining separate messages that differ for reasons other than redaction. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain This PR still addresses a real current-main gap: the existing merge logic requires exact text equality, so a redacted local transcript and the full CLI import remain separate. The branch’s collision-aware matching approach appears directionally correct and is linked to the canonical report, but it needs a clean rebase and visible after-fix behavior proof before merge. Priority: P2 Review scores
Verification
How this fits togetherThe gateway combines its local chat transcript with messages imported from a bound CLI session before the Control UI renders history. Local persistence redacts sensitive-looking text, while CLI imports can retain the full text, so the merge step must distinguish one logical message from genuinely distinct messages. flowchart LR
A[Inbound chat message] --> B[Gateway local transcript]
A --> C[Bound CLI session]
B --> D[Redacted local text]
C --> E[Full imported text]
D --> F[Transcript merge]
E --> F
F --> G[Deduplicated chat history]
G --> H[Control UI]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +144, Tests +301. Total +445 across 2 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Rebase onto current main, preserve the identity-conflict and non-redaction-difference safeguards, and attach redacted proof from a real CLI-bound conversation showing that reload/import produces one Control UI message. Do we have a high-confidence way to reproduce the issue? No high-confidence executed reproduction was available in this read-only review. The current-main exact-text comparison and the linked report provide a clear source-level reproduction path using a redactable message in a CLI-bound Control UI session. Is this the best way to solve the issue? Unclear: matching a full import against its redacted representation is a narrow fix for the demonstrated divergence, and the branch adds collision safeguards, but rebased runtime proof is still needed to establish that this is the safest final rule. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 36440de61dc4. LabelsLabel 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)
|
|
Thank you, @he-yufeng, for identifying and testing the redacted/full Claude-history mismatch. The linked issue #112930 is now fixed on main by #115597 (95f62ee): imported history passes through the existing canonical transcript sanitizer before the existing identity-aware deduplication. This fixes both the duplicate UI message and secrets present only in imported CLI history, without adding lossy transcript-identity heuristics. I independently verified the exact behavior with a real Claude projects JSONL, the production gateway importer and merger, and actual Chromium: the pre-fix importer reproducibly returns three messages instead of two; the landed importer renders one masked user message, preserves the imported assistant UUID and untouched external JSONL, and never exposes the synthetic secret. Before/after proof: https://github.com/openclaw/openclaw/actions/runs/30426219625. Full importer, shared redactor, both gateway consumers, and Chromium history proof: https://github.com/openclaw/openclaw/actions/runs/30426091491. Closing as superseded by the landed canonical fix. Thank you again for surfacing this and contributing the regression cases. |
What Problem This Solves
The gateway persists the redacted form of an inbound message to its local transcript (e.g.
agent%…4000), while the bound claude-cli session file keeps the full text.isEquivalentImportedMessageincli-session-history.merge.tsdeduped the two histories on exact text equality, so the redacted local and the full import never matched and both survived the merge, rendering the message twice in the Control UI (#112930).The fix also accepts the redacted form of the imported text as equivalent. Only the import side is transformed: masking is not idempotent (an already masked token degrades to
***on a second pass), so transforming both sides would break the comparison instead of fixing it. The exact-equality fast path is unchanged, so unredacted messages dedupe the same way as before.Evidence
Two new cases in
cli-session-history.test.ts: a redacted local plus the full import now merges to one entry, and a local entry that differs beyond redaction ((edited)) still merges as two, so the change does not over-dedupe. Suite is 123/123 green locally, oxlint and tsc clean.Fixes #112930.