unbridled-41 opened a new issue, #5461:
URL: https://github.com/apache/rocketmq-dashboard/issues/5461

   ### Studio Version
   branch: `rocketmq-studio` @ `6a68042f` (the revision verified; the branch is 
based on it)
   deployed as: built from source (unit test)
   
   ### Runtime Environment
   
   Not environment-specific: frontend state handling, verified with jsdom tests.
   
   ### Connected RocketMQ Cluster
   
   Not cluster-specific (AI page).
   
   ### Describe the Bug
   
   While a run is stopping, the send slot is the disabled `stopping` button, 
but the composer still treats the run as idle: `canSend` is derived from 
`generating = isStreaming && !stopRequested`, so it is `true`, and the Enter 
handler calls `handleSend()`, which clears the draft (`onSend(text); 
onChange('');`). The send itself is refused — `useAgentRun` returns early while 
`chatInFlightRef.current` is true, which lasts until the stream closes — and 
for an existing conversation `startRun` returns the conversation id regardless, 
so the page's `target === null` draft-restore never runs. The prompt is 
silently lost.
   
   ### Steps to Reproduce
   
   1. Send a message and let it stream.
   2. Click Stop and, while the button shows `stopping`, press Enter with text 
in the composer.
   3. Observe the textarea empty itself, no request being made and no error; 
the text is gone.
   
   ### What Did You Expect to See?
   
   Enter during the stop window either sends the prompt or leaves the draft in 
place — the same thing the disabled button next to it already communicates.
   
   ### What Did You See Instead?
   
   The draft is cleared for a send that never leaves.
   
   ### Evidence
   
   - `web/src/pages/ai/components/Composer.tsx` (`canSend`, `handleSend`, the 
Enter handler), `web/src/pages/ai/hooks/useAgentRun.ts` (the in-flight guard), 
`web/src/pages/ai/hooks/useAiSend.ts` and `web/src/pages/ai/index.tsx` (the 
restore only on `target === null`).
   - `cd web && npx vitest run src/pages/ai` — the added case 
`keepsTheDraftWhenEnterArrivesWhileTheStopIsStillInFlightTest` fails before the 
change (`expected "onSend" to not be called, number of calls: 1`) and passes 
after (`Tests 195 passed`).
   
   ### Impact
   
   A user-visible, silently lost prompt on the AI page's primary input.
   
   ### Acceptance Criteria
   
   - The keyboard path agrees with the button state across the whole streaming 
window.
   - A regression test asserts the draft survives Enter during stopping.
   
   Related: #4739 (the broader report about a refused send losing the draft; 
this is the composer's own guard path, not the server-refusal paths that report 
also lists).
   
   **Corresponding PR:** #5425
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to