Aias00 opened a new issue, #4959:
URL: https://github.com/apache/rocketmq-dashboard/issues/4959

   ## Problem
   
   `useAgentRun.stop()` awaits the asynchronous `stopRun(runId)` request and 
unconditionally handles a rejection by clearing `stopRequested`, setting the 
hook error, and calling `onError`.
   
   If the user navigates from conversation A to conversation B while that 
request is pending, the conversation-change effect calls `abort()` and 
correctly clears A's state. A later rejection from A nevertheless executes the 
old Stop catch block against the current hook instance, so conversation B 
displays an error/toast that belongs to conversation A.
   
   ## Proposed design
   
   1. Capture the current stream request id and generation when Stop begins.
   2. After the Stop request settles, only apply failure state/callbacks if 
both ownership tokens still match.
   3. Let navigation/new-run invalidation continue to clear `stopRequested`; a 
stale Stop completion becomes a no-op.
   4. Preserve the existing behavior for a Stop rejection that still belongs to 
the active conversation/run.
   
   ## Test plan
   
   - Add a deferred `stopRun` rejection test.
   - Start a run in conversation A and receive its `run_started` frame.
   - Invoke Stop, navigate/rerender to conversation B while the request is 
pending, then reject it.
   - Assert conversation B has no error, `onError` is not invoked, and Stop 
state remains cleared.
   - Keep the existing active-run rejection regression to prove current error 
handling remains intact.
   - Run the focused hook tests, full frontend tests, lint, and production 
build.
   
   ## Acceptance criteria
   
   - A Stop response from an invalidated stream cannot mutate another 
conversation's UI state.
   - A current Stop failure still restores the button and reports its error.
   - Stop still leaves the stream open so terminal events can arrive.
   


-- 
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