From 76d492aa757dcc4e6ae7850b614708a0aeb8965c Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Tue, 15 Sep 2026 14:25:00 -0500 Subject: [PATCH] Improve agent prompting and classifier latency; clean up build warnings --- Cargo.toml | 3 + app/src/ai/agent/api/convert_conversation.rs | 2 + app/src/ai/agent/conversation.rs | 16 ++ app/src/ai/agent/linearization.rs | 2 +- app/src/ai/agent/mod.rs | 5 +- .../ai/blocklist/block/secret_redaction.rs | 2 +- app/src/ai/blocklist/context_model.rs | 10 +- app/src/ai/blocklist/controller.rs | 19 ++- app/src/ai/blocklist/history_model.rs | 3 + .../blocklist/inline_action/code_diff_view.rs | 6 +- .../inline_action/suggested_unit_tests.rs | 2 +- app/src/ai/blocklist/input_model.rs | 2 +- .../ai/blocklist/passive_suggestions/maa.rs | 3 +- app/src/ai/execution_profiles/profiles.rs | 2 +- app/src/ai/runtime/rig.rs | 20 +++ app/src/ai/runtime/rig_request.rs | 41 ++++- app/src/ai/runtime/rig_request_tests.rs | 22 +++ app/src/ai/runtime/rig_tests.rs | 24 ++- app/src/ai/runtime/rig_tool.rs | 8 +- app/src/ai/runtime/rig_tool_tests.rs | 30 ++++ app/src/autoupdate/mac.rs | 16 +- app/src/code/editor/diff.rs | 2 +- app/src/context_chips/display_chip.rs | 5 +- app/src/drive/export.rs | 2 +- app/src/editor/view/model/buffer/mod.rs | 10 +- app/src/external_secrets/mod.rs | 6 +- app/src/integration_testing/agent_mode/mod.rs | 2 +- app/src/integration_testing/terminal/step.rs | 2 +- app/src/notebooks/editor/embedding_model.rs | 8 +- app/src/pane_group/mod_tests.rs | 1 + app/src/persistence/block_list.rs | 2 +- app/src/search/action/search_item.rs | 3 +- .../command_palette/files/search_item.rs | 2 +- .../external_secret_search_item.rs | 2 +- app/src/search/files/model.rs | 7 +- .../cloud_objects/update_manager_tests.rs | 24 +-- app/src/server/server_api.rs | 4 +- app/src/server/sync_queue.rs | 2 +- app/src/settings_view/features_page.rs | 4 +- app/src/terminal/find/model.rs | 2 +- app/src/terminal/input.rs | 2 +- app/src/terminal/input/conversations/view.rs | 2 +- .../input/slash_commands/data_source/mod.rs | 2 +- app/src/terminal/model/ansi/mod.rs | 5 +- app/src/terminal/model/blocks.rs | 2 +- app/src/terminal/model/blocks/selection.rs | 143 +++++++++--------- .../in_band_command_executor.rs | 2 +- app/src/terminal/profile_model_selector.rs | 2 +- app/src/terminal/ssh/util.rs | 4 +- app/src/terminal/view/load_ai_conversation.rs | 1 + app/src/terminal/view/ssh_file_upload.rs | 2 +- app/src/test_util/virtual_fs.rs | 2 +- app/src/util/openable_file_type.rs | 2 +- app/src/workspace/view.rs | 8 +- crates/ai/src/diff_validation/mod.rs | 4 +- .../codebase_index.rs | 2 +- crates/editor/src/content/markdown.rs | 2 +- crates/editor/src/render/model/mod.rs | 4 +- .../src/signatures/legacy/registry.rs | 2 +- crates/galaxyui/src/platform/mac/event.rs | 8 +- crates/galaxyui_core/src/core/app.rs | 6 +- crates/graphql/src/client.rs | 2 +- .../src/heuristic_classifier/mod.rs | 2 +- crates/integration/src/util.rs | 2 +- crates/ipc/src/testing.rs | 2 +- crates/persistence/src/model.rs | 3 + crates/persistence/src/model_tests.rs | 19 +++ crates/simple_logger/src/lib.rs | 6 +- crates/virtual_fs/src/lib.rs | 2 +- 69 files changed, 368 insertions(+), 205 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 62428508..dda14c00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -430,6 +430,9 @@ debug = 1 split-debuginfo = "packed" [profile.dev] +# Optimize the large debug binary to keep its unwind tables within macOS's +# compact-unwind offset limit, while retaining debug assertions and symbols. +opt-level = 2 # Use line-tables-only to speed up dev builds. Change to `debug = true` if you # need full debuginfo for step-through debugging (gdb/lldb). debug = "line-tables-only" diff --git a/app/src/ai/agent/api/convert_conversation.rs b/app/src/ai/agent/api/convert_conversation.rs index afef7244..0132c15f 100644 --- a/app/src/ai/agent/api/convert_conversation.rs +++ b/app/src/ai/agent/api/convert_conversation.rs @@ -75,6 +75,7 @@ pub fn convert_conversation_data_to_ai_conversation( agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: usage_metadata, reverted_action_ids: None, @@ -100,6 +101,7 @@ pub fn convert_conversation_data_to_ai_conversation( agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: Some( metadata.server_conversation_token.as_str().to_string(), ), diff --git a/app/src/ai/agent/conversation.rs b/app/src/ai/agent/conversation.rs index 0639d66c..2a719987 100644 --- a/app/src/ai/agent/conversation.rs +++ b/app/src/ai/agent/conversation.rs @@ -234,6 +234,7 @@ pub struct AIConversation { /// Opaque, versioned snapshot of the active direct-provider run. active_provider_run_json: Option, local_agent_groups: Vec, + tool_titles: HashMap, /// The server-generated unique "token" for this conversation. /// @@ -389,6 +390,7 @@ impl AIConversation { agent_backend, active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: HashMap::new(), server_conversation_token: None, task_id: None, forked_from_server_conversation_token: None, @@ -547,6 +549,10 @@ impl AIConversation { (task_store, todo_lists, status) }; + let tool_titles = conversation_data + .as_ref() + .map(|data| data.tool_titles.clone()) + .unwrap_or_default(); let local_agent_groups = conversation_data .as_ref() .map(|data| data.local_agent_groups.clone()) @@ -682,6 +688,7 @@ impl AIConversation { agent_backend, active_provider_run_json, local_agent_groups, + tool_titles, server_conversation_token, task_id: run_id.as_deref().and_then(|id| id.parse().ok()), forked_from_server_conversation_token, @@ -725,6 +732,14 @@ impl AIConversation { &self.agent_backend } + pub(crate) fn tool_titles(&self) -> &HashMap { + &self.tool_titles + } + + pub(crate) fn set_tool_title(&mut self, action_id: &AIAgentActionId, title: String) { + self.tool_titles.insert(action_id.to_string(), title); + } + pub(crate) fn local_agent_groups(&self) -> &[LocalAgentGroup] { &self.local_agent_groups } @@ -4050,6 +4065,7 @@ impl AIConversation { agent_backend: self.agent_backend.clone(), active_provider_run_json: self.active_provider_run_json.clone(), local_agent_groups: self.local_agent_groups.clone(), + tool_titles: self.tool_titles.clone(), server_conversation_token: self .server_conversation_token .clone() diff --git a/app/src/ai/agent/linearization.rs b/app/src/ai/agent/linearization.rs index bc86ff8a..4accd907 100644 --- a/app/src/ai/agent/linearization.rs +++ b/app/src/ai/agent/linearization.rs @@ -80,7 +80,7 @@ pub fn compute_active_task_ids<'a>( /// missing task are assigned depth 0. pub fn compute_task_depths(tasks: &HashMap) -> HashMap<&str, usize> { let mut depths = HashMap::new(); - for (task_id, _) in tasks.iter() { + for task_id in tasks.keys() { let mut depth = 0; let mut current_id: &str = task_id; let mut visited = HashSet::new(); diff --git a/app/src/ai/agent/mod.rs b/app/src/ai/agent/mod.rs index a4d63026..f835f36a 100644 --- a/app/src/ai/agent/mod.rs +++ b/app/src/ai/agent/mod.rs @@ -1211,10 +1211,7 @@ impl<'a> std::fmt::Display for MarkdownActionResult<'a> { match self.0 { AIAgentActionResultType::RequestCommandOutput(result) => match result { RequestCommandOutputResult::Completed { - command, - output, - exit_code: _, - .. + command, output, .. } => { write!( f, diff --git a/app/src/ai/blocklist/block/secret_redaction.rs b/app/src/ai/blocklist/block/secret_redaction.rs index ec747dd0..e6e75e52 100644 --- a/app/src/ai/blocklist/block/secret_redaction.rs +++ b/app/src/ai/blocklist/block/secret_redaction.rs @@ -504,7 +504,7 @@ impl SecretRedactionState { // the case where a secret is split across streaming chunks. let combined_text = format!( "{}{}", - &self.last_word_to_rescan_for_redaction, + self.last_word_to_rescan_for_redaction, &text[self.last_scanned_secret_redaction_byte_index..] ); let secret_ranges_with_levels = diff --git a/app/src/ai/blocklist/context_model.rs b/app/src/ai/blocklist/context_model.rs index 858da3c5..4476a17b 100644 --- a/app/src/ai/blocklist/context_model.rs +++ b/app/src/ai/blocklist/context_model.rs @@ -729,14 +729,8 @@ impl BlocklistAIContextModel { ) -> Option<&'a AIAgentTodoList> { self.selected_conversation(ctx) .and_then(|c| c.active_todo_list()) - .and_then(|todo_list| { - // Don't show todo list if it's empty or finished - if todo_list.is_empty() || todo_list.is_finished() { - None - } else { - Some(todo_list) - } - }) + // Don't show todo list if it's empty or finished + .filter(|&todo_list| !(todo_list.is_empty() || todo_list.is_finished())) } pub fn pending_query_autoexecute_override( diff --git a/app/src/ai/blocklist/controller.rs b/app/src/ai/blocklist/controller.rs index c2dbf8e8..40ea6088 100644 --- a/app/src/ai/blocklist/controller.rs +++ b/app/src/ai/blocklist/controller.rs @@ -122,7 +122,8 @@ const PROGRESSIVE_SUMMARY_PROMPT: &str = "Create a concise, factual task-state c - Decisions made and the rationale needed to continue\n\ - Files changed and the material result of each change\n\ - Significant tool outcomes, errors, identifiers, and unresolved blockers\n\ - - Current progress and the next concrete steps\n\n\ + - Current progress and the next concrete steps; distinguish completed work from intentions\n\ + - Delegated scope, concrete findings with file paths or tool-result IDs, and the exact remaining uncertainty\n\n\ Omit greetings, agreement, praise, reassurance, filler, routine status narration, repeated content, and stylistic assistant phrasing. Summarize completed tool work by outcome instead of listing every call. Do not quote prior assistant wording unless its exact text is task-critical. Return only the checkpoint, structured for another agent to resume the work."; #[derive(Clone)] @@ -7634,6 +7635,15 @@ impl BlocklistAIController { else { return; }; + let tool_titles = batch + .calls + .iter() + .filter_map(|pending| { + run.action_context + .tool_call_title(&pending.call) + .map(|title| (pending.call.id.clone(), title)) + }) + .collect::>(); let (mut converted_actions, invalid_results) = convert_provider_tool_batch(&run.action_context, &batch); for result in &invalid_results { @@ -7742,6 +7752,13 @@ impl BlocklistAIController { } else { let apply_result = BlocklistAIHistoryModel::handle(ctx).update(ctx, |history_model, ctx| { + if let Some(title) = tool_titles.get(&action.id.to_string()) { + if let Some(conversation) = + history_model.conversation_mut(&conversation_id) + { + conversation.set_tool_title(&action.id, title.clone()); + } + } history_model.apply_domain_tool_proposal( &stream_id, conversation_id, diff --git a/app/src/ai/blocklist/history_model.rs b/app/src/ai/blocklist/history_model.rs index 8b3be9cb..0fbca161 100644 --- a/app/src/ai/blocklist/history_model.rs +++ b/app/src/ai/blocklist/history_model.rs @@ -1705,6 +1705,7 @@ impl BlocklistAIHistoryModel { agent_backend: source_conversation.agent_backend().for_fork(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: source_conversation.tool_titles().clone(), server_conversation_token: None, conversation_usage_metadata: Some(source_conversation.usage_metadata()), reverted_action_ids, @@ -1871,6 +1872,7 @@ impl BlocklistAIHistoryModel { agent_backend: conversation.agent_backend().for_fork(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: conversation.tool_titles().clone(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids, @@ -2882,6 +2884,7 @@ fn merged_remote_child_placeholder_conversation_data( // Active process-local provider runs cannot be merged from a cloud transcript. active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), // Cloud authoritative. server_conversation_token: cloud_conversation diff --git a/app/src/ai/blocklist/inline_action/code_diff_view.rs b/app/src/ai/blocklist/inline_action/code_diff_view.rs index d950a29e..e97891ad 100644 --- a/app/src/ai/blocklist/inline_action/code_diff_view.rs +++ b/app/src/ai/blocklist/inline_action/code_diff_view.rs @@ -2118,15 +2118,15 @@ impl CodeDiffView { } fn position_id_for_file(&self, i: usize) -> String { - format!("CodeDiffView-{}-tab-{i}", &self.position_id_prefix) + format!("CodeDiffView-{}-tab-{i}", self.position_id_prefix) } fn position_id_for_inline_editor(&self) -> String { - format!("CodeDiffView-inline-editor-{}", &self.position_id_prefix) + format!("CodeDiffView-inline-editor-{}", self.position_id_prefix) } fn position_id_for_inline_speedbump(&self) -> String { - format!("CodeDiffView-inline-speedbump-{}", &self.position_id_prefix) + format!("CodeDiffView-inline-speedbump-{}", self.position_id_prefix) } fn position_id_for_accept_split_button(&self) -> String { diff --git a/app/src/ai/blocklist/inline_action/suggested_unit_tests.rs b/app/src/ai/blocklist/inline_action/suggested_unit_tests.rs index d7f61f77..9bbe6713 100644 --- a/app/src/ai/blocklist/inline_action/suggested_unit_tests.rs +++ b/app/src/ai/blocklist/inline_action/suggested_unit_tests.rs @@ -139,7 +139,7 @@ impl SuggestedUnitTestsView { fn position_id_for_speedbump(&self) -> String { format!( "SuggestedUnitTestsView-speedbump-{}", - &self.position_id_prefix + self.position_id_prefix ) } diff --git a/app/src/ai/blocklist/input_model.rs b/app/src/ai/blocklist/input_model.rs index f1098b9a..d61b4562 100644 --- a/app/src/ai/blocklist/input_model.rs +++ b/app/src/ai/blocklist/input_model.rs @@ -799,7 +799,7 @@ impl BlocklistAIInputModel { if use_local_model { // A cancelled debounce never starts inference. The local worker // also cancels obsolete requests already queued or generating. - warpui::r#async::Timer::after(std::time::Duration::from_millis(300)).await; + warpui::r#async::Timer::after(std::time::Duration::from_millis(100)).await; let result = crate::local_inference::classify( buffer_cloned.to_string(), history_entries.as_deref().unwrap_or_default(), diff --git a/app/src/ai/blocklist/passive_suggestions/maa.rs b/app/src/ai/blocklist/passive_suggestions/maa.rs index d697686c..60a0f360 100644 --- a/app/src/ai/blocklist/passive_suggestions/maa.rs +++ b/app/src/ai/blocklist/passive_suggestions/maa.rs @@ -365,8 +365,7 @@ impl PassiveSuggestionsModel { #[cfg(feature = "local_fs")] if is_passive_code_diffs_enabled { if let Some(current_working_directory) = block_completed.serialized_block.pwd.clone() { - let block_contents = - format!("{}\n{}", &block_context.command, &block_context.output); + let block_contents = format!("{}\n{}", block_context.command, block_context.output); let shell = self.active_session.as_ref(ctx).shell_launch_data(ctx); let shell_for_detection = shell.clone(); let current_working_directory_for_detection = current_working_directory.clone(); diff --git a/app/src/ai/execution_profiles/profiles.rs b/app/src/ai/execution_profiles/profiles.rs index d64f6af1..be650202 100644 --- a/app/src/ai/execution_profiles/profiles.rs +++ b/app/src/ai/execution_profiles/profiles.rs @@ -1429,7 +1429,7 @@ impl AIExecutionProfilesModel { // We don't want stale client ids in our map. We won't be able to find the backing cloud object when // an edit occurs. pub fn replace_client_id_with_server_id(&mut self, server_id: SyncId, client_id: SyncId) { - for (_, sync_id) in self.profile_id_to_sync_id.iter_mut() { + for sync_id in self.profile_id_to_sync_id.values_mut() { if *sync_id == client_id { *sync_id = server_id; log::info!("Updated profile id mapping after creating a new execution profile"); diff --git a/app/src/ai/runtime/rig.rs b/app/src/ai/runtime/rig.rs index b5968e25..153c2fba 100644 --- a/app/src/ai/runtime/rig.rs +++ b/app/src/ai/runtime/rig.rs @@ -63,6 +63,26 @@ impl ProviderActionContext { } } + pub(crate) fn tool_call_title(&self, call: &ToolCall) -> Option { + let parameter = match self.mcp_tool_aliases.get(&call.name) { + Some(target) => target.title_parameter.as_deref()?, + None => super::rig_request::TOOL_TITLE_PARAMETER, + }; + call.arguments + .get(parameter) + .and_then(serde_json::Value::as_str) + .map(|title| { + title + .split_whitespace() + .collect::>() + .join(" ") + .chars() + .take(120) + .collect::() + }) + .filter(|title| !title.is_empty()) + } + pub(crate) fn action_from_tool_call(&self, call: &ToolCall) -> Result { action_from_tool_call( &self.task_id, diff --git a/app/src/ai/runtime/rig_request.rs b/app/src/ai/runtime/rig_request.rs index d56623bd..526839b9 100644 --- a/app/src/ai/runtime/rig_request.rs +++ b/app/src/ai/runtime/rig_request.rs @@ -123,6 +123,8 @@ pub(crate) fn add_orchestration_model_options( pub(crate) struct MCPToolTarget { pub server_id: Option, pub name: String, + #[serde(default)] + pub title_parameter: Option, } pub(crate) fn prepare_rig_turn( @@ -257,6 +259,12 @@ fn prepare_rig_turn_for_provider( } RigRequestMode::Normal | RigRequestMode::Plan | RigRequestMode::Orchestrate => {} } + for tool in &mut tools { + let parameter = add_tool_title_parameter(&mut tool.input_schema); + if let Some(target) = mcp_tool_aliases.get_mut(&tool.name) { + target.title_parameter = Some(parameter); + } + } let system_prompt = build_system_prompt(&input, &tools, &global_rules, mode); let mut new_messages = input_messages(input, tool_results); @@ -631,6 +639,7 @@ fn tool_definitions( MCPToolTarget { server_id: Uuid::parse_str(&server.id).ok(), name: tool.name.to_string(), + title_parameter: None, }, ); tools.push(ToolDefinition { @@ -654,6 +663,7 @@ fn tool_definitions( MCPToolTarget { server_id: None, name: tool.name.to_string(), + title_parameter: None, }, ); tools.push(ToolDefinition { @@ -670,6 +680,33 @@ fn tool_definitions( (tools, mcp_tool_aliases) } +pub(crate) const TOOL_TITLE_PARAMETER: &str = "_galaxy_tool_title"; + +fn add_tool_title_parameter(schema: &mut serde_json::Value) -> String { + let properties = schema["properties"].as_object_mut(); + let mut parameter = TOOL_TITLE_PARAMETER.to_string(); + if let Some(properties) = properties { + while properties.contains_key(¶meter) { + parameter.push('_'); + } + } else { + schema["properties"] = serde_json::json!({}); + } + schema["properties"][¶meter] = serde_json::json!({ + "type": "string", + "description": "Short pane title stating this call's specific purpose, e.g. Find cache invalidation paths. Use 3–10 words; no greetings, status filler, or secrets.", + "maxLength": 120 + }); + if !schema["required"].is_array() { + schema["required"] = serde_json::json!([]); + } + schema["required"] + .as_array_mut() + .unwrap() + .push(parameter.clone().into()); + parameter +} + fn tools_are_inline_only(tools: &[ToolDefinition]) -> bool { tools.iter().all(|tool| tool.name == "recall_tool_history") } @@ -726,10 +763,10 @@ fn build_system_prompt( "You are Galaxy, a local-first software-engineering and terminal agent. Complete the user's task through inspection, implementation, and proportionate validation. Galaxy owns tool permissions and execution; use only the tools advertised in this request and treat every result as authoritative evidence.\n\n", ); prompt.push_str( - "## Communication Style\nSpeak naturally, warmly, and directly, like a thoughtful collaborator working alongside the user. Default to short responses and expand only when complexity or the user's request warrants it. Acknowledge a correction once when useful; do not repeatedly agree that the user is right, praise them, or add generic reassurance. For nontrivial work, briefly tell the user what you are checking before the first tool call. Between dependent tool calls, add a concise update only when a result materially changes what you learned or what you will do next; ground it in specifics instead of generic activity narration. Do not narrate every routine read, repeat the plan, or end a turn with only a progress update when useful work can continue. In the final response, lead with the outcome and keep the handoff compact.\n\n", + "## Communication Style\nSpeak naturally, warmly, and directly, like a thoughtful collaborator working alongside the user. Default to short responses and expand only when complexity or the user's request warrants it. Acknowledge a correction once when useful; do not repeatedly agree that the user is right, praise them, or add generic reassurance. For nontrivial work, briefly tell the user what you are checking once before the first tool call of a new user request. Tool results and compaction checkpoints continue the same request: resume the work without another greeting, acknowledgement, or restatement of the plan. Supply the short purpose title requested by each tool schema. Between dependent tool calls, add a concise update only when a result materially changes what you learned or what you will do next; ground it in specifics instead of generic activity narration. Do not narrate every routine read, repeat the plan, or end a turn with only a progress update when useful work can continue. In the final response, lead with the outcome and keep the handoff compact.\n\n", ); prompt.push_str( - "## Execution Contract\nContinue until the user's requested outcome is complete and validated. Do not stop at an intermediate analysis, plan, status update, or promise of future work, and do not ask the user to say \"continue\". After each tool result, choose and perform the next necessary step. Stop only when the request is fulfilled or a concrete blocker requires user input; identify that blocker explicitly.\n\n", + "## Execution Contract\nBefore another read or search, identify the missing fact it will resolve. Reuse findings already present in the conversation. Once enough evidence exists for the requested change, implement it and validate; additional inspection should resolve a specific uncertainty. Batch independent reads within the tool limits and wait for results before dependent work. Continue until the user's requested outcome is complete and validated. Do not stop at an intermediate analysis, plan, status update, or promise of future work, and do not ask the user to say \"continue\". After each tool result, choose and perform the next necessary step. Stop only when the request is fulfilled or a concrete blocker requires user input; identify that blocker explicitly.\n\n", ); prompt.push_str( "## Task Tracking\nUse task tracking only for substantial work with multiple concrete steps, after planning has established those steps or when the user provides an actionable plan. Skip it for simple requests, questions, and exploratory planning. Each task must name a specific change or deliverable with a clear completion condition. Do not create generic workflow items such as 'research the request', 'critique the plan', 'execute the plan', or 'verify the result'. Update tasks only when their actual work is complete; a tool call or model turn alone is not evidence of completion.\n\n", diff --git a/app/src/ai/runtime/rig_request_tests.rs b/app/src/ai/runtime/rig_request_tests.rs index 6012795b..92b07f72 100644 --- a/app/src/ai/runtime/rig_request_tests.rs +++ b/app/src/ai/runtime/rig_request_tests.rs @@ -840,3 +840,25 @@ fn progressive_summary_is_provider_context_not_persistent_history() { MessageContent::Text(text) if text == "Continue" )); } + +#[test] +fn tool_title_schema_preserves_existing_parameters() { + let mut schema = serde_json::json!({ + "type": "object", + "properties": {"_galaxy_tool_title": {"type": "integer"}}, + "required": ["_galaxy_tool_title"], + "additionalProperties": false + }); + let parameter = super::add_tool_title_parameter(&mut schema); + assert_eq!(parameter, "_galaxy_tool_title_"); + assert_eq!( + schema["properties"]["_galaxy_tool_title"]["type"], + "integer" + ); + assert_eq!(schema["properties"][¶meter]["type"], "string"); + assert_eq!( + schema["required"], + serde_json::json!(["_galaxy_tool_title", "_galaxy_tool_title_"]) + ); + assert_eq!(schema["additionalProperties"], false); +} diff --git a/app/src/ai/runtime/rig_tests.rs b/app/src/ai/runtime/rig_tests.rs index b23cfe4c..611de65c 100644 --- a/app/src/ai/runtime/rig_tests.rs +++ b/app/src/ai/runtime/rig_tests.rs @@ -1,4 +1,6 @@ -use super::prepare_provider_run; +use galaxy_agent_core::ToolCall; + +use super::{prepare_provider_run, ProviderActionContext}; use crate::ai::agent::api::RequestParams; use crate::ai::llms::LLMId; use crate::ai::openai::client::OpenAIClientConfig; @@ -73,3 +75,23 @@ fn subscription_context_budget_uses_catalog_limit_and_clamps_stale_overrides() { ); } } + +#[test] +fn tool_titles_are_optional_and_normalized_for_display() { + let context = ProviderActionContext::new_for_test("task"); + let mut call = ToolCall { + id: "call".to_string(), + name: "read_files".to_string(), + arguments: serde_json::json!({"_galaxy_tool_title": " Read\n cache configuration "}), + }; + assert_eq!( + context.tool_call_title(&call).as_deref(), + Some("Read cache configuration") + ); + call.arguments = serde_json::json!({"_galaxy_tool_title": "界".repeat(200)}); + assert_eq!(context.tool_call_title(&call).unwrap().chars().count(), 120); + call.arguments = serde_json::json!({"_galaxy_tool_title": " "}); + assert_eq!(context.tool_call_title(&call), None); + call.arguments = serde_json::json!({}); + assert_eq!(context.tool_call_title(&call), None); +} diff --git a/app/src/ai/runtime/rig_tool.rs b/app/src/ai/runtime/rig_tool.rs index 65137ce1..24d19cad 100644 --- a/app/src/ai/runtime/rig_tool.rs +++ b/app/src/ai/runtime/rig_tool.rs @@ -35,7 +35,13 @@ pub(crate) fn action_from_tool_call( AIAgentActionType::CallMCPTool { server_id: target.server_id, name: target.name.clone(), - input: input.clone(), + input: { + let mut arguments = input.clone(); + if let Some(parameter) = &target.title_parameter { + arguments.as_object_mut().unwrap().remove(parameter); + } + arguments + }, } } else { match call.name.as_str() { diff --git a/app/src/ai/runtime/rig_tool_tests.rs b/app/src/ai/runtime/rig_tool_tests.rs index 0101dbd8..bce53931 100644 --- a/app/src/ai/runtime/rig_tool_tests.rs +++ b/app/src/ai/runtime/rig_tool_tests.rs @@ -381,6 +381,7 @@ fn provider_safe_mcp_aliases_resolve_to_the_original_tool() { MCPToolTarget { server_id: Some(server_id), name: "performance_analyze_insight".to_string(), + title_parameter: None, }, )]); @@ -550,3 +551,32 @@ fn unknown_tools_are_rejected_before_the_permission_boundary() { assert!(error.contains("unsupported Rig tool proposal")); } + +#[test] +fn mcp_title_metadata_does_not_change_tool_arguments() { + let alias = "mcp__echo"; + let aliases = HashMap::from([( + alias.to_string(), + MCPToolTarget { + server_id: None, + name: "echo".to_string(), + title_parameter: Some("_galaxy_tool_title_".to_string()), + }, + )]); + let arguments = serde_json::json!({ + "message": "hello", + "_galaxy_tool_title": "a real server argument", + "_galaxy_tool_title_": "Check the echo service" + }); + let action = action_from_tool_call( + "task-1", + &call(alias, arguments), + &SkillPathOrigin::Local, + &aliases, + ) + .unwrap(); + assert!( + matches!(action.action, AIAgentActionType::CallMCPTool { input, .. } + if input == serde_json::json!({"message": "hello", "_galaxy_tool_title": "a real server argument"})) + ); +} diff --git a/app/src/autoupdate/mac.rs b/app/src/autoupdate/mac.rs index e624abcd..b87a440a 100644 --- a/app/src/autoupdate/mac.rs +++ b/app/src/autoupdate/mac.rs @@ -172,7 +172,7 @@ pub(super) fn relaunch() -> Result<()> { pub async fn cleanup(update_id: &str) { let download_dir = get_download_dir(update_id); if download_dir.exists() { - log::info!("Cleaning up download dir {:?}", &download_dir); + log::info!("Cleaning up download dir {:?}", download_dir); if let Err(e) = async_fs::remove_dir_all(&download_dir).await { safe_error!( safe: ("Error cleaning up download dir: {e:?}"), @@ -427,7 +427,7 @@ async fn apply_update(channel: Channel, version_info: &VersionInfo, update_id: & ); } - log::info!("Setting installed version to {:?}", &version_info); + log::info!("Setting installed version to {:?}", version_info); log::info!("Applied update in {:?}", update_start.elapsed()); Ok(()) @@ -524,11 +524,11 @@ async fn download_and_extract_binary( log::info!( "Downloading update, version {} on channel {channel}", - &version_info.version, + version_info.version, ); let download_dir = get_download_dir(update_id); - log::info!("Creating download dir {:?}", &download_dir); + log::info!("Creating download dir {:?}", download_dir); async_fs::create_dir_all(&download_dir).await?; let dmg_path = download_dmg(&channel, version_info, update_id, client).await?; @@ -608,11 +608,7 @@ const DMG_TIMEOUT_S: u64 = 600; /// The temporary path for downloading the new dmg into. fn dmg_path(channel: &Channel, version_info: &VersionInfo, update_id: &str) -> PathBuf { let mut dir = get_download_dir(update_id); - let file_name = format!( - "{}.{}.dmg", - &version_info.version, - app_name_prefix(*channel) - ); + let file_name = format!("{}.{}.dmg", version_info.version, app_name_prefix(*channel)); dir.push(file_name); dir } @@ -655,7 +651,7 @@ async fn download_dmg( .await?; file.sync_data().await?; - log::info!("Wrote DMG to tempfile at {:?}", &dmg_file); + log::info!("Wrote DMG to tempfile at {:?}", dmg_file); Ok(dmg_file) } diff --git a/app/src/code/editor/diff.rs b/app/src/code/editor/diff.rs index ec75d253..be424310 100644 --- a/app/src/code/editor/diff.rs +++ b/app/src/code/editor/diff.rs @@ -568,7 +568,7 @@ impl DiffModel { move |model, (change_mapping, deletion_mapping), ctx| { model.status.change_mapping = change_mapping; model.status.deletion_mapping = deletion_mapping; - log::debug!("diff status updated: {:#?}", &model.status); + log::debug!("diff status updated: {:#?}", model.status); ctx.emit(DiffModelEvent::DiffUpdated { should_recalculate_hidden_lines, version, diff --git a/app/src/context_chips/display_chip.rs b/app/src/context_chips/display_chip.rs index 10060909..232a85e0 100644 --- a/app/src/context_chips/display_chip.rs +++ b/app/src/context_chips/display_chip.rs @@ -572,10 +572,9 @@ impl GitBranchTrackingStatus { rebased = true; } else if let Some(ahead_count) = part.strip_prefix('↑') { ahead = Self::parse_display_count(ahead_count)?; - } else if let Some(behind_count) = part.strip_prefix('↓') { - behind = Self::parse_display_count(behind_count)?; } else { - return None; + let behind_count = part.strip_prefix('↓')?; + behind = Self::parse_display_count(behind_count)?; } } diff --git a/app/src/drive/export.rs b/app/src/drive/export.rs index 206b7304..cf29a13a 100644 --- a/app/src/drive/export.rs +++ b/app/src/drive/export.rs @@ -520,7 +520,7 @@ fn make_forbidden_filenames_matcher() -> AhoCorasick { // NTFS (Windows) disallows ASCII control characters in path names. let ascii_control = 0x00..0x1f; // These characters are disallowed by UNIX filesystems, APFS or HFS+ (macOS), or NTFS. - let forbidden = [b'/', b':', b'#', b'*', b'<', b'>', b'?', b'\\', b'|']; + let forbidden = *b"/:#*<>?\\|"; let patterns = ascii_control.chain(forbidden).map(|ch| [ch]); AhoCorasick::builder() diff --git a/app/src/editor/view/model/buffer/mod.rs b/app/src/editor/view/model/buffer/mod.rs index 8bdab81b..152c72db 100644 --- a/app/src/editor/view/model/buffer/mod.rs +++ b/app/src/editor/view/model/buffer/mod.rs @@ -3388,7 +3388,8 @@ impl Iterator for CharsWithStyle<'_> { } else { loop { self.fragments_cursor.prev(); - if let Some(fragment) = self.fragments_cursor.item() { + { + let fragment = self.fragments_cursor.item()?; if fragment.is_visible(self.undo_history) { self.fragment_offset = fragment.len(); self.fragment_chars = fragment.text.as_str().chars(); @@ -3399,8 +3400,6 @@ impl Iterator for CharsWithStyle<'_> { .next_back() .map(|char| StylizedChar::new(char, self.fragment_text_style)); } - } else { - return None; } } } @@ -3410,7 +3409,8 @@ impl Iterator for CharsWithStyle<'_> { } else { loop { self.fragments_cursor.next(); - if let Some(fragment) = self.fragments_cursor.item() { + { + let fragment = self.fragments_cursor.item()?; if fragment.is_visible(self.undo_history) { self.fragment_chars = fragment.text.as_str().chars(); self.fragment_text_style = fragment.text.text_style().unwrap_or_default(); @@ -3420,8 +3420,6 @@ impl Iterator for CharsWithStyle<'_> { .next() .map(|char| StylizedChar::new(char, self.fragment_text_style)); } - } else { - return None; } } } diff --git a/app/src/external_secrets/mod.rs b/app/src/external_secrets/mod.rs index bd2b0a9d..cb856741 100644 --- a/app/src/external_secrets/mod.rs +++ b/app/src/external_secrets/mod.rs @@ -184,14 +184,14 @@ impl SecretManager { ) -> ErrorMessageAndCommand { match error_type { SecretErrorType::NotInstalled => { - let message = format!("{} CLI is not installed", &self); + let message = format!("{} CLI is not installed", self); let (link, link_message) = ( match self { SecretManager::OnePassword => Some(ONEPASSWORD_DOCS_LINK.to_owned()), SecretManager::LastPass => Some(LASTPASS_DOCS_LINK.to_owned()), }, - Some(format!("View {} CLI installation documentation", &self)), + Some(format!("View {} CLI installation documentation", self)), ); ErrorMessageAndCommand { @@ -211,7 +211,7 @@ impl SecretManager { ErrorMessageAndCommand { message: format!( "{} didn't return secrets (likely not configured or authenticated)", - &self + self ), link, link_message, diff --git a/app/src/integration_testing/agent_mode/mod.rs b/app/src/integration_testing/agent_mode/mod.rs index 855f1add..7e770963 100644 --- a/app/src/integration_testing/agent_mode/mod.rs +++ b/app/src/integration_testing/agent_mode/mod.rs @@ -275,7 +275,7 @@ pub fn output_conversation_debug_info( for input in &exchange.input { write_to_debug_file(&format!("\nInput:\n\n{input}\n")); } - write_to_debug_file(&format!("Output:\n{}", &exchange.output_status)) + write_to_debug_file(&format!("Output:\n{}", exchange.output_status)) } // Add completion timestamp diff --git a/app/src/integration_testing/terminal/step.rs b/app/src/integration_testing/terminal/step.rs index 5e6f3a5c..8486562e 100644 --- a/app/src/integration_testing/terminal/step.rs +++ b/app/src/integration_testing/terminal/step.rs @@ -76,7 +76,7 @@ pub fn open_context_menu_for_selected_block() -> Vec { /// with results. pub fn run_completer(tab_index: usize, input_text: impl Into) -> TestStep { let input_text = input_text.into(); - new_step_with_default_assertions(&format!("Type {} and hit tab", &input_text)) + new_step_with_default_assertions(&format!("Type {} and hit tab", input_text)) .with_typed_characters(&[&input_text]) .with_keystrokes(&["tab"]) .set_timeout(Duration::from_secs(2)) diff --git a/app/src/notebooks/editor/embedding_model.rs b/app/src/notebooks/editor/embedding_model.rs index 25bff4f1..9a85011c 100644 --- a/app/src/notebooks/editor/embedding_model.rs +++ b/app/src/notebooks/editor/embedding_model.rs @@ -187,13 +187,7 @@ impl NotebookEmbed { cloud_model .get_by_uid(&id.to_server_id().uid()) .and_then(|object| object.as_any().downcast_ref::()) - .and_then(|workflow| { - if workflow.is_trashed(cloud_model) { - None - } else { - Some(workflow) - } - }) + .filter(|&workflow| !workflow.is_trashed(cloud_model)) } pub fn start_offset(&self, ctx: &impl ModelAsRef) -> Option { diff --git a/app/src/pane_group/mod_tests.rs b/app/src/pane_group/mod_tests.rs index 9abdcd2f..898e09ca 100644 --- a/app/src/pane_group/mod_tests.rs +++ b/app/src/pane_group/mod_tests.rs @@ -390,6 +390,7 @@ fn persisted_remote_child_conversation( agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: Some("restored-child-token".to_string()), conversation_usage_metadata: None, reverted_action_ids: None, diff --git a/app/src/persistence/block_list.rs b/app/src/persistence/block_list.rs index 14c146b4..1067c9b5 100644 --- a/app/src/persistence/block_list.rs +++ b/app/src/persistence/block_list.rs @@ -190,7 +190,7 @@ pub(super) fn get_all_restored_blocks( }) .collect::>>(); - for (_, blocks) in all_block_items_by_pane.iter_mut() { + for blocks in all_block_items_by_pane.values_mut() { blocks.sort_by_key(|item| item.start_ts()); // Only keep most recent command blocks blocks.drain( diff --git a/app/src/search/action/search_item.rs b/app/src/search/action/search_item.rs index 69e5a13a..7786ee91 100644 --- a/app/src/search/action/search_item.rs +++ b/app/src/search/action/search_item.rs @@ -149,8 +149,7 @@ impl SearchItem for MatchedBinding { format!( "Selected {}, {}.", - &self - .binding + self.binding .description .in_context(DescriptionContext::Default), trigger.map(Keystroke::normalized).unwrap_or_default() diff --git a/app/src/search/command_palette/files/search_item.rs b/app/src/search/command_palette/files/search_item.rs index 05462d03..7b9ad1d7 100644 --- a/app/src/search/command_palette/files/search_item.rs +++ b/app/src/search/command_palette/files/search_item.rs @@ -161,7 +161,7 @@ impl SearchItem for CreateFileSearchItem { let text_color = highlight_state.sub_text_fill(appearance).into_solid(); let label = Text::new_inline( - format!("Create a file named {}…", &self.file_name), + format!("Create a file named {}…", self.file_name), appearance.ui_font_family(), appearance.monospace_font_size(), ) diff --git a/app/src/search/external_secrets/external_secret_search_item.rs b/app/src/search/external_secrets/external_secret_search_item.rs index 75640cf6..27db3078 100644 --- a/app/src/search/external_secrets/external_secret_search_item.rs +++ b/app/src/search/external_secrets/external_secret_search_item.rs @@ -94,6 +94,6 @@ impl SearchItem for ExternalSecretSearchItem { } fn accessibility_label(&self) -> String { - format!("Secret: {}", &self.external_secret.get_display_name()) + format!("Secret: {}", self.external_secret.get_display_name()) } } diff --git a/app/src/search/files/model.rs b/app/src/search/files/model.rs index 6e0ea5fe..d7af05d1 100644 --- a/app/src/search/files/model.rs +++ b/app/src/search/files/model.rs @@ -423,12 +423,11 @@ impl FileSearchModel { let mut all_matched_indices = Vec::new(); for query_part in &query_parts { - if let Some(part_result) = Self::fuzzy_match_path_single(path, query_part) { + { + // If any part doesn't match, the entire query fails + let part_result = Self::fuzzy_match_path_single(path, query_part)?; combined_score += part_result.score; all_matched_indices.extend(part_result.matched_indices); - } else { - // If any part doesn't match, the entire query fails - return None; } } diff --git a/app/src/server/cloud_objects/update_manager_tests.rs b/app/src/server/cloud_objects/update_manager_tests.rs index 60cb6516..a5f6deba 100644 --- a/app/src/server/cloud_objects/update_manager_tests.rs +++ b/app/src/server/cloud_objects/update_manager_tests.rs @@ -5667,7 +5667,7 @@ fn test_move_object_personal_to_team_success() { assert!( matches!(&events[0], ModelEvent::UpsertNotebook { notebook } if notebook.id == sync_id), "Expected upsert of notebook, got {:?}", - &events[0] + events[0] ); }); } @@ -5870,7 +5870,7 @@ fn test_move_cloud_environment_personal_to_team_success() { let events = db_events(&update_manager_struct); assert_eq!(events.len(), 1); let ModelEvent::UpsertGenericStringObject { object } = &events[0] else { - panic!("Expected upsert of cloud environment, got {:?}", &events[0]) + panic!("Expected upsert of cloud environment, got {:?}", events[0]) }; assert_eq!(object.id(), sync_id); }); @@ -5981,18 +5981,18 @@ fn test_move_workflow_with_enums_personal_to_team_success() { let events = db_events(&update_manager_struct); assert_eq!(events.len(), 3); let ModelEvent::UpsertGenericStringObject { object } = &events[0] else { - panic!("Expected upsert of workflow enum, got {:?}", &events[0]) + panic!("Expected upsert of workflow enum, got {:?}", events[0]) }; let new_enum_id = object.id(); assert!( matches!(&events[1], ModelEvent::UpsertWorkflow { workflow } if workflow.id == workflow_sync_id), "Expected upsert of workflow, got {:?}", - &events[0] + events[0] ); assert!( matches!(&events[2], ModelEvent::UpsertWorkflow { workflow } if workflow.id == workflow_sync_id), "Expected upsert of workflow, got {:?}", - &events[2] + events[2] ); // Assert that the new enum ID is in the team space, but the old one remains in the personal space @@ -6133,18 +6133,18 @@ fn test_move_workflow_with_enums_personal_to_team_failure() { assert!( matches!(&events[0], ModelEvent::UpsertGenericStringObject { .. }), "Expected upsert of GSO, got {:?}", - &events[0] + events[0] ); assert!( matches!(&events[1], ModelEvent::UpsertWorkflow { workflow } if workflow.id == workflow_sync_id), "Expected upsert of workflow, got {:?}", - &events[0] + events[0] ); assert!( matches!(&events[2], ModelEvent::UpsertWorkflow { workflow } if workflow.id == workflow_sync_id), "Expected upsert of workflow, got {:?}", - &events[2] + events[2] ); // Assert that the workflow update references the old enum ID @@ -6253,7 +6253,7 @@ fn test_move_object_root_to_folder_success() { assert!( matches!(&events[0], ModelEvent::UpsertNotebook { notebook } if notebook.id == sync_id), "Expected upsert of notebook, got {:?}", - &events[0] + events[0] ); }); } @@ -6445,7 +6445,7 @@ fn test_move_object_folder_to_root_success() { assert!( matches!(&events[0], ModelEvent::UpsertNotebook { notebook } if notebook.id == sync_id), "Expected upsert of notebook, got {:?}", - &events[0] + events[0] ); }); } @@ -6639,7 +6639,7 @@ fn test_move_object_folder_to_folder_success() { assert!( matches!(&events[0], ModelEvent::UpsertNotebook { notebook } if notebook.id == sync_id), "Expected upsert of notebook, got {:?}", - &events[0] + events[0] ); }); } @@ -7422,7 +7422,7 @@ fn test_add_guest_success() { assert!( matches!(&events[0], ModelEvent::UpsertNotebook { notebook } if notebook.id == sync_id), "Expected upsert of notebook, got {:?}", - &events[0] + events[0] ); assert!(matches!(&events[1], ModelEvent::UpsertUserProfiles { .. })); }); diff --git a/app/src/server/server_api.rs b/app/src/server/server_api.rs index 210055c0..81f00ba9 100644 --- a/app/src/server/server_api.rs +++ b/app/src/server/server_api.rs @@ -1121,7 +1121,7 @@ impl ServerApi { } let time_endpoint = format!("{}/current_time", ChannelState::server_root_url()); - log::info!("Sending server time request to {}", &time_endpoint); + log::info!("Sending server time request to {}", time_endpoint); let res = self .base_client .http_client() @@ -1138,7 +1138,7 @@ impl ServerApi { let time_response: TimeResponse = res.json().await?; log::info!( "Received current time from server: {:?}", - &time_response.current_time + time_response.current_time ); let server_time = ServerTime { time_at_fetch: time_response.current_time, diff --git a/app/src/server/sync_queue.rs b/app/src/server/sync_queue.rs index a586e76e..d3d4d9f9 100644 --- a/app/src/server/sync_queue.rs +++ b/app/src/server/sync_queue.rs @@ -1828,7 +1828,7 @@ impl SyncQueue { /// If a request succeeds, update the dependency map by removing it from all dependency sets fn handle_dependency_success(&mut self, dependency: &QueueDependency) { - for (_, dependencies) in self.queue_dependencies.iter_mut() { + for dependencies in self.queue_dependencies.values_mut() { dependencies.remove(dependency); } } diff --git a/app/src/settings_view/features_page.rs b/app/src/settings_view/features_page.rs index 1d52bb6e..f4150ccc 100644 --- a/app/src/settings_view/features_page.rs +++ b/app/src/settings_view/features_page.rs @@ -2438,7 +2438,7 @@ impl FeaturesPageView { editor.set_buffer_text( &format!( "{}", - &KeysSettings::handle(ctx) + KeysSettings::handle(ctx) .as_ref(ctx) .quake_mode_settings .value() @@ -2483,7 +2483,7 @@ impl FeaturesPageView { editor.set_buffer_text( &format!( "{}", - &KeysSettings::handle(ctx) + KeysSettings::handle(ctx) .as_ref(ctx) .quake_mode_settings .value() diff --git a/app/src/terminal/find/model.rs b/app/src/terminal/find/model.rs index 4700fe04..7283c9ea 100644 --- a/app/src/terminal/find/model.rs +++ b/app/src/terminal/find/model.rs @@ -583,7 +583,7 @@ impl TerminalFindModel { } else if let Some(controller) = &mut self.async_find_controller { controller.clear_results(ctx); } else if let Some(run) = self.block_list_find_run.take() { - for (_, rich_content_view) in self.rich_content_views.iter() { + for rich_content_view in self.rich_content_views.values() { rich_content_view.clear_matches(ctx); } self.block_list_find_run = Some(run.cleared()); diff --git a/app/src/terminal/input.rs b/app/src/terminal/input.rs index 98e8e731..cf7ab5b8 100644 --- a/app/src/terminal/input.rs +++ b/app/src/terminal/input.rs @@ -7898,7 +7898,7 @@ impl Input { // Emit the a11y content as the last step so that it overwrites any of the a11y content // emitted by the editor (if multiple `AccessibilityContent`s are emitted within the same // event loop, the last one wins). - let mut accessibility_text = format!("Workflow command {} inserted.", &command_to_insert); + let mut accessibility_text = format!("Workflow command {} inserted.", command_to_insert); if let Some(a11y_content) = self.selected_workflow_a11y_text(ctx) { let _ = write!(accessibility_text, " {a11y_content}"); } diff --git a/app/src/terminal/input/conversations/view.rs b/app/src/terminal/input/conversations/view.rs index 9f773967..36c960e1 100644 --- a/app/src/terminal/input/conversations/view.rs +++ b/app/src/terminal/input/conversations/view.rs @@ -129,7 +129,7 @@ impl InlineConversationMenuView { .as_ref(ctx) .is_conversation_menu() { - let InputBufferUpdateEvent { new_content: _, .. } = event; + let InputBufferUpdateEvent { .. } = event; me.rerun_query(ctx); } }); diff --git a/app/src/terminal/input/slash_commands/data_source/mod.rs b/app/src/terminal/input/slash_commands/data_source/mod.rs index 3a3d0db0..b35b8702 100644 --- a/app/src/terminal/input/slash_commands/data_source/mod.rs +++ b/app/src/terminal/input/slash_commands/data_source/mod.rs @@ -679,7 +679,7 @@ impl InlineItem { name: skill.name.clone(), }, icon_path: icon.into(), - name: format!("/{}", &skill.name), + name: format!("/{}", skill.name), description: Some(skill.description.clone()), font_family: appearance.monospace_font_family(), name_match_result: None, diff --git a/app/src/terminal/model/ansi/mod.rs b/app/src/terminal/model/ansi/mod.rs index d70192e8..43e01923 100644 --- a/app/src/terminal/model/ansi/mod.rs +++ b/app/src/terminal/model/ansi/mod.rs @@ -205,12 +205,11 @@ fn parse_number(input: &[u8]) -> Option { let mut num: u8 = 0; for c in input { let c = *c as char; - if let Some(digit) = c.to_digit(10) { + { + let digit = c.to_digit(10)?; num = num .checked_mul(10) .and_then(|v| v.checked_add(digit as u8))? - } else { - return None; } } Some(num) diff --git a/app/src/terminal/model/blocks.rs b/app/src/terminal/model/blocks.rs index c608b612..6b84bd9e 100644 --- a/app/src/terminal/model/blocks.rs +++ b/app/src/terminal/model/blocks.rs @@ -3107,7 +3107,7 @@ impl BlockList { log::info!( "Incrementing stage from {:?} to {:?}", self.bootstrap_stage, - &next_bootstrap_stage + next_bootstrap_stage ); self.bootstrap_stage = next_bootstrap_stage; } diff --git a/app/src/terminal/model/blocks/selection.rs b/app/src/terminal/model/blocks/selection.rs index c021eb78..56bbb3a2 100644 --- a/app/src/terminal/model/blocks/selection.rs +++ b/app/src/terminal/model/blocks/selection.rs @@ -202,6 +202,7 @@ impl BlockListSelection { let head_is_below_tail = (self.head.point.row > self.tail.point.row && !block_list.is_inverted) || (self.head.point.row < self.tail.point.row && block_list.is_inverted); + // select-up and select-down do nothing when there's no rendered selection. let (mut head, mut tail) = if head_is_below_tail { (self.tail, self.head) } else { @@ -478,40 +479,38 @@ impl BlockList { ) -> Option { let tail = match self.expand_selection(semantic_selection, inverted_blocklist) { Some(selection) => selection.tail().within_grid_point, - None => match self.selection.take() { - None => return None, - Some(mut selection) => { - // In this case, there's an underlying selection that spans an empty range - // and has no rendering. - // - // The selection is in one of two formats: - // (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L) - // (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R) - // And we should update the selection to this: - // (row: x, col: y, side: R) --> (row: x, col: y, side: L) - let start_anchor = selection.start_anchor().point; + None => { + let mut selection = self.selection.take()?; + // In this case, there's an underlying selection that spans an empty range + // and has no rendering. + // + // The selection is in one of two formats: + // (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L) + // (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R) + // And we should update the selection to this: + // (row: x, col: y, side: R) --> (row: x, col: y, side: L) + let start_anchor = selection.start_anchor().point; - selection.tail.point = start_anchor; - selection.tail.side = Side::Left; - selection.head.point = start_anchor; - selection.head.side = Side::Right; - self.set_selection(selection); - return Some(start_anchor); - } - }, + selection.tail.point = start_anchor; + selection.tail.side = Side::Left; + selection.head.point = start_anchor; + selection.head.side = Side::Right; + self.set_selection(selection); + return Some(start_anchor); + } }; let mut selection = self.selection.take()?; let tail_point = tail.get(); - let grid = match self.block_at(tail.block_index) { - None => return None, - Some(block) => match tail.grid { + let grid = { + let block = self.block_at(tail.block_index)?; + match tail.grid { GridType::Prompt => block.prompt_grid(), GridType::PromptAndCommand => block.prompt_and_command_grid(), GridType::Rprompt => block.rprompt_grid(), GridType::Output => block.output_grid(), - }, + } }; // There are two cases: @@ -559,40 +558,38 @@ impl BlockList { ) -> Option { let tail = match self.expand_selection(semantic_selection, inverted_blocklist) { Some(selection) => selection.tail().within_grid_point, - None => match self.selection.take() { - None => return None, - Some(mut selection) => { - // In this case, there's an underlying selection that spans an empty range - // and has no rendering. - // - // The selection is in one of two formats: - // (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L) - // (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R) - // And we should update the selection to this: - // (row: x, col: y + 1, side: L) --> (row: x, col: y + 1, side: R) - let end_anchor = selection.end_anchor().point; + None => { + let mut selection = self.selection.take()?; + // In this case, there's an underlying selection that spans an empty range + // and has no rendering. + // + // The selection is in one of two formats: + // (row: x, col: y, side: R) --> (row: x, col: y + 1, side: L) + // (row: x, col: y + 1, side: L) --> (row: x, col: y, side: R) + // And we should update the selection to this: + // (row: x, col: y + 1, side: L) --> (row: x, col: y + 1, side: R) + let end_anchor = selection.end_anchor().point; - selection.head.point = end_anchor; - selection.head.side = Side::Left; - selection.tail.point = end_anchor; - selection.tail.side = Side::Right; - self.set_selection(selection); - return Some(end_anchor); - } - }, + selection.head.point = end_anchor; + selection.head.side = Side::Left; + selection.tail.point = end_anchor; + selection.tail.side = Side::Right; + self.set_selection(selection); + return Some(end_anchor); + } }; let mut selection = self.selection.take()?; let tail_point = tail.get(); - let grid = match self.block_at(tail.block_index) { - None => return None, - Some(block) => match tail.grid { + let grid = { + let block = self.block_at(tail.block_index)?; + match tail.grid { GridType::Prompt => block.prompt_grid(), GridType::PromptAndCommand => block.prompt_and_command_grid(), GridType::Rprompt => block.rprompt_grid(), GridType::Output => block.output_grid(), - }, + } }; let num_rows_in_grid = grid.len_displayed(); @@ -639,15 +636,14 @@ impl BlockList { semantic_selection: &SemanticSelection, inverted_blocklist: bool, ) -> Option { - let (mut head, mut tail) = - match self.expand_selection(semantic_selection, inverted_blocklist) { - Some(selection) => ( - selection.head().within_grid_point, - selection.tail().within_grid_point, - ), - // select-up and select-down do nothing when there's no rendered selection. - None => return None, - }; + // select-up and select-down do nothing when there's no rendered selection. + let (mut head, mut tail) = { + let selection = self.expand_selection(semantic_selection, inverted_blocklist)?; + ( + selection.head().within_grid_point, + selection.tail().within_grid_point, + ) + }; let mut selection = self.selection.take()?; @@ -663,14 +659,14 @@ impl BlockList { } let tail_point = tail.get(); - let grid = match self.block_at(tail.block_index) { - None => return None, - Some(block) => match tail.grid { + let grid = { + let block = self.block_at(tail.block_index)?; + match tail.grid { GridType::Prompt => block.prompt_grid(), GridType::PromptAndCommand => block.prompt_and_command_grid(), GridType::Rprompt => block.rprompt_grid(), GridType::Output => block.output_grid(), - }, + } }; // There are two cases: @@ -719,15 +715,14 @@ impl BlockList { semantic_selection: &SemanticSelection, inverted_blocklist: bool, ) -> Option { - let (mut head, mut tail) = - match self.expand_selection(semantic_selection, inverted_blocklist) { - Some(selection) => ( - selection.head().within_grid_point, - selection.tail().within_grid_point, - ), - // select-up and select-down do nothing when there's no rendered selection. - None => return None, - }; + // select-up and select-down do nothing when there's no rendered selection. + let (mut head, mut tail) = { + let selection = self.expand_selection(semantic_selection, inverted_blocklist)?; + ( + selection.head().within_grid_point, + selection.tail().within_grid_point, + ) + }; let mut selection = self.selection.take()?; @@ -766,14 +761,14 @@ impl BlockList { inverted_blocklist: bool, ) -> Option<(WithinBlock, bool)> { let tail_point = tail.get(); - let grid = match self.block_at(tail.block_index) { - None => return None, - Some(block) => match tail.grid { + let grid = { + let block = self.block_at(tail.block_index)?; + match tail.grid { GridType::Prompt => block.prompt_grid(), GridType::PromptAndCommand => block.prompt_and_command_grid(), GridType::Rprompt => block.rprompt_grid(), GridType::Output => block.output_grid(), - }, + } }; let num_rows_in_grid = grid.len_displayed(); let mut is_at_bottom = false; diff --git a/app/src/terminal/model/session/command_executor/in_band_command_executor.rs b/app/src/terminal/model/session/command_executor/in_band_command_executor.rs index 881c6a8f..726b8974 100644 --- a/app/src/terminal/model/session/command_executor/in_band_command_executor.rs +++ b/app/src/terminal/model/session/command_executor/in_band_command_executor.rs @@ -232,7 +232,7 @@ impl InBandCommandExecutor { } } } else { - log::warn!("Cached in-band command ID {} does not match ID of executed in-band command output {}", cmd.id, &event.command_id); + log::warn!("Cached in-band command ID {} does not match ID of executed in-band command output {}", cmd.id, event.command_id); // If the command event that we received is not for the current running command, // we need to restore the command as the currently running command. *current_command = Some(cmd); diff --git a/app/src/terminal/profile_model_selector.rs b/app/src/terminal/profile_model_selector.rs index d0f5fd40..75972e95 100644 --- a/app/src/terminal/profile_model_selector.rs +++ b/app/src/terminal/profile_model_selector.rs @@ -1263,7 +1263,7 @@ impl ProfileModelSelector { if let Some(llm) = self.get_selected_llm_info(MenuType::Sidecar, index, ctx) { log::info!( "Selecting base agent model {} (from model selector)", - &llm.id + llm.id ); LLMPreferences::handle(ctx).update(ctx, |preferences, ctx| { preferences.update_preferred_agent_mode_llm(&llm.id, self.terminal_view_id, ctx); diff --git a/app/src/terminal/ssh/util.rs b/app/src/terminal/ssh/util.rs index 91c13936..448790ee 100644 --- a/app/src/terminal/ssh/util.rs +++ b/app/src/terminal/ssh/util.rs @@ -329,12 +329,12 @@ pub fn transfer_file_sftp_command( } // "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r \"path/to/local/file\"" - command += &format!("\\\"{}\\\"", &local_file_path); + command += &format!("\\\"{}\\\"", local_file_path); // "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r path/to/local/file pwd/on/remote" if let Some(pwd) = pwd { command += " "; - command += &format!("\\\"{}\\\"", &pwd); + command += &format!("\\\"{}\\\"", pwd); } // "sftp -P 2222 sshuser@127.0.0.1 <<< "put -r path/to/local/file pwd/on/remote"" diff --git a/app/src/terminal/view/load_ai_conversation.rs b/app/src/terminal/view/load_ai_conversation.rs index 2a3cbaa0..470619e2 100644 --- a/app/src/terminal/view/load_ai_conversation.rs +++ b/app/src/terminal/view/load_ai_conversation.rs @@ -945,6 +945,7 @@ impl TerminalView { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, diff --git a/app/src/terminal/view/ssh_file_upload.rs b/app/src/terminal/view/ssh_file_upload.rs index 31f4773d..2e5e23d1 100644 --- a/app/src/terminal/view/ssh_file_upload.rs +++ b/app/src/terminal/view/ssh_file_upload.rs @@ -242,7 +242,7 @@ impl FileUpload { //"put -r path/to/local/file pwd/on/remote" if let Some(pwd) = remote_dest_path { command += " "; - command += &format!("\\\"{}\\\"", &pwd); + command += &format!("\\\"{}\\\"", pwd); } command diff --git a/app/src/test_util/virtual_fs.rs b/app/src/test_util/virtual_fs.rs index 7ef3641f..3be66507 100644 --- a/app/src/test_util/virtual_fs.rs +++ b/app/src/test_util/virtual_fs.rs @@ -26,7 +26,7 @@ impl Warp { std::env::var("CARGO_TARGET_DIR") .ok() .map(|directory| PathBuf::from(directory).join(build)) - .unwrap_or_else(|| Self::root().join(format!("target/{}", &build))) + .unwrap_or_else(|| Self::root().join(format!("target/{}", build))) }; path.push("warp"); diff --git a/app/src/util/openable_file_type.rs b/app/src/util/openable_file_type.rs index afc4f4fa..03767bc8 100644 --- a/app/src/util/openable_file_type.rs +++ b/app/src/util/openable_file_type.rs @@ -98,7 +98,7 @@ pub(crate) fn starts_with_shebang(path: &Path) -> bool { use std::io::Read; let mut prefix = [0u8; 2]; match std::fs::File::open(path) { - Ok(mut file) => file.read_exact(&mut prefix).is_ok() && prefix == [b'#', b'!'], + Ok(mut file) => file.read_exact(&mut prefix).is_ok() && prefix == *b"#!", Err(_) => false, } } diff --git a/app/src/workspace/view.rs b/app/src/workspace/view.rs index 874f92e6..3ee097eb 100644 --- a/app/src/workspace/view.rs +++ b/app/src/workspace/view.rs @@ -13444,13 +13444,7 @@ impl Workspace { .map(|(terminal_surface_id, _)| terminal_surface_id); // An empty prompt should not be provided as a query for the new forked conversation. - let initial_prompt = initial_prompt.and_then(|prompt| { - if prompt.trim().is_empty() { - None - } else { - Some(prompt) - } - }); + let initial_prompt = initial_prompt.filter(|prompt| !prompt.trim().is_empty()); // True when the fork is paired with a follow-up that fires immediately after restore // (a prompt to send, or a `/summarize` triggered by `summarize_after_fork`). diff --git a/crates/ai/src/diff_validation/mod.rs b/crates/ai/src/diff_validation/mod.rs index 27f4e163..656c00e5 100644 --- a/crates/ai/src/diff_validation/mod.rs +++ b/crates/ai/src/diff_validation/mod.rs @@ -175,7 +175,7 @@ impl fmt::Debug for DiffDelta { write!( f, "DiffDelta {{\nreplacement_line_range: {:?},", - &self.replacement_line_range + self.replacement_line_range )?; f.write_str("\n--insertion--\n")?; f.write_str(&self.insertion)?; @@ -709,7 +709,7 @@ fn score_matches( log::debug!( "Closest match with score {}:\n{}", max_similarity, - &target_lines[range].join("\n") + target_lines[range].join("\n") ); } } diff --git a/crates/ai/src/index/full_source_code_embedding/codebase_index.rs b/crates/ai/src/index/full_source_code_embedding/codebase_index.rs index e55d117e..19b7af0b 100644 --- a/crates/ai/src/index/full_source_code_embedding/codebase_index.rs +++ b/crates/ai/src/index/full_source_code_embedding/codebase_index.rs @@ -664,7 +664,7 @@ impl CodebaseIndex { if galaxy_core::channel::ChannelState::enable_debug_features() { log::debug!( "Trying to upsert changed files: {:?}", - &changed_files.upsertions + changed_files.upsertions ); } let (upserted_nodes, upsertion_fragment_metadata_updates) = diff --git a/crates/editor/src/content/markdown.rs b/crates/editor/src/content/markdown.rs index 49c4a5aa..c7bc780c 100644 --- a/crates/editor/src/content/markdown.rs +++ b/crates/editor/src/content/markdown.rs @@ -106,7 +106,7 @@ impl<'a> BufferMarkdownParser<'a> { } BufferBlockStyle::CodeBlock { code_block_type } => res.push_str(&format!( "```{}\n", - &code_block_type.to_markdown_representation(self.style) + code_block_type.to_markdown_representation(self.style) )), BufferBlockStyle::TaskList { indent_level, diff --git a/crates/editor/src/render/model/mod.rs b/crates/editor/src/render/model/mod.rs index 8985db05..410e4cd4 100644 --- a/crates/editor/src/render/model/mod.rs +++ b/crates/editor/src/render/model/mod.rs @@ -2892,7 +2892,7 @@ impl RenderState { log::trace!( "Incoming block replacements {:?}", - &pending_edit.laid_out_line + pending_edit.laid_out_line ); let hidden_range_clone = hidden_ranges.clone(); @@ -3042,7 +3042,7 @@ impl RenderState { for range in ranges { let hidden_range_size = range.end - range.start - 1; - log::trace!("==== Processing range: {:?} ====", &range); + log::trace!("==== Processing range: {:?} ====", range); new_tree.push_tree(cursor.slice(&range.start, SeekBias::Left)); log::trace!("After pushing prefix tree:\n {}", new_tree.describe()); let sub_tree = cursor.slice(&range.end, SeekBias::Right); diff --git a/crates/galaxy_completer/src/signatures/legacy/registry.rs b/crates/galaxy_completer/src/signatures/legacy/registry.rs index 47c24dfd..2a8e2ec6 100644 --- a/crates/galaxy_completer/src/signatures/legacy/registry.rs +++ b/crates/galaxy_completer/src/signatures/legacy/registry.rs @@ -252,7 +252,7 @@ impl CommandRegistry { log::debug!( "Execution of `{}` failed with output: {}", command_to_run, - &output_string + output_string ) } } diff --git a/crates/galaxyui/src/platform/mac/event.rs b/crates/galaxyui/src/platform/mac/event.rs index 112eef20..69c23bf7 100644 --- a/crates/galaxyui/src/platform/mac/event.rs +++ b/crates/galaxyui/src/platform/mac/event.rs @@ -77,11 +77,9 @@ pub unsafe fn from_native( .to_str() .ok()?; - let unmodified_chars = if let Some(first_char) = unmodified_chars.chars().next() { - unicode_char_to_key(first_char as u16).unwrap_or(unmodified_chars) - } else { - return None; - }; + let first_char = unmodified_chars.chars().next()?; + let unmodified_chars = + unicode_char_to_key(first_char as u16).unwrap_or(unmodified_chars); let keystroke = Keystroke { ctrl: native_modifiers.contains(NSEventModifierFlags::Control), diff --git a/crates/galaxyui_core/src/core/app.rs b/crates/galaxyui_core/src/core/app.rs index f3f03498..ffde3d8c 100644 --- a/crates/galaxyui_core/src/core/app.rs +++ b/crates/galaxyui_core/src/core/app.rs @@ -1647,7 +1647,7 @@ impl AppContext { // If there are no handlers registered for the given action, then we can return early // without needing to look at the responder chain at all, since no views will handle it let Some(mut handlers) = self.typed_actions.remove(&action_type) else { - log::warn!("Dispatched action has no handlers: {:?}", &action); + log::warn!("Dispatched action has no handlers: {action:?}"); return false; }; @@ -1716,7 +1716,7 @@ impl AppContext { arg: &dyn Any, ) { if let Some((name, mut handlers)) = self.global_actions.remove_entry(name) { - log::info!("dispatching global action for {}", &name); + log::info!("dispatching global action for {name}"); self.pending_flushes += 1; for handler in handlers.iter_mut().rev() { handler(arg, location, self); @@ -3716,7 +3716,7 @@ impl AppContext { if font_family_bytes.is_empty() { log::warn!( "Failed to load any fonts for the family {}", - &fallback_family.name + fallback_family.name ); return; } diff --git a/crates/graphql/src/client.rs b/crates/graphql/src/client.rs index dd05cbe0..e9d02d5c 100644 --- a/crates/graphql/src/client.rs +++ b/crates/graphql/src/client.rs @@ -92,7 +92,7 @@ where "{}{}/graphql/v2?op={}", ChannelState::server_root_url(), options.path_prefix.unwrap_or_default(), - &operation_name + operation_name ); let mut req = client.post(&graphql_endpoint).json(&operation); diff --git a/crates/input_classifier/src/heuristic_classifier/mod.rs b/crates/input_classifier/src/heuristic_classifier/mod.rs index 68c56b69..33178da4 100644 --- a/crates/input_classifier/src/heuristic_classifier/mod.rs +++ b/crates/input_classifier/src/heuristic_classifier/mod.rs @@ -43,7 +43,7 @@ impl InputClassifier for HeuristicClassifier { log::info!( "[input-classifier] detect_input_type called: buffer={:?}, word_tokens={}, current={:?}", - &input.buffer_text, + input.buffer_text, total_word_token_count, context.current_input_type ); diff --git a/crates/integration/src/util.rs b/crates/integration/src/util.rs index 2ec7e285..4b43b7af 100644 --- a/crates/integration/src/util.rs +++ b/crates/integration/src/util.rs @@ -196,7 +196,7 @@ pub fn write_histfiles_for_test

