Repository navigation
improve(ui): standardize fenced code collapse and wrapping - #125229
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 3:10 AM ET / 07:10 UTC. ClawSweeper reviewWhat this changesThe branch replaces JSON-only code disclosure with seven-line previews, contained horizontal overflow, and reversible wrapping for interactive Control UI Markdown hosts. Merge readinessKeep open for maintainer review: the shared renderer and host lifecycle look coherent, but the assistant-only scope needs confirmation and the UI-visible change lacks real after-fix proof. Priority: P2 Review scores
Verification
How this fits togetherControl UI converts chat and sidebar Markdown into sanitized HTML. The shared code-block renderer emits optional controls, and transcript, detail-panel, and caretaker hosts initialize and handle those controls. flowchart LR
Message[Markdown content] --> Renderer[Shared Markdown renderer]
Renderer --> Scope[Interactive host decision]
Scope --> Controls[Preview, wrap, and copy controls]
Controls --> Hosts[Chat, detail panel, caretaker]
Hosts --> Reader[Readable code fences]
Decision needed
Why: The branch makes that narrower choice, while the linked request and original PR description describe user fences as part of the unified behavior; the provided comments assert approval but do not supply the approving maintainer decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +335, Tests +130. Total +465 across 18 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Mantis proof suggestionA redacted web-chat transcript showing the initial preview and the revealed/wrapped assistant fence would materially verify the visible behavior. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Record the assistant-only scope decision, attach sanitized real Control UI proof showing preview, reveal, and wrap, then refresh review against current main before merge. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a proposed UI behavior change, not a current bug report; the source includes mock-backed browser coverage but no independently observed live result. Is this the best way to solve the issue? Unclear: the renderer is the right ownership boundary, but the narrowed assistant-only scope and current-main behavior need confirmation before this can be called the best solution. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6cc40431d173. 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 (4 earlier review cycles)
|
Every Markdown code fence now shares one behavior instead of the JSON-only 40-line disclosure: blocks longer than seven lines show a seven-line preview with the exact hidden-line count, horizontal overflow stays inside the fence, and a reversible wrap control appears only once a line measurably overflows. User fences keep the bubble's own typography and carry no code chrome. The collapsible markup is emitted only for hosts that own the code-block lifecycle (codeBlockInteraction: interactive), and that lifecycle collapsed to one click owner plus one initializer so a host cannot wire half of it. The chat thread, detail panel, and caretaker surface all run it; the skills preview gets the click owner its copy button had never been given. The scan is deferred and coalesced because a Lit element ref commits before that render's children, and detached ResizeObserver targets are released before each pass. Also adds the interaction mode to the markdown cache key so a static host cannot serve interactive markup from a sibling render, and drops the stylesheet rules and selector guards the removed json-collapse markup owned.
484d68a to
11c413d
Compare
|
Addressed the review findings on the rebuilt branch:
Focused proof:
Exact-head CI is attached to @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Addressed the review findings and resolved the requested product decision:
The previous P1 recommendation to restore user-fence controls is superseded by the explicit maintainer scope decision above. No merge is requested until this fresh review has no open findings. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…125229) * improve(ui): standardize fenced code collapse and wrapping Every Markdown code fence now shares one behavior instead of the JSON-only 40-line disclosure: blocks longer than seven lines show a seven-line preview with the exact hidden-line count, horizontal overflow stays inside the fence, and a reversible wrap control appears only once a line measurably overflows. User fences keep the bubble's own typography and carry no code chrome. The collapsible markup is emitted only for hosts that own the code-block lifecycle (codeBlockInteraction: interactive), and that lifecycle collapsed to one click owner plus one initializer so a host cannot wire half of it. The chat thread, detail panel, and caretaker surface all run it; the skills preview gets the click owner its copy button had never been given. The scan is deferred and coalesced because a Lit element ref commits before that render's children, and detached ResizeObserver targets are released before each pass. Also adds the interaction mode to the markdown cache key so a static host cannot serve interactive markup from a sibling render, and drops the stylesheet rules and selector guards the removed json-collapse markup owned. * fix(ui): satisfy fenced code checks
Closes #125227
What Problem This Solves
Resolves a problem where Control UI users reading fenced code would get inconsistent long-block behavior, including fully closed JSON summaries, unbounded transcript height, and long lines that had no contextual wrap control while pressuring the surrounding transcript width.
Why This Change Was Made
All Markdown code fences now use one shared behavior: blocks longer than seven lines show a seven-line preview with the exact hidden-line count, while measured horizontal overflow stays inside the fence and exposes a reversible wrap control. JSON, unlabeled, user, assistant, and detail-panel variants share the same path; copied text remains raw.
This change intentionally leaves border, fill, and header visual styling to the separate fenced-code visual work. It does not add a streaming indicator or Mermaid rendering.
User Impact
Code-heavy transcript turns are easier to scan without losing context. Users can reveal long fences, horizontally scroll unwrapped code without widening the page, or enable and disable wrapping only when the content actually overflows. Keyboard focus, accessible state labels, tooltips, and reduced-motion behavior remain available.
Evidence