Repository navigation
Stop and send buttons on the chat dictation bar - #7683
Conversation
Replace the check/cross pair in the chat recording bar with a stop button and the normal send button. - Stop ends the recording and leaves the transcript in the composer - Send transcribes and submits the message in one action - Escape discards a recording without transcribing
- Neutral grey in both themes; --secondary read as brand green on light and blended into --card on dark - Wider gap between stop and send, more padding around the waveform
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffe0251a35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const { text, attachments } = aui.composer().getState(); | ||
| if (text.trim().length === 0 && attachments.length === 0) return; | ||
| formRef.current?.requestSubmit(); |
There was a problem hiding this comment.
Avoid sending an existing draft after empty transcription
If dictation starts while the composer already contains text or an attachment, and the recording produces no transcript (silence or an STT failure), this check still passes and submits the pre-recording content. That contradicts the intended empty-transcript behavior and can send an unfinished draft unexpectedly; track whether this dictation actually added transcript content rather than testing the composer's total contents.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 21003f8. The old check tested the composer's total contents, so a pre-recording draft passed it and got sent on its own after an empty transcript.
Worth noting the obvious fix is also wrong: snapshotting the text when send is pressed breaks the browser engine, which streams interim results straight into the composer, so a final result identical to its interim looks like no change and would refuse to send a perfectly good transcript. It now anchors on the composer text at session start, which is what the runtime uses as the dictation base (_dictationBaseText = this._text in startDictation). Covered by unit tests in tests/dictation-send.test.ts.
| onClick={send} | ||
| disabled={transcribing !== null} |
There was a problem hiding this comment.
Defer dictation Send while attachments are uploading
When dictation is started with an attachment still uploading, this Send button remains enabled, unlike the regular send control. After transcription, handleSubmit rejects the request because hasPendingAttachments is true, but the send-after-dictation flag has already been cleared, so completion of the upload never retries the send and the click silently behaves like Stop. Disable this control under the same condition or retain the send intent until attachments finish.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 21003f8. Confirmed the path: hasPendingAttachments is any attachment with status running, shouldBlockSend includes it, and handleSubmit bails on it, so the submit was rejected after the flag had already been cleared and the click did nothing visible.
The bar now takes a sendDisabled prop set to disabled || hasPendingAttachments, so the send button greys out under exactly the same condition as the regular one. It re-enables on its own if the upload finishes mid-recording, and stop is unaffected, so the transcript still lands in the composer either way.
| if (event.key !== "Escape" || transcribingRef.current) { | ||
| return; |
There was a problem hiding this comment.
Respect Escape events handled by the open tools menu
While dictating, the + tools menu remains available; pressing Escape to close that menu reaches this window listener after the menu has handled and prevented the event, and the recording is discarded as well because defaultPrevented is ignored. This can irreversibly lose a recording during normal menu dismissal, so only cancel dictation when Escape has not already been consumed by a nested overlay.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Drops preventDefault and bails on defaultPrevented so Escape closing an open overlay no longer also cancels the recording.
Tighten the gap between the waveform and the timer, and push the timer further from the stop button.
- Empty transcript no longer submits a pre-recording draft; the send compares against the text at session start, so a final result matching the browser engine's interim still counts as new - Disable dictation send while an attachment uploads, matching the regular send, which handleSubmit would otherwise reject silently - Cover the send decision with unit tests
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21003f83e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onSend={sendAfterDictation} | ||
| // Same gate as the regular send: handleSubmit would otherwise | ||
| // reject the submit after transcription, with no way to retry. | ||
| sendDisabled={disabled || hasPendingAttachments} |
There was a problem hiding this comment.
Disable dictation Send while research is active
When a deep-research run is active, ComposerRightControls still exposes the Dictate button, so the user can enter this bar even though the normal send action has been replaced by Stop research. Because this gate ignores isResearchActive, Send remains enabled; after transcription, handleSubmit immediately prevents the submission, while sendAfterDictationRef has already been cleared, so the button silently behaves like Stop rather than sending. Disable Send for this state or preserve the send intent until research permits submission.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 8335234. Traced it: handleSubmit returns on isResearchActive before anything else, and ComposerRightControls swaps the send button for Stop research while a run is active, but the recording bar renders its own send unconditionally, so the gate never saw that state.
sendDisabled now includes isResearchActive, so the button greys out for the whole run and re-enables when it finishes. Stop is untouched, so the transcript still reaches the composer.
…he corner The mic and send arrow are filled glyphs that span their whole viewBox, so at the shared --ui-icon-size they read smaller than the stroked icons beside them. Both now opt out of that size and stay slightly above it, still tracking the UI font scale. Send, queue, cancel and dictation stop circles go from 32px to 36px, matching the plus button, and the send circle now sits 10px from the right and bottom edges so it tucks evenly into the composer's 32px corner. Compare gets the same treatment. Also drops two comments describing the discard button this branch removed.
|
Pushed a follow-up to the composer controls. SizingThe mic and the send arrow are filled glyphs that span their entire viewBox, so at the shared Both glyphs now opt out through their own classes and sit slightly above the shared size, still tracking the UI font scale:
The send, queue, cancel and dictation stop circles go from Corner fitThe send circle sat 14px from the right edge and 12px from the bottom, which read as floating rather than tucked in. It now sits 10px from both, so it nests evenly inside the 32px corner radius. With a 36px circle at that inset, the furthest point of the circle stays roughly 24px from the corner arc's centre against a 32px radius, so it stays clear of the curve at every angle including the diagonal. The bottom gap comes from the surface's CompareCompare's composer sits under Also dropped two comments that still described the discard button this branch removed.
|
Gemini-style breathing room rather than the tighter tuck: the circle sits 12px from the right and bottom edges in both composers, still even on both axes inside the 32px corner.
|
Adjusted the corner gap in This puts the single composer's surface padding back to a plain |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a7c7fc00e0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| onSend={sendAfterDictation} | ||
| // Same gate as the regular send: handleSubmit would otherwise | ||
| // reject the submit after transcription, with no way to retry. | ||
| sendDisabled={disabled || hasPendingAttachments} |
There was a problem hiding this comment.
Disable dictation Send for non-queueable content
When a response or prompt queue is active and the composer already contains a completed attachment or pending audio, this gate leaves dictation Send enabled. After transcription, handleSubmit reaches the queue path, rejects the prompt because only text can be queued, and clears the send intent, so the button merely stops dictation despite presenting itself as Send. Keep Send unavailable in these non-queueable states, or preserve the intent until the content can be submitted.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 8335234. Confirmed the path: with threadIsRunning or promptQueueActive, handleSubmit takes the queue branch, and canQueueCurrentPrompt is false when an attachment, pending audio or an image overlay is present, so it toasts and returns with the intent already cleared.
The gate now covers it, but not by reusing canQueueCurrentPrompt directly, which would have been wrong: that also requires composerText.trim().length > 0, and the composer is empty exactly when you start dictating, so send would have been disabled for the ordinary case this branch is meant to support. It checks only the content conditions, leaving text presence to the transcript:
(threadIsRunning || promptQueueActive) &&
(disableQueue || Boolean(overlay) || hasAttachments || hasPendingAudio)
disableQueue is in there for the project composer, which never queues and just asks the user to wait. Plain text dictation while a response runs still queues as before.
| if (!dictationProducedText(dictationBaseTextRef.current, text)) return; | ||
| formRef.current?.requestSubmit(); |
There was a problem hiding this comment.
Do not submit partial transcripts after transcription errors
When transcription fails after at least one chunk has succeeded, both dictation adapters can end with an error while still publishing the partial transcript: the model adapter explicitly keeps successful segments after a segment failure, and the browser adapter retains finalized chunks before a later recognition error. This check treats any resulting text change as success and immediately submits the incomplete message, even though an error toast reports that content was lost; require a successful dictation completion before honoring the send intent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 8335234, and worth spelling out because the two engines fail differently.
The browser one matches the description exactly: a non-aborted recognition error toasts and calls finish("error"), and finish only blanks the transcript for cancelled, so any finalized chunks are published.
The local model one does not end with an error at all. A segment that fails to transcribe goes through reportTranscriptionError, which toasts and keeps going, and the session still ends finishSession("stopped", buildTranscript()) with the segments that did succeed. So checking the end reason would have caught the browser case and missed this one.
Both now report through a small dictation-outcome module: the adapters clear it when a session starts and flag it when a chunk or the session fails, and the recording bar checks it before honouring the send. It is module state rather than session state because the bar reads it after the session object is gone. Stop is unaffected, so a partial transcript still lands in the composer to edit or discard, alongside the toast saying what was lost. Unit tests in tests/dictation-outcome.test.ts.
#7400 folded every glyph with a 16px or larger base into --ui-icon-size, which took the composer plus from 22px down to 16px at the default UI font size. It now renders at 1.375x the token, which is the same curve a 22px base follows, so the size is back where it was and only its scaling changed.
|
Restored the composer plus button in It was not this branch that shrank it. #7400 folded every glyph with a 16px or larger base into It now renders at |
|
@codex review |
Hover backgrounds on the sidebar search and collapse buttons and on the chat header's temporary chat, research and run settings buttons are now circles. The sidebar pair squares off at 28px, its previous width, so the spacing between them does not move. The header group also loses 4px of gap: gap-1 plus the 2px nudge that pushed the run settings button right, leaving 4px between the circles. Temporary chat drops two redundant markers: the greeting mascot, so the title stands alone, and the green Temporary pill, since the header toggle already turns green and the welcome copy explains the mode.
|
Pushed Round hoversThe hover background on the sidebar search and collapse buttons, and on the chat header's temporary chat, research activity and run settings buttons, is now a circle instead of a rounded square. This matches the close button inside the run settings sheet, which was already round. The two sidebar buttons were 33px tall by 28px wide, so Header spacingThe header button group tightens from Temporary chatTwo redundant indicators are gone:
|
…ipts Send was only gated on disabled and pending attachments, so it stayed live in states handleSubmit rejects: an active research run, and a running response or prompt queue holding an attachment, pending audio or an image overlay. The intent was already spent by then, so the click quietly acted as stop. It now covers each of those, leaving out the text check since the transcript supplies it. Both engines can also end holding a partial transcript, the browser one through a recognition error and the local model one when a segment fails to transcribe. That text still belongs in the composer, but send no longer fires on it. The adapters flag the failure and the recording bar reads it after the session is gone.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8335234495
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if ( | ||
| event.key !== "Escape" || | ||
| event.defaultPrevented || | ||
| transcribingRef.current |
There was a problem hiding this comment.
Let Escape cancel a pending transcription
When a local-model STT request is slow or never returns, this condition ignores Escape after Stop or Send has started; both visible buttons are also disabled while transcribing is non-null. Since cancelActiveStudioDictation() is the available path that aborts the model adapter's in-flight request, the composer can otherwise remain stuck on the spinner until the request completes or the user leaves/reloads the page.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 8bcc3c1. Checked the cancel path first: the model adapter's cancel() calls abortController.abort(), which is the signal passed to transcribeAudioBlob, then finishSession("cancelled"), which publishes no transcript and resolves the pending stop(). So Escape genuinely recovers a stalled request rather than leaving it running.
The handler now only skips on defaultPrevented, so it stays live while transcribing. A cancel there emits no transcript, so a pending send sees no text change and submits nothing.
The tradeoff is that an Escape during the browser engine's short finalization grace now discards a good recording instead of being ignored. That seems the better side of the trade, given the alternative is a spinner with both buttons disabled and no way out.
| if (!sendAfterDictationRef.current) return; | ||
| sendAfterDictationRef.current = false; |
There was a problem hiding this comment.
Bind the pending send to its originating thread
The fresh case beyond the earlier same-composer draft issue is thread navigation: chat-page.tsx deliberately reuses SingleContent while switching thread IDs, so moving to another thread during transcription can make this component observe isDictating === false before the originating session finishes. The pending ref then targets the newly active form; if that thread has a different saved draft, dictationProducedText accepts the difference and submits that draft, while an empty destination merely consumes the intended send. Preserve the originating thread/session identity and only submit after that session completes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 8bcc3c1. Confirmed the premise: SingleContent is keyed by view.projectId ?? "single", not by thread, and the comment there says so explicitly, so switching threads reuses the composer in place. The reused component then sees isDictating go false against the destination thread's composer, with the base text still anchored to the origin thread, so a different draft there reads as produced text and submits.
The pending send now records the composer it started in, as threadListItemId:referenceThreadId, and shouldSubmitDictation drops the intent when that no longer matches. Dropping rather than deferring is deliberate: by then the transcript has landed in the origin thread's composer, where it stays as a draft to send manually.
The list item id is in the key so fresh local threads are distinguished too, not just saved ones. Unit tests in tests/dictation-send.test.ts.
| if (reportedTranscriptionError || cancelled || ended) return; | ||
| reportedTranscriptionError = true; | ||
| // Transcribed segments are kept, so the send must not fire on them. | ||
| markDictationFailed(); |
There was a problem hiding this comment.
Do not mark speculative preloading as transcript loss
When the speculative loadSttModel() call later in this adapter fails transiently, it invokes this same reportTranscriptionError function and therefore sets the new failure flag even though no recorded segment was lost. The subsequent transcribeAudioBlob() request performs its own model load and can still return the complete transcript after the transient condition clears, but the composer then sees dictationFailed() and silently declines the requested Send. Only segment transcription failures should mark the outcome as partial.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and this one was mine from the previous round. reportTranscriptionError is also the catch handler for the speculative loadSttModel() warm-up, so a transient preload failure set the flag even though no audio was lost, and transcribeAudioBlob would then load the model itself and return a complete transcript that send quietly refused.
Fixed in 8bcc3c1 by moving markDictationFailed() out of the reporter and into the segment catch, so only a lost segment marks the outcome partial. The preload still toasts as before.
The composer is reused across thread switches, so a send pressed in one thread could land after a move to another and submit that thread's draft. The pending send now records the composer it started in and drops the intent when it no longer matches. The failure flag moves off reportTranscriptionError, which is also the catch for the speculative model preload: that can fail transiently without costing any audio, and a complete transcript would then refuse to send. Only a lost segment marks the outcome partial now. Escape stays live while transcribing. Cancel aborts the in-flight request and both buttons are disabled, so it is the only way out of a stalled one.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bcc3c19b5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const dictationComposerRef = useRef(""); | ||
| // Thread switches reuse this composer, so the send has to know where it | ||
| // started to avoid submitting the destination thread's draft. | ||
| const composerIdentity = `${threadListItemId ?? ""}:${referenceThreadId ?? ""}`; |
There was a problem hiding this comment.
Keep composer identity stable during thread hydration
When dictation starts in a newly created chat while its first run is still being persisted, threadListItemId remains stable but referenceThreadId changes from null to the initialized remote ID: runtime-provider.tsx updates activeThreadId when threadListItem.initialize() resolves. This makes the same logical composer appear to have switched identities, so shouldSubmitDictation rejects the pending Send and leaves the transcript unsent. Base the guard on a stable thread-list item/session identity or normalize the local and remote aliases.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and this was mine from the previous round. Traced it: append calls threadListItem().initialize() and sets activeThreadId to the resolved remote id, so on a new chat referenceThreadId goes from null to that id while the composer never changes. The composite key moved with it and dropped the send.
Fixed in 1d3742f by keying on the thread list item id alone. That one cannot move here: the runtime initializes with state.id, and this adapter returns { remoteId: threadId }, so the remote id is literally the same string it was given. Whatever the list core does with the alias, the value is unchanged, and the id is still distinct per thread, so the original thread-switch guard still holds.
Added a test pinning the hydration case so the identity cannot quietly regain a moving part.
referenceThreadId moves from null to the remote id when a new chat first persists, so the composite identity changed under the same composer and dropped a perfectly good send. The thread list item id does not move: the adapter initializes with the id the runtime passes in and returns it as the remote id, so both sides are the same string.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d3742f1ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| className="aui-branch-chevron-btn" | ||
| > | ||
| <ChevronLeftIcon strokeWidth={1.25} className="size-[36px]" /> | ||
| <ChevronLeftIcon strokeWidth={1.25} className="size-9" /> |
There was a problem hiding this comment.
Preserve UI-scale handling for branch chevrons
When the Appearance UI font scale differs from its default, changing these icons from size-[36px] to the equivalent size-9 stops them from scaling: the glyph-scaling rules in index.css explicitly match svg.size-[36px] but have no selector for svg.size-9. Consequently both branch chevrons remain fixed at 36px while the adjacent branch count and other thread icons shrink or grow; retain the recognized class or add size-9 to the scaling rule.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and mine: the rename to size-9 was meant for the send circles and caught these two glyphs with them.
Measured it against the built stylesheet rather than reasoning about the selector, rendering both classes inside .aui-root at two scales:
ui-font-scale 1.25: size-9 = 36.0px | size-[36px] = 40.5px
ui-font-scale 0.75: size-9 = 36.0px | size-[36px] = 27.0px
So they were pinned at 36px while the branch counter next to them moved, which is the proportional scaling #7400 added for exactly these chevrons. Reverted to size-[36px] in 1d4cd7f.
Audited the rest of the rename while I was there: every other size-9 on this branch is on a button, and the block only rewrites svg selectors, so hit targets are unaffected either way.
Renaming the send circles to size-9 also caught the two branch picker chevrons, which are glyphs, not buttons. index.css scales svg.size-[36px] through the 36px curve and has no size-9 selector, so they froze at 36px while the counter beside them kept tracking the UI font size. Measured against the built stylesheet: at scale 1.25 the class renders 40.5px and size-9 renders 36px, at 0.75 it is 27px against the same 36px. Every other size-9 on this branch is a button, which the glyph rules do not touch.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d4cd7f219
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Text at session start is the dictation base. Anchor on it, not on the | ||
| // text when send was pressed: the browser engine streams interim results | ||
| // into the composer, so a final matching its interim would look unchanged. | ||
| dictationBaseTextRef.current = aui.composer().getState().text; |
There was a problem hiding this comment.
Track transcript output instead of all composer changes
The fresh case not covered by the pre-recording-draft fix is a composer edit made during recording: the + menu remains enabled while dictating, and choosing a recent or saved prompt calls aui.composer().setText(...). With a silent recording, that menu-driven change still differs from this session-start snapshot, so shouldSubmitDictation treats it as dictated text and Send submits the prompt despite receiving no transcript. Track actual transcript production, or prevent unrelated composer mutations from satisfying this comparison.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in e8bc309. Confirmed the path: ComposerToolsMenu renders in the composer line regardless of isDictating, and its recent prompt items call aui.composer().setText(p.text), so a silent recording plus a menu insertion looked exactly like dictated text to a comparison of composer contents.
Rather than special-casing the menu, the signal now comes from the source. Both engines publish exactly one final transcript, each behind a guard (if (transcript) in the browser adapter, if (reason !== "cancelled" && corrected) in the model one), so they record that and the send requires it.
Kept the text comparison alongside it rather than replacing it. The two answer different questions: the flag is module state, so a transcript published into some other composer would set it, and the text check is what proves this composer received it. Together they keep the earlier pre-recording-draft guarantee intact.
Tests in tests/dictation-send.test.ts cover the insertion with and without speech, and tests/dictation-outcome.test.ts covers the partial case where a session both published and lost text.
Comparing composer text could not tell speech from an edit: the plus menu stays open while recording, so inserting a saved prompt looked like dictated text and a silent recording would submit it. Both engines publish exactly one final transcript, each behind a guard, so they now record that directly and the send requires it. The text comparison stays as well, so a transcript that never reached this composer still cannot send the draft that was already there.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8bc309b1d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sendDisabled={ | ||
| disabled || | ||
| hasPendingAttachments || |
There was a problem hiding this comment.
Preserve Send when an upload starts during transcription
The fresh case beyond the earlier pending-attachment fix is an attachment added after Send is pressed: the + menu remains enabled while the transcription spinner is running, so the user can start an upload after this pre-click gate has passed. When transcription finishes, handleSubmit rejects the request because hasPendingAttachments is now true, but sendAfterDictationRef has already been cleared, so finishing the upload never retries the send and the button silently behaves like Stop. Disable attachment mutations while Send is pending or retain the intent until the upload completes.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 292fe97. Confirmed the path: the plus menu renders regardless of isDictating and its file item calls aui.composer().addAttachment(file), so an upload can start after the pre-click gate has passed, and shouldBlockSend then rejects the submit with the intent already cleared.
Took the second option and kept the intent instead of freezing the menu. hasPendingAttachments is now a dependency of the effect, and the intent is left set while it is true, so the send fires by itself once the upload lands. That matches how a typed send already behaves for document indexing.
Two consequences of adding that dependency, handled in the same commit rather than left to bite later:
- The effect now reruns mid-session, so session start is tracked explicitly and the base text is captured once per recording rather than on every rerun.
- A held send would otherwise have fired on the next recording's stop. A new recording now clears it, so the text just stays in the composer to send by hand.
The plus stays live during transcription, so an attachment started after send was pressed made handleSubmit reject a submit whose intent was already spent. The intent is now kept until the upload lands, and the effect reruns on it, so the message sends by itself. Session start is tracked explicitly with that dependency added: the base text is captured once per recording rather than on every rerun, and a new recording clears a send still held for an upload rather than firing it on the next stop.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 292fe97b5d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // The plus stays live while transcribing, so an upload can start after | ||
| // send was pressed. handleSubmit would reject it, so hold the intent | ||
| // (still set) until the upload lands and this effect runs again. | ||
| if (hasPendingAttachments) return; |
There was a problem hiding this comment.
Preserve Send after a newly added upload completes
The remaining case after the earlier pending-upload fix occurs when a response or prompt queue is active: the user can press dictation Send with queueable text-only content, add a small attachment through the still-enabled + menu, and have its upload finish before transcription. Since the attachment is no longer pending, this check clears the send intent and calls requestSubmit; handleSubmit then rejects the now non-queueable attachment, and nothing retries when the queue finishes. Retain the intent until the content becomes sendable, or prevent attachment additions while dictation Send is pending.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 35a7e48. The root cause was that the button gate and the hold had drifted into two different expressions, so the hold only knew about uploads while the gate also knew about queueability. An attachment that finished uploading before transcription cleared the hold and left content that cannot be queued.
Both now read one predicate, dictationSendBlocked, and a pending send waits on it rather than being spent on a submit that would bounce. Extracting it also surfaced that disabled and disableQueue are optional props that the old inline || had been quietly absorbing.
Reordered while I was in there: whether there is anything to send is settled before the hold, so a silent or cancelled recording clears the intent immediately instead of leaving it parked behind a block it will never satisfy.
Truth table tests in tests/dictation-send.test.ts, including the row this comment describes: a run active, upload finished, attachment present.
| return; | ||
| } | ||
| cancelActiveStudioDictation(); | ||
| }; |
There was a problem hiding this comment.
Provide a touch-accessible cancellation path
On phones and tablets without a hardware keyboard, this Escape listener is not usable, yet the former on-screen discard button has been removed: Stop always transcribes and Send transcribes and submits. The problem is worse once transcription begins because both visible buttons are disabled, making Escape the only way to abort a stalled model request. Preserve an on-screen cancel/discard action for touch users rather than making cancellation keyboard-only.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in 35a7e48. Keyboard-only cancellation was a real gap, and it is worse mid-transcription where both buttons were disabled.
Rather than bringing the cross back, stop now discards on a second press once transcription starts, which is exactly what Compare's dictation button already does: "A second click while the final segment is transcribing discards the pending transcription instead of leaving the pane stuck until timeout." Same behaviour, same wording on the tooltip and the aria-label, so the two composers match.
That keeps the two-button layout this PR is about while giving touch a way out, both of a stalled model request and of an unwanted recording. Escape still works and is unchanged.
…reach The button gate and the pending send disagreed: an attachment added after the press could finish uploading before transcription, clearing the hold while leaving content that cannot be queued, so the submit bounced and the intent was gone. Both now read one predicate, dictationSendBlocked, and a pending send waits on it rather than being spent. Nothing-to-send is settled first, so a silent or cancelled recording never leaves an intent pending. Stop also discards on a second press once transcription starts, which is what Compare's dictation button already does. Escape was otherwise the only way to abort a stalled request, and touch has no way to press it.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35a7e481d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // The plus stays live while transcribing, so an upload or an attachment | ||
| // can appear after the press. Keep the intent until the composer accepts | ||
| // a submit again, rather than spending it on one that would bounce. | ||
| if (dictationBlocked) return; |
There was a problem hiding this comment.
Expose or cancel the held dictation send
When transcription finishes while a newly added upload or non-queueable active run still blocks submission, this return keeps the send intent only in a ref after the recording bar has disappeared. The composer is editable again with no pending indicator or cancel action; if the user replaces the transcript with another nonempty draft, shouldSubmitDictation still accepts it because it only differs from the session's base text, and clearing the blocker then submits that replacement automatically. Cancel the intent on subsequent composer edits or represent it as a visible, cancellable pending send.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in c2ea404. The hold I added last round has no bar and no indicator behind it, and the base-text comparison it relies on was taken at session start, so any later non-empty draft still satisfied it and would go out when the block cleared.
Went with cancelling on edit rather than a pending-send UI. The composer text is recorded when the send is first held, and any change releases the intent, so the hold lasts only as long as the transcript it was pressed for. Touching the composer hands control back to the user, and the transcript stays put to send by hand.
The effect now reruns on composerText and reads that value rather than a fresh getState of the same thing, which also cleared the lint error the extra dependency raised (b3c5c95).
The fuller version of your second suggestion, a visible cancellable pending send, is still open. There is already infrastructure for it in this file: enqueueSend parks a send behind document indexing and shows a toast with a Cancel action. Routing the dictation hold through that would give it an indicator too, but it means generalising a path that is currently indexing-specific, so I would rather do it deliberately than fold it into this branch.
The recording bar is gone while a send waits on a block, so the hold has no indicator and no cancel. Replacing the transcript with another draft still satisfied the base-text comparison, so clearing the block sent that draft. The hold now lasts only as long as the transcript it was pressed for: the text is recorded when the send is first held, and any edit releases it.
…fect The effect reruns on composerText to notice edits, so it should read that rather than a fresh getState of the same value. Also clears the lint error the extra dependency raised.
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Lay toasts out on a grid so a long message and its action button get their own rows instead of competing for one, and drop the absolute positioning the cancel button used to need. The model loading toast keeps its dedicated progress bar spacing from unslothai#7683. The Firefox voice typing toast now uses Sonner's action instead of a hand rolled button in the description, so it flows through the same layout.
Lay toasts out on a grid so a long message and its action button get their own rows instead of competing for one, and drop the absolute positioning the cancel button used to need. The model loading toast keeps its dedicated progress bar spacing from #7683. The Firefox voice typing toast now uses Sonner's action instead of a hand rolled button in the description, so it flows through the same layout. Co-authored-by: Unsloth <[email protected]>
Bring in unslothai/unsloth main through unslothai#7755 after the recent unslothai#7683 sync. Preserve the train-page model and dataset preflight, cached resource pins, MLX validation, local fix commits, and the PR-side UI/UX work. Carry upstream's persistent advanced-settings preference, inventory exports, desktop training guard, and generalized native file filters into the reworked flows.
The voice recording bar in chat currently ends with a check and a cross. This swaps them for the two controls people expect from other chat apps: a stop button and the normal send button.
Behaviour
Notes
The send path stops dictation, waits for the transcript to reach the composer, then submits through the composer form rather than calling
composer.send()directly. That keeps prompt queueing while a response is running, the hold on sending while documents index, and draft clearing behaving exactly as they do for a typed message. An empty transcript (silence, or a failed round trip) sends nothing and leaves the composer alone.The stop button sets its own neutral grey rather than using the
secondaryvariant:--secondaryis brand green on the default light palette, and sits too close to--cardto read on dark. The waveform also gets more padding, and the two buttons a wider gap between them.Testing
npm run typecheck,npm run buildandnpm test(78 passing) instudio/frontend.