Commit Graph

149 Commits

Author SHA1 Message Date
gsxdsm
716f3964c5 FN-5790: harden room chat send handling and optimistic reconciliation
Prevent duplicate room sends and avoid restoring composer text when ambiguous failures still delivered the message.

- guard room composer sends with an in-flight ref to prevent double-dispatch
- treat ambiguous post-send refresh failures as delivered when recovery confirms the user message
- centralize optimistic/SSE user-message reconciliation to replace temp messages instead of duplicating them
- add and update chat room hook/component tests that cover double-send prevention and delivered-on-ambiguous-failure behavior
- add a patch changeset for @runfusion/fusion documenting the room chat reliability fix

Files changed:
 .changeset/few-dingos-smile.md                     |  5 ++
 packages/dashboard/app/components/ChatView.tsx     |  8 +++
 .../components/__tests__/ChatView.rooms.test.tsx   | 27 ++++++++++
 .../app/hooks/__tests__/useChatRooms.test.ts       | 48 +++++++++++++++--
 packages/dashboard/app/hooks/useChatRooms.ts       | 62 +++++++++++++++-------
 5 files changed, 126 insertions(+), 24 deletions(-)

Fusion-Task-Id: FN-5790

Fusion-Task-Lineage: a1ac5e4f-4cc2-4cf9-8bc1-42587d0d1d1b
2026-05-31 16:57:42 -07:00
gsxdsm
eba6a72594 FN-5757: prevent chat message list from snapping to top
Keep chat scroll position stable when stale top snapshots are captured during mobile message updates.

- Capture scroll anchors from the first visible message instead of always sampling the first DOM node
- Ignore stale or likely-invalid zero-position snapshots before attempting scroll restoration
- Guard bottom anchoring from interrupting user scroll unless explicitly forced and add regression coverage for stale snapshot behavior

Files changed:
 packages/dashboard/app/components/ChatView.css     | 11 +++++-
 packages/dashboard/app/components/ChatView.tsx     | 33 +++++++++++++----
 packages/dashboard/app/components/__tests__/ChatView.scroll-to-top.test.tsx      | 41 ++++++++++++++++++++++
 3 files changed, 78 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-5757

Fusion-Task-Lineage: 4e4f6843-ba70-40da-8d16-358bdfcc7b09
2026-05-30 16:48:13 -07:00
gsxdsm
15bc51a47e FN-5720: fix room chat scroll anchoring on scope re-entry
Ensure Rooms scope reliably re-anchors to bottom on re-entry without breaking scroll preservation during refetch.

- reset stale thread anchor state when entering Rooms without an active room
- treat direct↔rooms transitions as entry events and anchor messages to bottom on entry
- keep existing scroll position when room messages are refetched in-place
- add regression tests covering room re-entry anchoring and refetch scroll preservation

Files changed:
 packages/dashboard/app/components/ChatView.tsx     | 14 +++-
 .../app/components/__tests__/ChatView.test.tsx     | 88 ++++++++++++++++++++++
 2 files changed, 99 insertions(+), 3 deletions(-)

Fusion-Task-Id: FN-5720

Fusion-Task-Lineage: dde8818b-f2e5-4c55-8a4c-2c54241c2e38
2026-05-30 10:31:29 -07:00
gsxdsm
16a82cf0ad FN-5722: suppress __SKIP__ sentinel room replies
Treat __SKIP__ room responder outputs as intentional silence so they never appear in persisted or rendered chat history.

- export ROOM_SKIP_SENTINEL and helper detection in chat orchestration
- skip persisting responder outputs that are trimmed-exact __SKIP__ sentinels
- avoid room reply failure errors when responders intentionally skip
- filter sentinel-only room messages in ChatView rendering
- add backend and UI tests covering sentinel suppression and substring pass-through
- document sentinel no-op behavior in dashboard chat room guide

Files changed:
 docs/dashboard-guide.md                            |  1 +
 packages/dashboard/app/components/ChatView.tsx     |  8 ++-
 packages/dashboard/app/components/__tests__/ChatView.rooms.test.tsx   | 16 +++++
 packages/dashboard/src/__tests__/chat.rooms.test.ts     | 80 +++++++++++++++++++++-
 packages/dashboard/src/chat.ts                     | 15 +++-
 5 files changed, 116 insertions(+), 4 deletions(-)

Fusion-Task-Id: FN-5722

Fusion-Task-Lineage: 242085fc-4b88-46c1-81aa-e398f5276fec
2026-05-30 10:21:49 -07:00
gsxdsm
ab1f6a7ffa FN-5706: hide chat input overflow until max-height
Prevent the chat composer from showing a right-edge scrollbar line before it reaches the autosize cap.

- set chat textarea default overflow to hidden in ChatView CSS
- add resolveChatInputOverflowY to switch overflow to auto only past the 640px cap
- apply overflow mode during composer autosize updates
- extend chat input autosize tests and docs to cover overflow behavior

Files changed:
 docs/dashboard-guide.md                                          | 2 +-
 packages/dashboard/app/components/ChatView.css                   | 1 +
 packages/dashboard/app/components/ChatView.tsx                   | 5 +++++
 packages/dashboard/app/components/__tests__/ChatView.chat-input-autosize.test.tsx   | 9 ++++++++-
 4 files changed, 15 insertions(+), 2 deletions(-)

Fusion-Task-Id: FN-5706

Fusion-Task-Lineage: 4619aa30-c02f-453b-bdf2-f60f360e9372
2026-05-29 20:47:13 -07:00
Josemi Liebana
599b1ec337 fix(dashboard): scroll-to-bottom button now overrides pending scroll restoration
When the user clicks 'Latest' while loadMoreMessages was in-flight,
the scroll restoration (which maintains position when older messages
are prepended) was undoing the explicit jump-to-bottom.

Fix: clear scrollRestoreSnapshotRef and set isUserScrollingRef=false
before anchorToBottom so the layout effect's restoration is skipped.
2026-05-27 14:43:51 +02:00
Josemi Liebana
6e9ab0e989 feat(dashboard): load latest messages first with order=desc pagination
- Add order?: 'asc' | 'desc' to ChatMessagesFilter (core)
- Route handler passes order param from query string
- Initial load requests order=desc and reverses for display
- loadMoreMessages uses before cursor instead of offset
- hasMoreMessages starts false (prevents IntersectionObserver race)
- ChatView IntersectionObserver guards against messagesLoading
2026-05-27 11:57:21 +02:00
Josemi Liebana
e018701fed fix(dashboard): wire scroll-to-top pagination instead of loading all messages
- Remove fetchAllMessagesInChat/fetchAllMessages helpers
- Keep limit:50 for initial load in useChat and useQuickChat
- Add IntersectionObserver sentinel at top of ChatView message list to
  trigger loadMoreMessages() when user scrolls to the top
- Keep stale-session guards (activeSessionRef checks) from original PR
- Tests: revert assertions back to { limit: 50 }
2026-05-26 21:48:35 +02:00
gsxdsm
3fbebd44e9 fix(dashboard): don't preventDefault on chat composer touchstart on Android
ChatView and QuickChatFAB both had an iOS-specific onTouchStart on the
textarea that called event.preventDefault() and then programmatically
re-focused the input — meant to suppress iOS's visualViewport auto-scroll
on re-focus. On Android, preventDefault on a textarea touchstart blocks
the soft keyboard from opening (programmatic focus() alone does not raise
the Android keyboard — only the default touch action does), so tapping
the main chat or quick chat composer focused the input but the keyboard
never appeared, looking like an instant dismiss.

Gate the touchstart workaround to iOS via isIOS().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 16:00:02 -07:00
Fusion (runfusion.ai)
8e872301c4 feat(FN-5379): add scroll-to-top action for chat messages
Added a scroll-to-top action for the ChatView with per-message scroll behavior, styled to match the mobile design, with comprehensive test coverage for scroll-to-top behavior. Also preserves the mobile copy-action CSS selector.

Fusion-Task-Id: FN-5379
2026-05-21 15:40:48 -07:00
Fusion (runfusion.ai)
1913cb59fe feat(FN-5389): add resume event instrumentation with SSE, hooks, and diagno
FN-5389 adds dashboard resume event instrumentation: a `resumeInstrumentation` utility captures SSE resume signals, wired through `useChat`, `useChatRooms`, and `useTasks` hooks, with remount markers in `Board` and `ChatView`; diagnostics routes expose resume events for observability, documented in

Fusion-Task-Id: FN-5389
2026-05-20 19:58:49 -07:00
Fusion (runfusion.ai)
12582414da feat(FN-5380): preserve ChatView scroll position on navigation
Preserve chat scroll state across view transitions in ChatView, with comprehensive test coverage. The feature adds scroll position persistence logic gated behind a debug trace flag, and a full test suite covering the scroll state behavior.

Fusion-Task-Id: FN-5380
2026-05-20 19:30:15 -07:00
gsxdsm
0e5cb4d292 Merge commit '60a636efd8e6002a69bae78105fb3ed37de7de46' 2026-05-20 16:20:26 -07:00
Fusion (runfusion.ai)
60a636efd8 feat(FN-5360): classify room send errors to gate composer auto-restore
Implements selective room composer restoration — the dashboard now classifies room send failures and gates composer restoration by error type, preventing spurious recovery on transient delivery errors while preserving composer state only for actionable failures. Covers the new classification logic i

Fusion-Task-Id: FN-5360
2026-05-20 16:20:25 -07:00
Fusion (runfusion.ai)
08d6535933 feat(FN-5365): add direct thread viewport writes to fix mobile keyboard reg
Adds direct thread viewport write functionality to ChatView with corresponding mobile keyboard regression test coverage, plus lint and test suite restoration.

Fusion-Task-Id: FN-5365
2026-05-20 14:28:45 -07:00
Fusion (runfusion.ai)
12a6ee9af1 feat(FN-5218): add hash mentions to chat composers and popups
Merges FN-5218: adds hash mention support (`#`) in chat composers, grouping task and file reference results in a unified popup, with wiring into `ChatView` and `QuickChatFAB`, plus test coverage and docs. The hook `useFileMention` is extended and refactored, and the file mention popup UI is updated

Fusion-Task-Id: FN-5218
2026-05-20 04:12:40 -07:00
Fusion (runfusion.ai)
1237168b71 feat(FN-5227): add bulk controls for project agents
- Add project-scoped Pause All Agents and Resume All Agents actions to the AgentsView controls menu
- Load bulk-action eligibility on menu open and skip ephemeral or ineligible agents
- Surface bulk action confirmations, success/error toasts, and refresh agent state after updates
- Add dashboard tests and agent docs coverage for the new bulk controls

