tju-yxq opened a new pull request, #5412:
URL: https://github.com/apache/rocketmq-dashboard/pull/5412
### Which Issue(s) This PR Fixes
- Fixes #5411
### Brief Description
Adds the create-phase twin of `useAgentRun`'s double-submit guard to
`useAiSend.startRun`'s bare-route path:
- `createInFlightRef` is set on entry and held through the armed phase; a
second send in the window resolves `null`, which the caller's existing null
handling answers by restoring the prompt into the composer (same contract as a
failed create).
- The guard is released when the route settles on any conversation id (the
creation window is definitively over — further sends take the
existing-conversation path with its own downstream guard) or when the create
fails (so a failure re-arms the composer for the next attempt).
- The existing-conversation send path, the home-draft handoff and the
auto-send effect are unchanged.
### How Did You Test This Change?
```
cd web && npm test -- AiPage.test.tsx --run
Test Files 1 passed (1)
Tests 16 passed (16)
```
One new test mirrors the existing "does not admit a second send while one is
in flight" test on the bare route: with `createConversation` held pending, two
Enters in one act produce exactly one create call, and the suppressed second
prompt reappears in the composer. The 15 existing tests (stream flow,
home-draft handoff creating exactly one conversation, double-send rejection,
history navigation, tool playground) pass unchanged.
```
cd web && npm run lint
✖ 10 problems (0 errors, 10 warnings) # the trunk baseline
```
```
cd web && npx tsc -b --force
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(no new UI text)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks) (no Java changes)
- [x] New source files carry the ASF license header (no new source files)
- [ ] Documentation touched where behaviour changed (guard only)
--
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]