Automattic / Automattic/frontend-agent-chat
Fix FAB startup replaying the latest conversation
- Dominant language
- PHP
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Problem
Opening the floating chat widget as a logged-in user immediately loads and renders the most recent stored conversation. To the user, prior user text appears to have just been sent by the widget.
The startup path in `src/AgentChat.tsx` first calls `chat.newSession()`, then the second bootstrap effect selects `getMostRecentSession(chat.sessions)` and calls `chat.loadSession(latestSession.id)` (`AgentChat.tsx:2222-2257`). The deployed `0.14.4` bundle contains this same behavior.
This is especially misleading when the stored transcript starts with diagnostic-looking text: opening the FAB appears to execute a proof harness even though no new request occurred.
## Expected
- Opening the FAB starts on a blank current chat.
- Stored sessions remain available in the session selector.
- A stored transcript loads only after an explicit user selection.
- Switching agents also starts blank rather than replaying that agent's latest transcript.
- Regression coverage prevents automatic `loadSession()` during session-list bootstrap.
## Evidence
On Extra Chill, the live transcript's first message was persisted on August 15, while opening the FAB today rendered it immediately. The live plugin version and repository version are both `0.14.4`; this is current product behavior, not a stale deployment.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/AgentChat.tsx:2222-2257 and trace the startup effects that call newSession(), getMostRecentSession(), and loadSession(). Verify that opening the FAB and switching agents remain blank while stored sessions still load after explicit selection, then add regression coverage preventing automatic loadSession() during session-list bootstrap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100