Skip to content

Control UI shows duplicate messages when secret-redaction rewrites the local transcript copy but the CLI-imported copy keeps full text (exact-equality dedupe in cli-session-history) #112930

Closed

Description

@alfredjbclaw

Summary

When an inbound webchat message contains a token that matches the default secret-redaction patterns (e.g. a long percent-encoded session URL like https://host.example/chat?session=agent%3Amain%3Adashboard%3A<uuid>), the Control UI renders the message twice.

Root cause

Two transcript copies of the same message legitimately diverge:

  • The gateway persists the redacted form to its local session transcript — maskToken keeps the leading chars + … + last 4 (agent%…d73b).
  • The bound claude-cli session file keeps the full text (the model needs it).

isEquivalentImportedMessage (src/gateway/cli-session-history.ts) dedupes local vs CLI-imported history by external identity, then exact text equality plus a timestamp window:

if (!existingText || !importedText || existingText !== importedText) return false;

Redacted local ≠ full imported → the merge keeps both → double message in the UI. Reproduces on every message containing a redactable token; messages without such tokens dedupe fine.

Reproduction (2026.7.2-beta.3, agentRuntime claude-cli)

  1. In a Control UI chat bound to a claude-cli session, send a message containing a long secret-looking token (a percent-encoded URL query works).
  2. Reload / let history re-render: the message appears twice — once with the token masked (…), once in full (imported from the CLI transcript).

Suggested fix

Either:

  • apply the same transcript redaction to CLI-imported messages before merge/display (also closes the inconsistency that the full "secret" is displayed via the import path despite being redacted in the local store), or
  • extend isEquivalentImportedMessage with an anchored elided-segment match: when one text contains … and is shorter, split it on … and require the segments to appear in order in the other text, anchored at start and end (role check retained). This dedupes redacted-vs-full copies without risking cross-message collisions.

Activity

  1. added
    P2
    impact:session-state
    impact:ux-friction
    issue-rating: 🐚 platinum hermit
    clawsweeper:needs-live-repro
    clawsweeper:linked-pr-open
    clawsweeper:no-new-fix-pr
    on Jul 24, 2026
  2. clawsweeper commented on Jul 26, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 25, 2026, 11:03 PM ET / July 26, 2026, 03:03 UTC.

    Summary
    Keep this issue open because the provided context identifies an open pull request with explicit closing syntax for this exact defect. The proposed fix needs normal PR review and merge before the issue can be closed as implemented.

    Reproducibility: no. high-confidence live reproduction was run in this read-only review. The supplied report and linked fix describe a clear source-level path involving redacted local history and full Claude CLI imports.

    Root-cause cluster
    Relationship: canonical
    Canonical: #112930
    Summary: This is the canonical report for the redacted-local versus full-CLI-import equality mismatch; the linked open pull request is its candidate repair.

    Members:

    Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.
    • Include redacted logs or terminal output.

    Next step
    An open linked pull request already owns the narrow implementation path, so a separate repair job would duplicate active work.

    Review details

    Best possible solution:

    Land a focused, regression-tested history-merge repair that recognizes the local redacted form as equivalent to its full CLI-imported source while preserving distinct-message detection.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence live reproduction was run in this read-only review. The supplied report and linked fix describe a clear source-level path involving redacted local history and full Claude CLI imports.

    Is this the best way to solve the issue?

    Unclear until the linked PR’s exact comparison logic and regression cases are reviewed against current main. Its stated narrow direction is appropriate if it preserves deduplication for equivalent text without collapsing distinct edits.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The linked repair changes session-history equivalence behavior, so it should prove that genuinely edited or distinct messages are not collapsed while redacted/full representations of one message are deduplicated.

    Codex review notes: model internal, reasoning high; reviewed against 08138cabe0b3.

    Label changes

    Label changes:

    • add P2: This is a concrete Control UI session-history defect with limited, user-visible blast radius.
    • add impact:session-state: The duplicate results from merging two representations of the same session transcript message.
    • add impact:ux-friction: Users see confusing duplicate chat messages, but the report does not establish a blocked setup or recovery flow.
    • add issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.
    • add clawsweeper:needs-live-repro: Current issue advisory state selects this label.
    • add clawsweeper:linked-pr-open: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.

    Label justifications:

    • P2: This is a concrete Control UI session-history defect with limited, user-visible blast radius.
    • impact:session-state: The duplicate results from merging two representations of the same session transcript message.
    • impact:ux-friction: Users see confusing duplicate chat messages, but the report does not establish a blocked setup or recovery flow.
    Evidence reviewed

    What I checked:

    • Linked open fix: The supplied GitHub context contains an open pull request with explicit closing syntax and a matching stated root cause: redacted local transcript text versus full CLI-imported text fails exact-equality deduplication. (src/gateway/cli-session-history.ts, f7fc964fb7f3)
    • Issue reproduction report: The issue provides a concrete Claude CLI-bound Control UI path: send text containing a redactable token, then reload or re-render history and observe masked and full copies of the same message. (src/gateway/cli-session-history.ts, 08138cabe0b3)
    • Repository review policy: Root policy requires keeping an issue open while an open pull request explicitly references it with closing syntax; that PR is an implementation candidate, not closure evidence before merge. (AGENTS.md, 08138cabe0b3)

    Likely related people:

    • he-yufeng: Authored the open focused repair for the exact CLI-import history-deduplication behavior described in this issue; broader current-main ownership could not be independently established in the read-only environment. (role: linked fix author; confidence: medium; commits: f7fc964fb7f3; files: src/gateway/cli-session-history.ts)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  3. added a commit that references this issue on Jul 29, 2026
    95f62ee
  4. steipete commented on Jul 29, 2026

    @steipete
    Contributor

    Fixed by #115597, landed as 95f62ee.

    The imported Claude CLI copy now passes through the canonical transcript redactor before history merge. That prevents secrets present only in the imported transcript from reaching Control UI history and makes dedupe compare like-with-like: the imported and locally persisted copies have the same redacted display text before exact-text matching.

    Focused proof covered full-vs-redacted and already-redacted dedupe, preserved distinct external identities, edited local identity matches, and imported-only secret suppression (44/44 tests). Exact-head hosted CI passed before merge.

  5. added a commit that references this issue on Jul 29, 2026
    3c9e99a
  6. locked as resolved and limited conversation to collaborators on Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2clawsweeper-recovery-stuckclawsweeper:linked-pr-openclawsweeper:needs-live-reproclawsweeper:no-new-fix-primpact:session-stateimpact:ux-frictionissue-rating: 🐚 platinum hermit

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions