feat(assistant): auto-send the fix-rule message instead of only populating the input#2907
feat(assistant): auto-send the fix-rule message instead of only populating the input#2907alexcf wants to merge 2 commits intoelie222:mainelie222/inbox-zero:mainfrom alexcf:feat/fix-rule-autosendalexcf/inbox-zero:feat/fix-rule-autosendCopy head branch name to clipboard
Conversation
…ating In the "Improve Rules" (FixWithChat) flow, after the user picks the expected rule (new / none / existing) and clicks Next, the constructed message was only written into the chat input via setInput — the user then had to manually press send. Send it automatically. Uses the provider's submitTextMessage(text), which takes the text as an argument (avoiding the setInput state-closure race), and guards on chat.status === "ready" so we never interleave with an in-flight response — in that case we fall back to populating the input as before.
|
Someone is attempting to deploy a commit to the Inbox Zero OSS Program Team on Vercel. A member of the Team first needs to authorize it. |
|
Alex Cruz Farmer seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
2 issues found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Address review feedback on the auto-send flow: - Add a submit-in-flight ref guard so the Next button can't trigger multiple sends in the brief async window before the modal closes. - Wrap submitTextMessage in try/catch: on failure, fall back to populating the chat input (so the generated text isn't lost) and report via captureException.
|
Thanks @cubic — both valid, fixed in the latest commit:
|
@alexcf Looks good — those two changes cover exactly what I flagged. The The No further concerns from me. Tip: get faster answers by chatting with cubic’s review copilot in the review UI |
bc8c655 to
65890fe
Compare
What
In the Improve Rules dialog (
FixWithChat), after the user selects the expected rule (new / none / existing) and clicks Next, the generated message is now sent automatically to the assistant instead of merely being written into the chat input for the user to send manually.Why
The extra manual "press send" step is friction — the user already expressed full intent by choosing the rule and (optionally) an explanation. Auto-sending completes the action they started.
How
FixWithChatnow pullssubmitTextMessageandchatfromuseChat().handleSubmitisasync; aftersetContext(...)and opening the sidebar it callsawait submitTextMessage(input).submitTextMessage(text)takes the message as an argument, avoiding thesetInput→ submit state-closure race (the input would otherwise still be empty on the same tick).chat.status === "ready": if a response is already streaming/submitted, it falls back to the previous behaviour (setInput(input)) so we never interleave with an in-flight message.Scope
Only the
FixWithChat("Improve Rules") flow. The separate "Edit via AI" dropdown action (which intentionally lets you tweak the prompt before sending) is unchanged.Testing
Manual: select new/none/existing rule → Next → message is sent immediately; while a response is streaming, it populates the input instead.