zmuxuny opened a new pull request, #7115:
URL: https://github.com/apache/rocketmq-dashboard/pull/7115
### Which Issue(s) This PR Fixes
Fixes #7112
### Brief Description
After a run finishes, a failed timeline reload correctly retains the live
answer and optimistic question. The existing Retry button only reloaded the
timeline, so a later success left both retained copies beside their persisted
twins and kept displaying the recovered reload error.
- Route the existing Retry action through the run hook so a successful
reload completes the retained live-to-persisted handoff.
- Keep the fallback throughout a pending or failed retry.
- Scope cleanup to the completed stream and latest retry, protecting newer
runs, navigation, unmount, and overlapping retries.
- Clear only the recovered timeline error; preserve independent stream
errors.
No backend, dependency, API wire contract, or UI text changes.
### How Did You Test This Change?
The real routed AiPage regression fails against both the original production
tree and the separately fixed reconnect-rendering tree from #7109: each shows
two copies of the question, two copies of the answer, and a stale run-error
alert after a successful manual Retry. It uses the actual timeline and
streaming hooks, Composer, and transcript renderers with controlled API
responses.
Nine hook cases additionally cover success, independent stream failure,
repeated reload failure and eventual recovery, a newer run, navigation,
unmount, an active run without a retained handoff, overlapping successes, and a
newer failed retry followed by an older successful response.
Final tree checks, from `web/`:
```sh
npx vitest run src/pages/ai --pool=threads --maxWorkers=1
# 22 files, 285 tests passed
npx tsc -b
files=(
src/pages/ai/hooks/useAgentRun.ts
src/pages/ai/hooks/useAgentRun.test.ts
src/pages/ai/index.tsx
src/pages/ai/__tests__/AiPage.test.tsx
)
npx eslint "${files[@]}"
npx prettier --check "${files[@]}"
git diff --check
```
All passed. Fail-before command in the baseline and #7109 worktrees:
```sh
npx vitest run src/pages/ai/__tests__/AiPage.test.tsx --pool=threads
--maxWorkers=1 \
-t replacesRetainedAnswerAfterTimelineRetrySucceedsTest
# 1 failed test, the three expected assertions fail on both production trees
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Added regression tests use `...Test` names
- [x] No new UI strings or source files; existing ASF headers retained
- [x] Independent production diff review completed
- [ ] Backend architecture suite (`mvn test`), not run for this
frontend-only change
AI assistance was used to investigate the failed-refresh recovery path,
implement and review the fix and tests, and execute verification. No live
provider or cluster was contacted.
--
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]