fix: resolve message submission and stuck processing bugs #199

Merged
naomi merged 4 commits from fix/bugs-again into main 2026-03-09 16:53:09 -07:00
Owner

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~ 🌸

## 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~ 🌸
hikari added 4 commits 2026-03-09 14:46:02 -07:00
Prevents the race condition where sending a message before the previous
turn's result message arrives caused both to be processed together,
making it appear the first message was ignored.
Closes #198 — default permissions were lost after the first permission
modal reconnect because PermissionModal only passed session-granted tools
to start_claude. Now merges auto_granted_tools from config, matching the
behaviour of every other start_claude call site.
The isProcessing field existed on conversations but was never set to true
in production code, making all submission guards effectively no-ops.

- Add setProcessingForConversation to conversations store and claude.ts
- Set isProcessing=true after send_prompt succeeds in handleSubmit and handleQuickAction
- Set isProcessing=false when claude:state emits idle, success, or error
- Add tests for the new setProcessingForConversation logic
fix: add mid-session watchdog to kill stuck Claude Code processes
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m11s
CI / Lint & Test (pull_request) Successful in 16m59s
CI / Build Linux (pull_request) Successful in 20m59s
CI / Build Windows (cross-compile) (pull_request) Successful in 31m42s
c597e8933a
Adds pending_since and watchdog_generation fields to WslBridge. When
send_message is called, pending_since is set to the current instant.
When a Result message arrives, it is cleared. A watchdog thread spawned
per session polls every 30 seconds and kills the process if pending_since
has been set for 5 minutes with no Result, triggering the existing
disconnect flow so the user gets an error message and can reconnect.
A generation counter ensures old watchdogs exit cleanly when start() is
called again for a new session.
naomi merged commit 2816e33257 into main 2026-03-09 16:53:09 -07:00
naomi deleted branch fix/bugs-again 2026-03-09 16:53:10 -07:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/hikari-desktop#199