Skip to content

fix(web): keep agent name suffixes visible in pickers - #666

Merged
pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:fix/agent-name-middle-truncation-323
Oct 30, 2026
Merged

pikann merged 1 commit into
Paca-AI:masterfrom
Yushu-Li:fix/agent-name-middle-truncation-323

Conversation

@Yushu-Li

Copy link
Copy Markdown
Contributor

Summary

Fixes #323.

Agent names that share a long prefix, such as backend-refactor-agent-v2 and backend-refactor-agent-v3, currently lose their distinguishing endings in constrained pickers. Middle-truncate names in the agent picker, member form dropdown, and assignee picker, keeping the ending visible when space is limited.

The shared label reserves up to eight trailing graphemes and lets CSS elide the prefix only when necessary. The suffix also clips within the available width for very narrow containers. Full names remain available as accessible names and native hover tooltips; search labels, stored values, and selection IDs are unchanged. Unicode graphemes (including combining marks and ZWJ emoji) stay intact when splitting the label.

Type of Change

  • Other: frontend usability fix

Validation

  • Reproduced the original agent-picker regression with a failing integration test before the fix.
  • Added 9 tests covering shared labels, Unicode boundaries, accessible names, agent/member selection, multi-assignment, and read-only assignees.
  • bun run test: 136 test files, 1,373 tests passed.
  • bun run lint: passed; two existing unused-suppression warnings in unchanged task-git-forms.tsx.
  • bun run build: passed; existing large-chunk warning.
  • Browser-checked the actual picker and shared label with the application styles: mouse/keyboard selection, narrow/wide containers, short names, Chinese, and emoji. This used a local fixture rather than an authenticated end-to-end deployment.

Checklist

  • The change is focused and scoped.
  • Related documentation is updated.
  • New structure or direction is explained clearly.
  • I avoided unnecessary detail or premature abstraction.

AI-assisted implementation; the checks above were run locally.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one minor suggestion inline.

Reviewed changes

  • MiddleTruncate shared component (new) — apps/web/src/components/shared/middle-truncate.tsx: splits a label into a CSS-truncated prefix and a width-reserved 8-grapheme suffix, exposing the full name via an sr-only span and a native title tooltip.
  • Wired into three pickers — agent picker trigger/options (agent-picker.tsx), member form dropdown (member-select.tsx), and assignee picker trigger/options (assignee-picker.tsx); stored IDs, search labels, and selection values are unchanged.
  • Tests + docs — unit and integration coverage for Unicode boundaries, accessible names, and selection, plus an apps/web/README.md note.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

title={text}
>
<span className="sr-only">{text}</span>
<span aria-hidden="true" className="min-w-0 truncate">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because the prefix and suffix are separate flex items, the prefix's trailing collapsible space sits at the end of its own line and is dropped by truncate (white-space: nowrap). Whenever the container is wide enough to show the prefix untruncated, a name whose split lands right after a space renders with the words joined, e.g. Backend Refactor Agent v2 → Backend RefactorAgent v2 (verified in headless Chromium). Multi-word member full names hit this in the w-64/w-56 option rows.

Technical details
# Trailing space lost at the prefix/suffix boundary

## Affected sites
- `apps/web/src/components/shared/middle-truncate.tsx:33` — the prefix `<span>` uses `truncate` (`white-space: nowrap`); its trailing collapsible whitespace is removed because it is the end of that flex item's line.

## Required outcome
- A space that falls exactly on the split boundary must stay visible, so multi-word names keep their original spacing.

## Suggested approach
- Use `overflow-hidden text-ellipsis whitespace-pre` instead of `truncate` on the prefix. Verified in headless Chromium: this preserves the trailing space (115.2px vs 111.3px for the `nowrap` variant) while still ellipsizing when the prefix overflows its box.
Suggested change
<span aria-hidden="true" className="min-w-0 truncate">
<span aria-hidden="true" className="min-w-0 overflow-hidden text-ellipsis whitespace-pre">

@pikann pikann left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit ca30a96 into Paca-AI:master Oct 30, 2026
2 checks passed
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.

[Feature] Middle-truncate agent names in assignee / agent dropdowns

2 participants