generated from nhcarrigan/template
fix: resolve message submission and stuck processing bugs (#199)
## Summary - **Fix `isProcessing` tracking**: The `isProcessing` store field was initialised as `false` and never set to `true` in production, making all submission guards no-ops. Now `setProcessing(true)` is called after `send_prompt` succeeds in both `handleSubmit` and `handleQuickAction`, and `setProcessingForConversation(id, false)` is called when the backend emits an idle/success/error state. - **Fix auto-granted tools dropped on permission reconnect** (closes #198): `PermissionModal.svelte` was passing only session-granted tools when reconnecting after a permission approval, silently dropping `config.auto_granted_tools`. Fixed to merge both sets, matching the behaviour of every other `start_claude` call site. - **Add mid-session watchdog**: A watchdog thread now kills the Claude Code process if a user message is sent but no `Result` arrives within 5 minutes. This triggers the existing disconnect/error flow so the user is notified and can reconnect. A generation counter ensures watchdogs from previous sessions exit cleanly when a new session starts. ## Test plan - [ ] Send a message and verify the textarea is disabled and the stop button is visible while Claude is processing - [ ] Verify the textarea re-enables after Claude finishes responding - [ ] Enable a tool in default permissions (e.g. Read), start a session, trigger a permission approval for another tool, approve it — verify the previously auto-granted tool is no longer re-prompted - [ ] Verify all existing tests pass (`./check-all.sh`) ✨ This PR was created with help from Hikari~ 🌸 Reviewed-on: #199 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #199.
This commit is contained in:
@@ -248,7 +248,7 @@
|
||||
const hasAttachments = attachments.length > 0;
|
||||
|
||||
// Need either a message or attachments to submit
|
||||
if ((!message && !hasAttachments) || isSubmitting) return;
|
||||
if ((!message && !hasAttachments) || isSubmitting || isProcessing) return;
|
||||
|
||||
// Check for slash commands first (these work even when disconnected)
|
||||
if (message && isSlashCommand(message)) {
|
||||
@@ -339,6 +339,7 @@ User: ${formattedMessage}`;
|
||||
conversationId,
|
||||
message: messageToSend,
|
||||
});
|
||||
claudeStore.setProcessing(true);
|
||||
} catch (error) {
|
||||
console.error("Failed to send prompt:", error);
|
||||
claudeStore.addLine("error", `Failed to send: ${error}`);
|
||||
@@ -768,7 +769,7 @@ User: ${formattedMessage}`;
|
||||
|
||||
async function handleQuickAction(prompt: string): Promise<void> {
|
||||
// Quick actions send the prompt directly
|
||||
if (!isConnected || isSubmitting) return;
|
||||
if (!isConnected || isSubmitting || isProcessing) return;
|
||||
|
||||
// Add to history
|
||||
addToHistory(prompt);
|
||||
@@ -793,6 +794,7 @@ User: ${formattedMessage}`;
|
||||
conversationId,
|
||||
message: prompt,
|
||||
});
|
||||
claudeStore.setProcessing(true);
|
||||
} catch (error) {
|
||||
console.error("Failed to send quick action:", error);
|
||||
claudeStore.addLine("error", `Failed to send: ${error}`);
|
||||
@@ -1018,7 +1020,7 @@ User: ${formattedMessage}`;
|
||||
placeholder={isConnected
|
||||
? "Ask Hikari anything... (type / for commands)"
|
||||
: "Connect to Claude first..."}
|
||||
disabled={isSubmitting}
|
||||
disabled={isSubmitting || isProcessing}
|
||||
rows={1}
|
||||
style="height: {textareaHeight}px; font-size: var(--terminal-font-size, 14px); font-family: var(--terminal-font-family, monospace);"
|
||||
class="w-full px-4 py-3 bg-[var(--bg-secondary)] border border-[var(--border-color)]
|
||||
|
||||
Reference in New Issue
Block a user