( contents } }; - println!("histfile path:{:?}", &path); + println!("histfile path:{:?}", path); if let Err(e) = write(&path, histfile_contents.as_bytes()) { panic!("Could not write histfile {:?}: {}", path.to_str(), e); } diff --git a/crates/ipc/src/testing.rs b/crates/ipc/src/testing.rs index e525595a..d3ddd865 100644 --- a/crates/ipc/src/testing.rs +++ b/crates/ipc/src/testing.rs @@ -68,7 +68,7 @@ where match response { Some(result) => result, None => { - panic!("Unexpected IPC call with request: {:?}", &request); + panic!("Unexpected IPC call with request: {:?}", request); } } } diff --git a/crates/persistence/src/model.rs b/crates/persistence/src/model.rs index dd849508..df6942c6 100644 --- a/crates/persistence/src/model.rs +++ b/crates/persistence/src/model.rs @@ -1088,6 +1088,9 @@ pub struct LocalAgentGroup { #[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct AgentConversationData { + /// Display-only tool intent, scoped to this conversation and keyed by call ID. + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub tool_titles: HashMap, #[serde(default, skip_serializing_if = "AgentBackend::is_provider")] pub agent_backend: AgentBackend, /// Versioned application-owned snapshot for an active direct-provider run. diff --git a/crates/persistence/src/model_tests.rs b/crates/persistence/src/model_tests.rs index b7be99bf..f763c8cd 100644 --- a/crates/persistence/src/model_tests.rs +++ b/crates/persistence/src/model_tests.rs @@ -139,6 +139,7 @@ fn agent_conversation_data_roundtrips_last_event_sequence() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -243,6 +244,7 @@ fn agent_conversation_data_roundtrips_remote_child_marker() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -272,6 +274,7 @@ fn agent_conversation_data_roundtrips_optimistic_root_marker() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -313,6 +316,7 @@ fn agent_conversation_data_skips_serializing_none_last_event_sequence() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -344,6 +348,7 @@ fn agent_conversation_data_roundtrips_pinned() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -373,6 +378,7 @@ fn agent_conversation_data_skips_serializing_unpinned() { agent_backend: Default::default(), active_provider_run_json: None, local_agent_groups: Vec::new(), + tool_titles: Default::default(), server_conversation_token: None, conversation_usage_metadata: None, reverted_action_ids: None, @@ -436,3 +442,16 @@ fn model_token_usage_replay_skips_non_custom_endpoint_entries() { }; assert!(warp_only.to_proto_custom_endpoint_usage().is_none()); } + +#[test] +fn tool_titles_survive_roundtrip_and_are_optional_for_old_conversations() { + let mut data = AgentConversationData::default(); + data.tool_titles + .insert("call-1".into(), "Find cache invalidation paths".into()); + let mut json = serde_json::to_value(&data).unwrap(); + let restored: AgentConversationData = serde_json::from_value(json.clone()).unwrap(); + assert_eq!(restored.tool_titles, data.tool_titles); + json.as_object_mut().unwrap().remove("tool_titles"); + let legacy: AgentConversationData = serde_json::from_value(json).unwrap(); + assert!(legacy.tool_titles.is_empty()); +} diff --git a/crates/simple_logger/src/lib.rs b/crates/simple_logger/src/lib.rs index 6396bded..170d238f 100644 --- a/crates/simple_logger/src/lib.rs +++ b/crates/simple_logger/src/lib.rs @@ -111,7 +111,7 @@ impl SimpleLogger { let mut log_file = match open_truncated(&log_path).await { Ok(log_file) => log_file, Err(e) => { - log::warn!("Could not open file for logging: {:?}. {:?}", &log_path, e); + log::warn!("Could not open file for logging: {:?}. {:?}", log_path, e); return; } }; @@ -153,7 +153,7 @@ impl SimpleLogger { "SimpleLogger: rotation failed for {:?}: {e}; \ preserving existing log content and continuing \ in append mode", - &log_path, + log_path, ); true } @@ -169,7 +169,7 @@ impl SimpleLogger { log::warn!( "SimpleLogger: failed to reopen {:?} after \ rotation: {e}", - &log_path, + log_path, ); return; } diff --git a/crates/virtual_fs/src/lib.rs b/crates/virtual_fs/src/lib.rs index 6e403a65..447c7305 100644 --- a/crates/virtual_fs/src/lib.rs +++ b/crates/virtual_fs/src/lib.rs @@ -172,7 +172,7 @@ impl Warp { std::env::var("CARGO_TARGET_DIR") .ok() .map(|directory| PathBuf::from(directory).join(build)) - .unwrap_or_else(|| Self::root().join(format!("target/{}", &build))) + .unwrap_or_else(|| Self::root().join(format!("target/{}", build))) }; path.push("warp");