Fusion-Task-Id: FN-5227
2026-05-20 03:57:17 -07:00
Fusion (runfusion.ai)
cfc70b21bd feat(FN-5202): add SWR caching for chat agents, skills, and models
This merge introduces SWR-style caching across the dashboard to eliminate redundant fetches for models, agents, and skills, significantly refactoring ChatView.tsx (reduced by ~140 lines) by offloading cache coordination to three new dedicated hooks (`useAgentsMapCache`, `useDiscoveredSkillsCache`, `

Fusion-Task-Id: FN-5202
2026-05-20 03:19:44 -07:00
gsxdsm
c4745caec0 fix(dashboard): grow main chat composer height as message grows
Reorders ChatView's input handler to resize the textarea before the
controlled setMessageInput call (matching QuickChat) so the height
assignment lands in the same frame as the keystroke and isn't lost to
React 18 batching. Also adds a 40px floor to clampChatInputHeight so a
0-scrollHeight measurement can't collapse the composer to zero.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 21:17:44 -07:00
Fusion (runfusion.ai)
587e9b416c feat(FN-5155): stabilize mobile keyboard viewport metrics
Stabilizes mobile keyboard viewport metrics in the `useMobileKeyboard` hook, with tests covering the hook and `ChatView` integration; a minor dashboard command adjustment is included.

Fusion-Task-Id: FN-5155
2026-05-19 13:38:31 -07:00
Fusion (runfusion.ai)
5a1f20f864 feat(FN-5146): complete Step 2 — raise composer height caps
Fusion-Task-Id: FN-5146
Fusion-Task-Lineage: 55a9837f-d0e1-475b-9f7f-45262141352e
2026-05-19 07:57:38 -07:00
Fusion (runfusion.ai)
d5d978c59f feat(FN-5108): complete Step 1 — resolve effective session model provider
Fusion-Task-Id: FN-5108
Fusion-Task-Lineage: 1b273c01-9f58-40ed-82f3-5706802cc2fc
2026-05-19 00:46:35 -07:00
Fusion (runfusion.ai)
499f88f672 fix(FN-4943): complete Step 3 — preserve clear/new dismiss behavior
Fusion-Task-Id: FN-4943
Fusion-Task-Lineage: 67dd5c2b-0b44-43dd-a016-0bff858ec4b9
2026-05-18 02:06:32 -07:00
gsxdsm
22729135e8 fix(dashboard): use queueMicrotask instead of setTimeout for iOS scroll reset in ChatView focus handler 2026-05-17 18:21:00 -07:00
Fusion (runfusion.ai)
74f0bd9e8d feat(FN-4857): complete Step 6 — wire room send dispatch in ChatView
Fusion-Task-Id: FN-4857
Fusion-Task-Lineage: 52e7b1cd-ec8f-4b6c-abfc-08c91e321b9e
2026-05-17 01:37:40 -07:00
Fusion (runfusion.ai)
a5eba7dfdb feat(FN-4739): complete Step 6 — intercept room clear slash commands
Fusion-Task-Id: FN-4739
Fusion-Task-Lineage: fc120dfa-d1b2-4065-9595-d0bc6304d2af
2026-05-16 09:56:54 -07:00
Fusion (runfusion.ai)
70221a6401 feat(FN-4669): complete Step 2 — fix composer resize on mount/switch
Fusion-Task-Id: FN-4669
Fusion-Task-Lineage: a9e579d1-9c24-4668-9606-eb7761dfddb0
2026-05-15 15:48:29 -07:00
Fusion
87c5e1dbfa feat(FN-4661): complete Step 4 — add unread dot styling
Fusion-Task-Id: FN-4661
Fusion-Task-Lineage: 39553dc3-4e7d-4398-b03f-24fa2edb9e20
2026-05-15 15:19:57 -07:00
Fusion
790dccc483 feat(FN-4661): complete Step 2 — wire unread state into ChatView
Fusion-Task-Id: FN-4661
Fusion-Task-Lineage: 39553dc3-4e7d-4398-b03f-24fa2edb9e20
2026-05-15 15:19:56 -07:00
Fusion
e50a4b5ad6 feat(FN-4659): add room title switcher dropdown
Adds a room title switcher dropdown to the chat view, with corresponding styles and a new rooms test file.

Fusion-Task-Id: FN-4659
2026-05-15 14:57:49 -07:00
Fusion
5141cf8b15 feat(FN-4610): complete Step 1 — add latest button to rooms thread
Fusion-Task-Id: FN-4610
Fusion-Task-Lineage: 6f2a411d-817d-45e5-bc8f-40ea38920401
2026-05-15 08:59:10 -07:00
Fusion
2d33d0e1b3 feat(FN-4403): complete Step 1 — move mobile rooms action to footer
Fusion-Task-Id: FN-4403
Fusion-Task-Lineage: 9bbfbed9-c40b-4ad2-a739-c8d93f9f691f
2026-05-14 06:30:23 -07:00
Fusion
bb5847d169 feat(FN-4336): complete Step 3 — add deferred direct thread anchor settle
Fusion-Task-Id: FN-4336
Fusion-Task-Lineage: d96c9da9-e355-4dc0-bf8c-451a917b0270
2026-05-13 09:42:33 -07:00
Fusion
4bc3d8d77e feat(FN-4336): complete Step 2 — defer visibility re-anchor settle pass
Fusion-Task-Id: FN-4336
Fusion-Task-Lineage: d96c9da9-e355-4dc0-bf8c-451a917b0270
2026-05-13 09:42:33 -07:00
Fusion
35f1d6117b feat(FN-4336): complete Step 1 — add direct-chat resize observer anchor follower
Fusion-Task-Id: FN-4336
Fusion-Task-Lineage: d96c9da9-e355-4dc0-bf8c-451a917b0270
2026-05-13 09:42:33 -07:00
Fusion
24339f7d89 feat(FN-4327): complete Step 3 — anchor direct thread on scope switch
Fusion-Task-Id: FN-4327
Fusion-Task-Lineage: 8508cca0-c7ff-43da-bbf1-385f9bc095ff
2026-05-13 09:06:20 -07:00
Fusion
74a1d8af57 feat(FN-4327): complete Step 2 — direct visibility anchor on desktop
Fusion-Task-Id: FN-4327
Fusion-Task-Lineage: 8508cca0-c7ff-43da-bbf1-385f9bc095ff
2026-05-13 09:06:20 -07:00
Fusion
3131adabff feat(FN-4226): complete Step 1 — suppress inactive room meta text
Fusion-Task-Id: FN-4226
Fusion-Task-Lineage: 3cbc561e-71dd-47c4-b4df-e570ef9a1d0c
2026-05-13 06:29:35 -07:00
Fusion
aa14e7d266 fix(FN-4201): complete Step 1 — sync composer autosize on messageInput changes
Fusion-Task-Id: FN-4201
Fusion-Task-Lineage: 6bfc2e72-8c11-4e63-b3c7-9245965d2380
2026-05-13 06:29:35 -07:00
Fusion
3980a229ca feat(FN-4195): complete Step 2 — replace ChatView undefined text token usage
Fusion-Task-Id: FN-4195
Fusion-Task-Lineage: 3abaad9b-5973-41cb-bec3-3c0d3a5347ba
2026-05-13 06:29:34 -07:00
Fusion
25e76d61da feat(FN-4227): add clickable file path links across dashboard
- Add reusable file path linkification utilities and FileBrowser context wiring across dashboard modals and log surfaces
- Linkify task detail, review, workflow, chat, activity, agent, dev server, and settings sync outputs so workspace paths open in the file browser
- Preserve inline code styling when wrapping detected paths and extend FileBrowserModal handling for linked navigation
- Cover the new linking behavior with dashboard tests and add a changeset plus AGENTS guidance for the reusable pattern

Fusion-Task-Id: FN-4227
2026-05-12 21:55:43 -07:00
Fusion
e7fc3a9d17 feat(FN-4177): add heartbeat messaging support for chat rooms
The merge delivers room heartbeat messaging for agents, allowing heartbeat-triggered agents to send messages into chat rooms and subscribe to room activity. Core changes include new chat-store room APIs, engine heartbeat room message tools, and corresponding tests, with a small dashboard ChatView up

Fusion-Task-Id: FN-4177
2026-05-12 18:20:17 -07:00
Fusion
14811ed60d feat(FN-4224): tighten github tracking header to single-row layout in task
Restyles the GitHub tracking header in TaskDetailModal to a compact single-row layout with tighter spacing, adds test coverage for the header layout, and includes a regression verification pass alongside a changeset documenting the change.

Fusion-Task-Id: FN-4224
2026-05-12 17:34:26 -07:00
Fusion
ab4242257a feat(FN-4055): add task ID collision audit script and recovery documentatio
Adds a standalone audit script for detecting task ID collisions, a regression test for store creation collision handling, and documentation of the recovery path; also applies minor UX refinements to ChatView and TaskDetailModal.

Fusion-Task-Id: FN-4055
2026-05-12 17:04:33 -07:00
Fusion
9ac213a16a feat(FN-4189): lift chat input height cap and add autosize behavior
Lifts the chat input height cap and enables auto-resize as the user types, improving the chat UX in `@fusion/dashboard`. Includes test coverage for the autosize behavior and a changeset for the `@runfusion/fusion` package.

Fusion-Task-Id: FN-4189
2026-05-12 17:04:33 -07:00
Fusion
1a11369832 feat(FN-4179): optimistically clear room composer on send
Implements optimistic room composer clear in the ChatView, providing instant UI feedback when switching rooms without waiting for server confirmation, with accompanying tests and documentation updates.

Fusion-Task-Id: FN-4179

Fusion-Task-Lineage: 0c3588fa-81ca-464b-b001-506c1756d0ea
2026-05-12 17:04:33 -07:00
Fusion
a1b71d26a2 feat(FN-4182): keep keyboard open on first tap of mobile room send button
Fixes a mobile UX bug where the keyboard would dismiss when tapping the room send button for the first time, plus adds a regression test in ChatView to guard against this behavior.

Fusion-Task-Id: FN-4182
2026-05-12 17:04:33 -07:00
Fusion
efdc6c4625 feat(FN-4139): add swipe-back navigation to chat, mission, and planning flo
Implements swipe-back gesture support for mobile navigation across ChatView, MissionManager, and PlanningModeModal, wired through a shared navigation history context and covered by a comprehensive test suite (~548 lines of swipe-back tests). A small fixup ensures swipe-back behaves correctly when la

Fusion-Task-Id: FN-4139
2026-05-12 17:04:33 -07:00
Fusion
ccda1895e5 feat(FN-4107): persist chat draft auto-save in ChatView
Persist chat drafts to storage in the ChatView component, with accompanying test coverage in a new `ChatView.draft.test.tsx` file.

Fusion-Task-Id: FN-4107
2026-05-12 17:04:32 -07:00
Fusion
d2f650a666 feat(FN-4118): restore last viewed room thread on chat load
Adds chat room scroll anchoring so that when returning to a room, the view stays positioned at the previously visited thread rather than resetting to the top, with test coverage in the rooms suite and a patch changeset for the published CLI.

Fusion-Task-Id: FN-4118
2026-05-12 09:20:39 -07:00