Conversation
| let client_guard = client.lock().await; | ||
| if let Some(event) = client_guard.recv().await { |
There was a problem hiding this comment.
🔴 Outer mutex held during blocking recv() causes deadlock when sending commands
The event loop in app.rs:44 acquires the outer Arc<Mutex<GatewayClient>> lock and then calls client_guard.recv().await, which blocks indefinitely waiting for the next server event while holding the outer lock. When the user submits a message (app.rs:66), on_submit tries to acquire the same outer lock to call chat(), but it is blocked because the event loop holds it. Since the server won't send events until a client message arrives, this creates a deadlock: the event loop waits for a server event, the submit handler waits for the lock, and the server waits for a client message. The send() and recv() methods on GatewayClient use independent internal channels (cmd_tx vs event_rx) and don't need the outer mutex — the fix would be to either split the client into separate sender/receiver handles or remove the outer Mutex.
Prompt for agents
The root cause is that GatewayClient is wrapped in Arc<Mutex<...>> (app.rs:19), but the event loop holds this mutex lock during the blocking recv() call (app.rs:44-45), preventing on_submit (app.rs:66) from acquiring it to send commands.
Fix approach: Refactor GatewayClient so that send() and recv() don't require &mut self or exclusive access. Since internally they already use separate channels (cmd_tx is an mpsc::Sender which is Clone, and event_rx is already behind its own Arc<Mutex>), you can:
1. In crates/rustyclaw-desktop/src/gateway/client.rs, make cmd_tx a tokio::sync::mpsc::Sender (already is) and remove the outer Mutex<GatewayClient> requirement.
2. In crates/rustyclaw-desktop/src/app.rs line 19, change the type from Signal<Option<Arc<Mutex<GatewayClient>>>> to Signal<Option<Arc<GatewayClient>>>.
3. In the event loop (app.rs:42-51), call client.recv().await directly without locking.
4. In on_submit (app.rs:64-71) and other handlers, call client.chat(message).await directly without locking.
5. This works because send() uses cmd_tx (cloneable Sender) and recv() uses event_rx (already behind its own internal Mutex).
Was this helpful? React with 👍 or 👎 to provide feedback.
- Add rustyclaw-desktop to workspace - Dioxus + dioxus-bulma UI framework - Gateway WebSocket client with bincode/JSON support - Components: Chat, Sidebar, MessageBubble, ToolCallPanel - Hatching dialog for first-run identity setup - Pairing dialog with QR code generation - App state management (messages, threads, connection status) Build requires GTK dev libraries: Debian/Ubuntu: libgtk-3-dev libwebkit2gtk-4.0-dev Fedora: gtk3-devel webkit2gtk3-devel Part of v0.4.0 roadmap: desktop client initiative.
- Test bind early before logging success message - Return proper error instead of continuing with broken state - Prevents misleading 'Gateway listening' logs when bind fails Fixes #136
be8c8f9 to
09566ed
Compare
- Exclude rustyclaw-desktop from cross-compilation targets (ARM/ARMv7) - Install GTK system dependencies for native Linux builds - Cross-compilation can't easily handle GTK/webkit system libraries - Desktop client still builds fine on native Linux, macOS, Windows Fixes CI failures with glib-2.0 missing on ARM cross-compilation.
--exclude only works with --workspace flag, but cross doesn't use workspace by default. Use explicit --package flags instead to build only core packages on cross-compilation targets. This should resolve the 'error: --exclude can only be used together with --workspace' issue.
Use 'matrix.use_cross == false' instead of '!matrix.use_cross' which is invalid YAML syntax in GitHub Actions.
Use libwebkit2gtk-4.1-dev instead of libwebkit2gtk-4.0-dev which doesn't exist in Ubuntu 24.04 (Noble).
Found another instance of libwebkit2gtk-4.0-dev that also needed to be updated to libwebkit2gtk-4.1-dev for Ubuntu 24.04.
The CLI crate is named 'rustyclaw' not 'rustyclaw-cli' in Cargo.toml. Fixed both test commands and cross-compilation check.
- Fix imports in gateway/mod.rs to match actual transport exports - Remove non-existent SSH type exports - Add missing uuid dependency to workspace and core - Fix error type from RustyclawError to anyhow::Error - These errors were introduced during merge conflict resolution The gateway bind error fix logic is preserved and should work correctly.
|
@copilot Can you fix the CI errors and the merge conflicts? |
Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
Fixed in commit f8fdd00. Merged
|
|
@copilot CI is failing please fix. |
Agent-Logs-Url: https://github.com/rexlunae/RustyClaw/sessions/e9ba4adc-c0ff-43ef-b361-11b8f3e4912a Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
Fixed in commit feb315b. The CI failures were all in two areas:
|
|
@copilot Still failing, please fix. |
Agent-Logs-Url: https://github.com/rexlunae/RustyClaw/sessions/3d1fcba6-0326-4b5f-a8b6-51c5eb31c07a Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
Fixed in commit 73e60c7. The remaining failures were all in
|
|
@copilot The integration tests are failing becase of this: HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing We may need to modify the test for this to work right. We'll need to be able to run the tests with the dependent libraries installed. |
…ests jobs Agent-Logs-Url: https://github.com/rexlunae/RustyClaw/sessions/56e60618-4050-466f-ae95-b252b51de53f Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
Fixed in commit a0395ba. The |
There was a problem hiding this comment.
🟡 build-release CI job missing GTK/WebKit system dependencies for desktop crate
The build-release job for native Linux (x86_64-unknown-linux-gnu, use_cross: false) runs cargo build --release on the entire workspace. Since rustyclaw-desktop is now a workspace member requiring dioxus with desktop feature (which depends on GTK/WebKit), this build will fail because the job doesn't install libgtk-3-dev and libwebkit2gtk-4.1-dev. Other jobs (check, test, integration-tests, e2e-tests) correctly install these dependencies, but build-release and lint do not. The build-release job does not have continue-on-error, so it would block release artifact creation on tag pushes.
(Refers to lines 250-255)
Was this helpful? React with 👍 or 👎 to provide feedback.
| GatewayCommand::Chat { message } => ClientFrame { | ||
| frame_type: ClientFrameType::Chat, | ||
| payload: ClientPayload::Chat { | ||
| messages: vec![ChatMessage::text("user", &message)], | ||
| }, | ||
| }, |
There was a problem hiding this comment.
🔴 Chat sends only the latest message instead of full conversation history
The command_to_frame function sends only vec![ChatMessage::text("user", &message)] — a single-element vector with just the latest user message. The gateway forwards these messages directly to the model provider (crates/rustyclaw-core/src/gateway/mod.rs:1304-1311). Without prior conversation history, the model has no context of the ongoing conversation, so every message is effectively a new standalone request.
The TUI client correctly maintains a conversation: Vec<ChatMessage> that accumulates all user and assistant messages, sending conversation.clone() with each request (crates/rustyclaw-tui/src/app/app.rs:444-451). The desktop client needs similar behavior — either accumulate messages locally or restructure the GatewayCommand::Chat to accept the full history.
Prompt for agents
The desktop client's command_to_frame function at crates/rustyclaw-desktop/src/gateway/client.rs:148-153 creates a Chat frame with only the latest user message. The gateway passes whatever messages it receives directly to the model provider, so the model loses all conversation context.
The TUI client (crates/rustyclaw-tui/src/app/app.rs:435-529) maintains a local conversation Vec<ChatMessage> that accumulates messages across the session, and clones the full history into each Chat frame.
To fix this:
1. Change GatewayCommand::Chat to carry a Vec<ChatMessage> instead of a single String
2. In app.rs on_submit handler, build the full message history from state.messages (converting the desktop ChatMessage structs to the core ChatMessage type) and pass it to the command
3. Also handle assistant responses: when GatewayEvent::ResponseDone arrives, the accumulated assistant text should be included in subsequent chat requests
4. The messages should include a system prompt as the first message, matching the TUI client behavior
Relevant files:
- crates/rustyclaw-desktop/src/gateway/protocol.rs (GatewayCommand::Chat definition)
- crates/rustyclaw-desktop/src/gateway/client.rs (command_to_frame function)
- crates/rustyclaw-desktop/src/app.rs (on_submit handler)
Was this helpful? React with 👍 or 👎 to provide feedback.
|
@copilot Two CI pipelines are still failing. If you need to modify the pipelines, you can, if you need to add feature gates to avoid causing errors, that's fine too. |
Agent-Logs-Url: https://github.com/rexlunae/RustyClaw/sessions/b6565848-4b4b-4399-8793-b1d3884e59b9 Co-authored-by: rexlunae <6726134+rexlunae@users.noreply.github.com>
Fixed in commit 6c30aa7. Both failures were linker errors: |
There was a problem hiding this comment.
🟡 CI lint job missing system dependencies for desktop crate, breaking clippy
The lint job runs cargo clippy --all-targets --all-features which now includes the rustyclaw-desktop crate (added to the workspace in this PR). However, unlike the test, integration-tests, and e2e-tests jobs, the lint job doesn't install libgtk-3-dev and libwebkit2gtk-4.1-dev. The desktop crate's Dioxus dependency with desktop feature requires these libraries to compile, so clippy will always fail on this workspace member. While continue-on-error: true masks the failure, it means clippy results for all crates (not just desktop) are silently lost.
(Refers to lines 188-204)
Was this helpful? React with 👍 or 👎 to provide feedback.
Uh oh!
There was an error while loading. Please reload this page.