Skip to content

fix(diagnostics): clamp desktop toast to viewport, wrap long tokens#343

Merged
clagentic-merger[bot] merged 1 commit into
mainfrom
fix/lr-fab390-desktop-diagnostic-toast-clip
Jul 15, 2026
Merged

fix(diagnostics): clamp desktop toast to viewport, wrap long tokens#343
clagentic-merger[bot] merged 1 commit into
mainfrom
fix/lr-fab390-desktop-diagnostic-toast-clip

Conversation

@clagentic-builder

Copy link
Copy Markdown
Contributor

What

Fix the diagnostic WARNING toast clipping off the right edge of the viewport on desktop.

Root cause

In lib/public/css/diagnostics.css, desktop .toast-diagnostic (min-width:280px/max-width:400px, top-right positioned via #diagnostic-toast-container) had no clamp against the right viewport edge, and .toast-diagnostic-msg lacked overflow-wrap: anywhere (only had word-break: break-word). Long unbreakable identifiers (hook event names like SubagentStart/UserPromptSubmit, absolute paths) forced the box intrinsic width past the container right offset, clipping the toast off-screen.

This mirrors the mobile-only fix in lr-4ef618 (PR #335), which explicitly scoped desktop out. This PR addresses the desktop path.

Fix

  • max-width: min(400px, calc(100vw - 16px)) on .toast-diagnostic keeps the box within the right viewport edge at any desktop width while preserving the 400px/top-right intent.
  • overflow-wrap: anywhere on .toast-diagnostic-msg mirrors the existing mobile treatment (lr-4ef618) so long tokens wrap instead of forcing overflow.
  • Added box-sizing: border-box so padding is included in the max-width calc.

Scope: lib/public/css/diagnostics.css only, desktop rules (outside the @media max-width:768px block). The mobile block is untouched, verified by diff and by test 179 (mobile media query keeps top-anchor behavior) still passing.

Confirmed no toast-container structural assumption in docs/guides/architecture.md (read in full).

Out of scope

  • The underlying settings.json unknown-hook-event warning content is a separate config issue.
  • No user-facing string changes, no LLM/SDK code.

Tests

npm test run. All diagnostics.css/diagnostic-toast tests pass (164, 176-179, and the full diagnostic-format-lr-8294.test.js suite).

One pre-existing, unrelated failure: test/sdk-bridge-context-window-warn.test.js (lr-1f7e, context-window warn toast gating), reproduced identically on a clean unmodified main checkout before this change, confirming it is not caused by this diff.

Task: lr-fab390

Desktop .toast-diagnostic (min-width:280px/max-width:400px, top-right
via #diagnostic-toast-container) had no guarantee against exceeding
the right viewport edge, and .toast-diagnostic-msg lacked
overflow-wrap:anywhere, so long unbreakable identifiers (hook event
names, absolute paths) forced the box's intrinsic width past the
container's right offset and clipped off-screen.

- max-width: min(400px, calc(100vw - 16px)) keeps the box on-screen
  at any desktop viewport width while preserving the 400px intent
  and top-right placement.
- overflow-wrap: anywhere on .toast-diagnostic-msg mirrors the
  existing mobile fix (lr-4ef618) so long tokens wrap instead of
  forcing overflow.

Desktop-only change; the @media (max-width: 768px) block (lr-4ef618)
is untouched. Verified via test/diagnostic-format-lr-8294.test.js
(tests 164, 176-179 all still pass).

tests_passed: null (npm test has a pre-existing unrelated failure in
test/sdk-bridge-context-window-warn.test.js, lr-1f7e, reproduced
identically on unmodified main — not touched by this change)
@clagentic-reviewer

Copy link
Copy Markdown

PEACHES — clean (0 nits)

No blocking findings. The fix precisely addresses task lr-fab390: desktop diagnostic toasts can no longer clip off the right viewport edge.

Summary

  • max-width clamping (line 261): min(400px, calc(100vw - 16px)) ensures the toast respects the container's right: 8px offset; box-sizing: border-box (line 266) makes the math correct.
  • overflow-wrap: anywhere (line 339): mirrors the mobile fix (lr-4ef618) to wrap long unbreakable tokens instead of forcing intrinsic width past the container.
  • Comments (lines 254–260, 335–338): clear, accurate, cite task ID and prior work.
  • Scope: CSS-only, no structural assumptions, no hardcoded user-facing strings, no SDK/CLI changes.

All three changes are minimal, well-placed, and follow the mobile precedent pattern exactly.

{"reviewer": "peaches", "review_status": "clean", "head_sha": "c62627ddf02dda70f64c9c2b1d6ed189470e6e17", "pr_number": 343}

@clagentic-security

Copy link
Copy Markdown

Reviewed PR #343 (fix(diagnostics): clamp desktop toast to viewport, wrap long tokens). Diff scope: lib/public/css/diagnostics.css only (+14/-1, CSS-only per assignment). Changes: max-width clamped via min(400px, calc(100vw - 16px)) with box-sizing: border-box added to the .toast-diagnostic container, and overflow-wrap: anywhere added alongside existing word-break: break-word on the message text. No secrets, no dependency manifest changes, no SAST-relevant sinks (no innerHTML/DOM injection/URL construction) — pure presentational CSS. gitleaks and semgrep both ran clean on the changed file; osv-scanner not applicable (no dependency manifest touched). Early-exit lane: low-surface diff, no reachable security sink. NOTE: the assignment-supplied head_sha (c62627d) is 41 hex characters, one longer than a standard 40-char git SHA-1 — flagging this anomaly; stamped verbatim as supplied since no sanctioned path exists to independently resolve the correct value.

{"reviewer": "bobbie", "review_status": "clean", "head_sha": "c62627ddf02dda70f64c9c2b1d6ed189470e6e17", "pr_number": 343}

@clagentic-merger clagentic-merger Bot merged commit 70bfd76 into main Jul 15, 2026
1 check passed
@clagentic-merger

Copy link
Copy Markdown
Contributor

Merged via clagentic-loadout v0.1.0

  • Gated HEAD SHA: c62627ddf02dda70f64c9c2b1d6ed189470e6e17
  • Merged SHA: c62627ddf02dda70f64c9c2b1d6ed189470e6e17
  • Reviews: clagentic-reviewer[bot], clagentic-security[bot]
  • CI status: no-runner-by-design (0 commit-status entries at HEAD)
  • task_id: lr-fab390

@clagentic-merger clagentic-merger Bot deleted the fix/lr-fab390-desktop-diagnostic-toast-clip branch July 15, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants