Skip to content

fix(chat): hide untrusted frames in continue-imported Beam history - #197788

Merged
vincentkoc merged 2 commits into
mainfrom
fix/beam-imported-history-display
Nov 12, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/beam-imported-history-display

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Beam handoffs (and other session-catalog histories imported through sessions.catalog.continue) show raw <<<EXTERNAL_UNTRUSTED_CONTENT id="…">>> / Source: External frames in Control UI. The --- separator also turns Source: External into a markdown heading, so every imported message is a wall of security markers.

User Impact

Imported Beam conversations read as normal chat again, including already-imported sessions. Stored history and model context keep their untrusted-content framing unchanged; this is display-only plus a trim on new continue imports.

Why This Change Was Made

wrapExternalContent(..., { includeWarning: false }) joins an empty warning slot with "\n", so its output begins with one LF. Preservation imports .trim() it; the continue path (session-catalog-gateway-copy.ts) did not, so persisted frames start with \n<<<…. IMPORT_FRAME in src/chat/session-catalog-display.ts is anchored at ^<<<, so the unwrap never matched. The existing tests also trimmed the wrapper, which is why nothing caught it.

  • Display: accept exactly one optional LF before the frame (after the optional label), which matches what is already stored. Two LFs, CRLF, trailing text, mismatched ids, fenced/inline examples and missing provenance keys are still shown literally.
  • Import: trim continue-path wraps so new transcripts match preservation imports.

Evidence

  • Repro on a live Team Gateway (2026.11.3): a Beam handoff via sessions.catalog.continue rendered raw frames for every imported item.
  • Added a regression test using the untrimmed wrapExternalContent output, with and without a Thinking label, and moved the rejected-separator cases to two-LF forms.
  • Standalone regex check against untrimmed/trimmed/labelled frames and the 2-LF, CR, label+2LF and trailing-LF negatives: all pass.
  • Local vitest and the pre-commit hook were not run: this worktree is code-only, and the shared hook tooling has oxlint 1.88.0 while main requires 1.89.0. Relying on CI.

Continue imports stored wrapExternalContent output untrimmed, so each frame
began with an LF the anchored display unwrap rejected, leaving raw
EXTERNAL_UNTRUSTED_CONTENT markers in Beam histories. Accept exactly that one
LF for already-stored transcripts and trim new continue imports like
preservation imports do.
@vincentkoc vincentkoc self-assigned this Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: XS labels Nov 12, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review November 12, 2026 14:53
@vincentkoc

Copy link
Copy Markdown
Member Author

Screenshot gate waived by maintainer for this PR: the change only alters which text a bubble shows. Before: raw EXTERNAL_UNTRUSTED_CONTENT frames on continue-imported Beam history. After: the same body without the frame. Covered by the regression test in chat-imported-history.test.ts. No capture route was available: the worktree is code-only and the configured Crabbox provider had no credential. Landing on green CI.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR hides generated trust frames in continued catalog history by accepting the previously stored leading newline and trimming new import wrappers.

Example: A continued Beam contains the message “Keep this body”.

  • Before: The bubble includes EXTERNAL_UNTRUSTED_CONTENT markers and a Source: External heading.
  • After: The bubble shows “Keep this body” while canonical history retains its untrusted-content markers.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused implementation appears correct, but after-fix product evidence and upgrade coverage for persisted transcript content are absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Continued Beam conversations display raw trust markers and unintended Markdown headings around imported messages.
Reason: This restores the established readable-history contract, and the maintainer-authored PR supplies direction for the narrowly scoped behavior change.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored PR addresses a source-confirmed display bug with a focused fix; no introduced correctness or security defect was found.

Priority: P2
Reviewed head: 08d06c9ccee350993397fb3d126b110655536d98

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply redacted after-fix product output showing an existing v2026.11.3 continuation reopened after upgrade and a newly continued Beam displaying cleanly with canonical markers retained; base/head regression-test results were not supplied.
Agent review details

How this fits together

The Gateway copies external catalog items into session transcripts, and shared display projections convert those persisted messages into Control UI chat content.

flowchart LR
  A[Beam catalog] --> B[Gateway continuation]
  B --> C[External content wrapper]
  C --> D[Session transcript]
  D --> E[Shared display projection]
  E --> F[Control UI chat]
Loading

Technical review

Best possible solution:

Keep the shared display parser compatible with existing one-LF frames and normalize new continuation wrappers at the existing copy writer.

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

Yes, source inspection establishes the path: disabling wrapper warnings emits one leading LF, continuation persists it, and current main's anchored display matcher rejects it; no target code was executed during this review.

Is this the best way to solve the issue?

The patch is the smallest complete repair using existing owners: the parser handles already-imported messages, and the writer prevents the same separator mismatch in new imports without removing model-facing markers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against de6dc6249746.

Provenance checked

  • Strict imported-frame display matching changes intended behavior with a stated reason (fix(ui): hide trust wrappers in imported chat history #140338: Hide generated wrappers only for proven catalog imports while preserving literal examples, warnings, malformed frames, and unexpected separators; the parser later moved into the shared display owner through fix(chat): show tool cards for external Codex transcripts #183313.)
  • Continuation wrapper persistence keeps the original intent (c79c8c4: Wrap copied external transcript text as untrusted model context; trimming the outside separator retains that boundary.)
  • Imported-history rejection tests keeps the original intent (efaf5e7: Consolidate overlapping coverage while retaining owning-boundary assertions; the new cases exercise an actual producer shape previously absent from the fixtures.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d9b5c01 adds src/chat/session-catalog-display.ts:155 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d9b5c011f9bd; files: src/chat/session-catalog-display.ts)
  • Jason (Json): Raw commit c79c8c4 adds src/gateway/server-methods/session-catalog-gateway-copy.ts:157 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c79c8c4c0aa7; files: src/gateway/server-methods/session-catalog-gateway-copy.ts)

PR surface

Source +2, Tests +14, Docs +1. Total +17 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 4 2 +2
Tests 1 16 2 +14
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 21 4 +17

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: Imported conversations remain usable, but generated security framing substantially disrupts reading their messages.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Label justifications:

  • P2: Imported conversations remain usable, but generated security framing substantially disrupts reading their messages.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the product and retained-history upgrade evidence described in the proof assessment.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 12, 2026, 10:09 AM ET / 15:09 UTC.

@vincentkoc
vincentkoc merged commit 7b75336 into main Nov 12, 2026
119 checks passed
@vincentkoc
vincentkoc deleted the fix/beam-imported-history-display branch November 12, 2026 15:50
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
…penclaw#197788)

* fix(chat): unwrap continue-imported catalog frames in Control UI

Continue imports stored wrapExternalContent output untrimmed, so each frame
began with an LF the anchored display unwrap rejected, leaving raw
EXTERNAL_UNTRUSTED_CONTENT markers in Beam histories. Accept exactly that one
LF for already-stored transcripts and trim new continue imports like
preservation imports do.

* chore: drop release-owned changelog entry (note lives in PR body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant