Summary
The SendBox currently clears the composer immediately before awaiting onSend(). If onSend() resolves with false, the submitted prompt is restored. However, if onSend() rejects, the rejection path is swallowed and the submitted prompt is not restored.
This creates a prompt-loss path for asynchronous send failures, which is especially painful for long coding prompts or detailed task instructions.
Current behavior
Current SendBox flow on main is effectively:
setInput('');
onSend(finalMessage)
.then((result) => {
if (result === false) {
setInput(finalMessage);
}
})
.catch(() => {})
.finally(() => {
setIsLoading(false);
});
So there are three materially different outcomes:
| Outcome |
Current result |
onSend() succeeds |
Composer remains cleared |
onSend() resolves false |
Submitted prompt is restored |
onSend() rejects |
Error is swallowed; submitted prompt can be lost |
Expected behavior
A failed send should never silently destroy user-authored input.
- Successful send: composer stays cleared.
onSend() returning false: existing restoration behavior remains.
onSend() rejecting: submitted prompt remains recoverable.
- A delayed failure must not overwrite newer text the user typed after initiating the send.
Proposed implementation direction
Keep the existing optimistic clear behavior, but make failed-send recovery race-safe.
Track whether the composer has changed since the submitted message was cleared. On rejection:
- restore
finalMessage when the composer is still in the post-send empty state;
- do not overwrite newer user input;
- preserve the existing
false return behavior;
- keep successful sends unchanged.
No AionCore change should be required.
Tests
Add focused regression tests covering:
- successful send keeps the composer cleared;
false result restores the submitted prompt;
- rejected send restores/recoverably preserves the submitted prompt;
- rejected send does not overwrite new text typed while the request was pending;
- Enter-key and send-button paths behave consistently.
Scope
Renderer / SendBox only.
Related context
Contribution / campaign note
I would be happy to implement this with focused regression tests. If this is suitable for the AionUi x Kimi contributor campaign, please mark/convert it to a bonus issue and assign it to me before I open the PR, so I can follow the required contribution flow.
Summary
The SendBox currently clears the composer immediately before awaiting
onSend(). IfonSend()resolves withfalse, the submitted prompt is restored. However, ifonSend()rejects, the rejection path is swallowed and the submitted prompt is not restored.This creates a prompt-loss path for asynchronous send failures, which is especially painful for long coding prompts or detailed task instructions.
Current behavior
Current
SendBoxflow onmainis effectively:So there are three materially different outcomes:
onSend()succeedsonSend()resolvesfalseonSend()rejectsExpected behavior
A failed send should never silently destroy user-authored input.
onSend()returningfalse: existing restoration behavior remains.onSend()rejecting: submitted prompt remains recoverable.Proposed implementation direction
Keep the existing optimistic clear behavior, but make failed-send recovery race-safe.
Track whether the composer has changed since the submitted message was cleared. On rejection:
finalMessagewhen the composer is still in the post-send empty state;falsereturn behavior;No AionCore change should be required.
Tests
Add focused regression tests covering:
falseresult restores the submitted prompt;Scope
Renderer / SendBox only.
Related context
onSend()rejects.Contribution / campaign note
I would be happy to implement this with focused regression tests. If this is suitable for the AionUi x Kimi contributor campaign, please mark/convert it to a
bonusissue and assign it to me before I open the PR, so I can follow the required contribution flow.