Repository navigation
fix: stabilize group chat and complete Agent mentions - #115
Merged
Merged
Conversation
Add leading Agent mention suggestions that reuse the existing safe routing syntax and keep manually-scrolled group conversations stable across polling refreshes.
Compare complete Project Group message snapshots, consume send-follow intent after the next refresh, and cover keyboard and pointer mention selection.
Keep autocomplete suggestions aligned with visible Agent names so opaque generated IDs cannot produce unexpected matches.
Limit Project Group suggestions to idle auth-demo Agents, preserve drafts when a mention would exceed the composer limit, and keep overflowing suggestion options vertically scrollable and keyboard accessible.
There was a problem hiding this comment.
🟡 Changes recommended
The new mention suggestion listbox has a confirmed keyboard edge case (Tab/Enter preventDefault with no active option) and needs a small accessibility fix to keep listbox options out of the tab order.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves the Project Group chat UX by preventing polling refreshes from forcibly scrolling readers to the bottom, and adds leading-@ Agent mention autocomplete (keyboard + pointer) backed by the existing callable Agent directory.
Changes:
- Adds snapshot-based message refresh logic that preserves scroll position unless the reader is bottom-pinned, on initial load, or after a successful send.
- Implements leading-
@mention query + replacement helpers and integrates a suggestions listbox into the composer (Arrow keys, Enter/Tab, Escape, click). - Extends unit and Playwright coverage to assert scroll anchoring and mention suggestion behavior/layout constraints.
File summaries
| File | Description |
|---|---|
| tests/e2e/ui-gate.spec.mjs | Adds an assertion that manual upward scrolling remains stable across polling refreshes. |
| tests/e2e/project-group-contract-flow.spec.mjs | Adds end-to-end coverage for mention suggestions, keyboard navigation, filtering, and overflow constraints. |
| apps/web/src/styles.css | Introduces styling/positioning for the mention suggestions popup in the composer. |
| apps/web/src/pages/ProjectGroupPage.tsx | Implements scroll-follow gating, message snapshot refresh preservation, and mention suggestions UI + interactions. |
| apps/web/src/pages/project-group-mention.ts | Adds typed leading-@ query detection, candidate filtering, and query replacement helpers. |
| apps/web/src/pages/project-group-mention.test.tsx | Adds unit tests for mention candidate logic and message refresh decision logic. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+356
to
+361
| if (event.key === "Enter" || event.key === "Tab") { | ||
| event.preventDefault(); | ||
| const agent = mentionCandidates[mentionActiveIndex]; | ||
| if (agent) selectMention(agent); | ||
| return; | ||
| } |
Comment on lines
+380
to
+387
| <button | ||
| id={`${MENTION_SUGGESTIONS_ID}-${index}`} | ||
| key={agent.id} | ||
| type="button" | ||
| role="option" | ||
| aria-selected={index === mentionActiveIndex} | ||
| onMouseDown={(event) => event.preventDefault()} | ||
| onClick={() => selectMention(agent)} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Project Group polling replaced the message array every 1.1 seconds and unconditionally scrolled the bottom sentinel into view. Readers trying to inspect older messages were repeatedly dragged back down. The composer also exposed only persistent route chips; typing a leading
@had no Agent discovery or completion.Closes #110.
Root cause
ProjectGroupPagetied every polling refresh to bottom scrolling, even for byte-equivalent snapshots, and did not distinguish a bottom-pinned reader from someone who had manually scrolled upward. Mention formatting existed for route chips, but no caret-aware leading-token query or suggestion interaction reused it.Fix
@suggestions from the existing callable Agent directory.Test plan
1280×800and1440×900.@Fshowing an unrelated visible name).git diff --checkpassed.Out of scope
Backend leading-mention routing semantics, provider configuration, general UI redesign, documentation, and live verifier work in #111.