From b756d1e413c3691d50c772f9f061db344ff83435 Mon Sep 17 00:00:00 2001
From: RooberSmoth <96537304+RooberSmoth@users.noreply.github.com>
Date: Mon, 10 Aug 2026 15:13:53 +0900
Subject: [PATCH 5/7] Disabled send and dictate button, added 'no entry' thing
when hovering on dictate.
---
.../browser/frontend/src/components/Chat/Chat.module.css | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css b/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
index 5a5e1a094..c33028332 100644
--- a/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
+++ b/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
@@ -596,6 +596,11 @@
color: var(--color-error, #ef4444);
}
+.micCombo:disabled {
+ color: var(--text-muted);
+ cursor: not-allowed;
+}
+
.micIconWrap {
position: relative;
display: flex;
From aef2fd72c0a906b97806eaaf21a28d3d923d439f Mon Sep 17 00:00:00 2001
From: RooberSmoth <96537304+RooberSmoth@users.noreply.github.com>
Date: Mon, 10 Aug 2026 16:24:18 +0900
Subject: [PATCH 6/7] Added 30s timeout - needs testing?
---
.../frontend/src/components/Chat/Chat.tsx | 47 +++++++++++++++----
1 file changed, 38 insertions(+), 9 deletions(-)
diff --git a/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx b/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
index 2d1b14fc6..aefcbcd9b 100644
--- a/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
+++ b/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
@@ -84,6 +84,7 @@ interface SuggestedPlaybook {
}
const SUGGESTED_PLAYBOOK_COUNT = 3
+const ENHANCE_TIMEOUT_MS = 30000
// Chat-delivery actions — the ones whose visible form IS a chat bubble in
// this interface. A chunk whose only actions are these renders nothing at
@@ -321,6 +322,22 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
}, [dispatch, sessionId])
const [enhancing, setEnhancing] = useState(false)
+ // Guards against the user waiting forever if the enhance WS response
+ // never comes back. Cleared (never fires) on success, disconnect, or the
+ // draft being emptied — see the effects/handler below.
+ const enhanceTimeoutRef = useRef
| null>(null)
+
+ // Single choke point for turning enhancing off: always cancels the
+ // timeout alongside it, so success/disconnect/clear-draft paths can't
+ // leave a stale timer that fires 30s later on an already-finished request.
+ const stopEnhancing = useCallback(() => {
+ if (enhanceTimeoutRef.current !== null) {
+ clearTimeout(enhanceTimeoutRef.current)
+ enhanceTimeoutRef.current = null
+ }
+ setEnhancing(false)
+ }, [])
+
// Reply-to-bubble: set from an agent bubble's hover Reply action. The
// next send carries the quoted original so the event stream records
// which message the user replied to. No routing — session is explicit.
@@ -782,35 +799,46 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
if (enhancedPrompt === null) return
if (input.trim() === ''){
//Is the box cleared? Do not repopulate the deleted text box.
- setEnhancing(false)
+ stopEnhancing()
clearEnhancedPrompt()
return
}
setInput(enhancedPrompt)
- setEnhancing(false)
+ stopEnhancing()
clearEnhancedPrompt()
inputRef.current?.focus()
- }, [enhancedPrompt, clearEnhancedPrompt, setInput, input])
+ }, [enhancedPrompt, clearEnhancedPrompt, setInput, input, stopEnhancing])
// Deleting the draft cancels any in-flight/pending enhance and resets the
//enhance button's display state
useEffect(() => {
if (input.trim() !== '') return
- setEnhancing(false)
+ stopEnhancing()
setPlusOpen (false)
- },[input]
+ },[input, stopEnhancing]
)
// Reset enhancing spinner if the WebSocket disconnects mid-request
useEffect(() => {
- if (!connected) setEnhancing(false)
- }, [connected])
+ if (!connected) stopEnhancing()
+ }, [connected, stopEnhancing])
const handleEnhancePrompt = useCallback(() => {
if (!input.trim() || enhancing) return
setEnhancing(true)
enhancePrompt(input.trim())
- }, [input, enhancing, enhancePrompt])
+ enhanceTimeoutRef.current = setTimeout(() => {
+ enhanceTimeoutRef.current = null
+ setEnhancing(false)
+ showToast('error', 'AI enhance timed out — please try again.')
+ }, ENHANCE_TIMEOUT_MS)
+ }, [input, enhancing, enhancePrompt, showToast])
+
+ useEffect(() => {
+ return () => {
+ if (enhanceTimeoutRef.current !== null) clearTimeout(enhanceTimeoutRef.current)
+ }
+}, [])
const handleOptionClick = useCallback((value: string, messageId: string) => {
if (value === 'open_settings_model') {
@@ -1446,6 +1474,7 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
className={`${styles.micCombo}${isListening ? ` ${styles.micComboActive}` : ''}`}
title={isListening ? 'Stop listening' : 'Voice input'}
onClick={toggleListening}
+ disabled = {enhancing}
>
{isListening ? : }
@@ -1493,7 +1522,7 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
type="button"
className={styles.sendBtn}
onClick={handleSend}
- disabled={(!input.trim() && pendingAttachments.length === 0) || !attachmentValidation.valid}
+ disabled={(!input.trim() && pendingAttachments.length === 0) || !attachmentValidation.valid || enhancing}
title="Send"
aria-label="Send message"
>
From f292f47fcba681cc2805809f13c4da33d5b06e80 Mon Sep 17 00:00:00 2001
From: CraftBot
Date: Mon, 10 Aug 2026 19:51:47 +0900
Subject: [PATCH 7/7] make chat input disabled
---
.../browser/frontend/src/components/Chat/Chat.module.css | 6 ++++++
app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx | 6 +++++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css b/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
index c33028332..30dbf2d0d 100644
--- a/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
+++ b/app/ui_layer/browser/frontend/src/components/Chat/Chat.module.css
@@ -429,6 +429,12 @@
outline: none;
}
+.input:disabled {
+ color: var(--text-muted);
+ cursor: not-allowed;
+ opacity: 0.6;
+}
+
.input::placeholder {
color: var(--text-muted);
}
diff --git a/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx b/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
index aefcbcd9b..1eee03078 100644
--- a/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
+++ b/app/ui_layer/browser/frontend/src/components/Chat/Chat.tsx
@@ -806,7 +806,10 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
setInput(enhancedPrompt)
stopEnhancing()
clearEnhancedPrompt()
- inputRef.current?.focus()
+ // Defer focus: the textarea is still disabled in the DOM this tick
+ // (enhancing→false hasn't re-rendered yet), so a synchronous focus()
+ // would be ignored.
+ setTimeout(() => inputRef.current?.focus(), 0)
}, [enhancedPrompt, clearEnhancedPrompt, setInput, input, stopEnhancing])
// Deleting the draft cancels any in-flight/pending enhance and resets the
@@ -1428,6 +1431,7 @@ export function Chat({ sessionId, placeholder }: ChatProps) {
rows={1}
lang={micLang}
inputMode="text"
+ disabled={enhancing}
/>