Improve agent prompting and classifier latency; clean up build warnings
This commit is contained in:
@@ -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<T: Scorer>(
|
||||
log::debug!(
|
||||
"Closest match with score {}:\n{}",
|
||||
max_similarity,
|
||||
&target_lines[range].join("\n")
|
||||
target_lines[range].join("\n")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) =
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -252,7 +252,7 @@ impl CommandRegistry {
|
||||
log::debug!(
|
||||
"Execution of `{}` failed with output: {}",
|
||||
command_to_run,
|
||||
&output_string
|
||||
output_string
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -196,7 +196,7 @@ pub fn write_histfiles_for_test<P>(
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String, String>,
|
||||
#[serde(default, skip_serializing_if = "AgentBackend::is_provider")]
|
||||
pub agent_backend: AgentBackend,
|
||||
/// Versioned application-owned snapshot for an active direct-provider run.
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user