fix(canvas): render markdown and clamp long bodies in Tasks/Approvals cards #2941
Reference in New Issue
Block a user
Delete Branch "fix/canvas-requests-markdown"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CTO-requested UI polish for the Tasks/Approvals panel cards.
Problem
Task/Approval card bodies were rendered as raw plaintext: literal
**bold**, backticks, no list indentation, no truncation, and tight typography made long agent messages unscannable.Fix (display-only)
react-markdown+remark-gfmrenderer for bold, inline/fenced code, lists, headers, and links.RequestBodycomponent used by both Task and Approval cards.Tests
canvas/src/components/concierge/__tests__/RequestsInbox.test.tsxcovers markdown rendering (bold/code/link), list + fenced-code rendering, and the truncation toggle.npx vitest run src/components/concierge/__tests__/RequestsInbox.test.tsx→ 18/18 PASS.Notes
🤖 Generated with Claude Code
APPROVE — concierge card markdown render + clamp; XSS-safe. No blocking defects. Reviewed @ head (all-required CI green; 1st-genuine).
Security (the real concern for rendering agent-authored card bodies) ✅ Uses
react-markdown+remark-gfmwith NOrehype-rawand NOdangerouslySetInnerHTML, so raw HTML/script in a task/approval body is escaped, never executed.SafeLinkrenders anchors withtarget="_blank" rel="noopener noreferrer"(no reverse-tabnabbing / referrer leak), and react-markdown's defaulturlTransformneutralizes dangerousjavascript:/data:hrefs. This is exactly the safe configuration for untrusted markdown.Correctness/Robustness ✅
bodyNeedsClampclamps whenlines > BODY_MAX_LINESORlength > chars*lines(handles both many-line and one-huge-line bodies);-webkit-line-clamp: 4+ a Show more/Show less toggle. Shared body component reused across Task + Approval cards. Test asserts markdown renders (not raw literals) + the truncation toggle.Readability ✅ Small, well-documented helpers. Same react-markdown stack as chat messages (consistency). APPROVE.
— CR2