Skip to content

Commit e5dcc18

Browse files
coolcom200oz-agent
andcommitted
Address fetched memory toolbar review comments
- Remove the extra fetched_memories_chip feature flag - Restore ModelSelector to the default right toolbar item list Co-Authored-By: Oz <oz-agent@warp.dev>
1 parent 2e2605f commit e5dcc18

7 files changed

Lines changed: 27 additions & 73 deletions

File tree

app/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,6 @@ cloud_mode_input_v2 = ["cloud_mode"]
10211021
handoff_cloud_cloud = ["cloud_mode_setup_v2"]
10221022
git_credential_refresh = []
10231023
prompt_cache_expiry_warning = []
1024-
fetched_memories_chip = []
10251024

10261025
[package.metadata.bundle.bin.warp-oss]
10271026
category = "public.app-category.developer-tools"

app/src/ai/agent/api/convert_conversation.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,11 +1648,11 @@ pub(crate) fn convert_tool_call_result_to_input(
16481648
// Deprecated/unused result types or absent result.
16491649
Some(ToolCallResultType::SuggestCreatePlan(..))
16501650
| Some(ToolCallResultType::SuggestPlan(..))
1651-
| Some(ToolCallResultType::WaitForEvents(..))
16521651
| None => {
16531652
log::warn!("No result present for tool call ID: {tool_call_id}");
16541653
None
16551654
}
1655+
Some(ToolCallResultType::WaitForEvents(_)) => None,
16561656
}
16571657
}
16581658

@@ -1764,7 +1764,6 @@ fn create_cancelled_result_for_tool_call(
17641764
return None;
17651765
}
17661766
ToolType::Subagent(_) => return None,
1767-
ToolType::WaitForEvents(_) => return None,
17681767
ToolType::StartAgent(_) => {
17691768
AIAgentActionResultType::StartAgent(StartAgentResult::Cancelled {
17701769
version: StartAgentVersion::V1,
@@ -1786,6 +1785,9 @@ fn create_cancelled_result_for_tool_call(
17861785
}
17871786
// These tools are deprecated.
17881787
ToolType::SuggestCreatePlan(_) | ToolType::SuggestPlan(_) => return None,
1788+
ToolType::WaitForEvents(_) => {
1789+
return None;
1790+
}
17891791
};
17901792

17911793
Some(AIAgentInput::ActionResult {

app/src/ai/agent/conversation.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,17 +1186,18 @@ impl AIConversation {
11861186

11871187
/// Returns the memories the server fetched for this conversation, in the order they first
11881188
/// appeared across messages (server-side rank order within each message). Re-fetched
1189-
/// memories are deduped by `memory_id`: the first appearance keeps its position while the
1190-
/// entry's content/store/source are updated to the latest occurrence.
1189+
/// memories are deduped by `(memory_store_id, memory_id)`: the first appearance keeps its
1190+
/// position while the entry's content/source are updated to the latest occurrence.
11911191
pub fn fetched_memories(&self) -> Vec<api::message::FetchedMemory> {
11921192
let mut memories: Vec<api::message::FetchedMemory> = Vec::new();
1193-
let mut index_by_id: HashMap<String, usize> = HashMap::new();
1193+
let mut index_by_id: HashMap<(String, String), usize> = HashMap::new();
11941194
for message in self.task_store.all_linearized_messages() {
11951195
for memory in &message.fetched_memories {
1196-
match index_by_id.get(&memory.memory_id) {
1196+
let key = (memory.memory_store_id.clone(), memory.memory_id.clone());
1197+
match index_by_id.get(&key) {
11971198
Some(index) => memories[*index] = memory.clone(),
11981199
None => {
1199-
index_by_id.insert(memory.memory_id.clone(), memories.len());
1200+
index_by_id.insert(key, memories.len());
12001201
memories.push(memory.clone());
12011202
}
12021203
}

app/src/ai/agent/conversation_tests.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -826,15 +826,18 @@ fn fetched_memories_preserves_order_across_and_within_messages() {
826826
fn fetched_memories_dedupes_keeping_first_position_and_latest_data() {
827827
let conversation = restored_conversation_with_memories_per_query(vec![
828828
vec![
829-
fetched_memory("m1", "old content", "store-old", None),
829+
fetched_memory("m1", "old content", "store-1", None),
830830
fetched_memory("m2", "other", "store-1", None),
831831
],
832-
vec![fetched_memory(
833-
"m1",
834-
"new content",
835-
"store-new",
836-
conversation_source("conversation-1"),
837-
)],
832+
vec![
833+
fetched_memory(
834+
"m1",
835+
"new content",
836+
"store-1",
837+
conversation_source("conversation-1"),
838+
),
839+
fetched_memory("m1", "same memory id different store", "store-2", None),
840+
],
838841
]);
839842

840843
let memories = conversation.fetched_memories();
@@ -844,10 +847,11 @@ fn fetched_memories_dedupes_keeping_first_position_and_latest_data() {
844847
fetched_memory(
845848
"m1",
846849
"new content",
847-
"store-new",
850+
"store-1",
848851
conversation_source("conversation-1"),
849852
),
850853
fetched_memory("m2", "other", "store-1", None),
854+
fetched_memory("m1", "same memory id different store", "store-2", None),
851855
]
852856
);
853857
}

app/src/ai/blocklist/agent_view/agent_input_footer/toolbar_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,8 @@ impl AgentToolbarItemKind {
211211
let mut items = vec![
212212
Self::ContextChip(ContextChipKind::AgentPlanAndTodoList),
213213
Self::ContextWindowUsage,
214+
Self::ModelSelector,
214215
];
215-
items.push(Self::ModelSelector);
216216
if FeatureFlag::CreatingSharedSessions.is_enabled()
217217
&& FeatureFlag::HOARemoteControl.is_enabled()
218218
{

app/src/server/telemetry/events.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -990,6 +990,8 @@ pub enum AgentModeCitation {
990990
#[serde(skip_serializing)]
991991
url: String,
992992
},
993+
/// A fetched memory surfaced as a citation so we can track whether memory-backed
994+
/// responses are shown to users and whether users open those memory citations.
993995
AgentMemory {
994996
memory_store_id: String,
995997
memory_id: String,

crates/ai/src/agent/citation.rs

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
use std::fmt::Display;
2-
use std::hash::{Hash, Hasher};
32

43
use warp_multi_agent_api as api;
54

65
/// A citation listed in an AI response.
7-
#[derive(Debug, Clone)]
6+
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
87
pub enum AIAgentCitation {
98
WarpDriveObject {
109
uid: String,
@@ -16,67 +15,14 @@ pub enum AIAgentCitation {
1615
url: String,
1716
},
1817
/// A memory from an attached memory store. `content` is the raw memory
19-
/// text shown as a preview in the chip; `Hash`/`Eq` use only the IDs.
18+
/// text shown as a preview in the chip.
2019
AgentMemory {
2120
memory_store_id: String,
2221
memory_id: String,
2322
content: String,
2423
},
2524
}
2625

27-
impl PartialEq for AIAgentCitation {
28-
fn eq(&self, other: &Self) -> bool {
29-
match (self, other) {
30-
(Self::WarpDriveObject { uid: a }, Self::WarpDriveObject { uid: b }) => a == b,
31-
(Self::WarpDocumentation { path: a }, Self::WarpDocumentation { path: b }) => a == b,
32-
(Self::WebPage { url: a }, Self::WebPage { url: b }) => a == b,
33-
(
34-
Self::AgentMemory {
35-
memory_store_id: s1,
36-
memory_id: i1,
37-
..
38-
},
39-
Self::AgentMemory {
40-
memory_store_id: s2,
41-
memory_id: i2,
42-
..
43-
},
44-
) => s1 == s2 && i1 == i2,
45-
_ => false,
46-
}
47-
}
48-
}
49-
50-
impl Eq for AIAgentCitation {}
51-
52-
impl Hash for AIAgentCitation {
53-
fn hash<H: Hasher>(&self, state: &mut H) {
54-
match self {
55-
Self::WarpDriveObject { uid } => {
56-
0u8.hash(state);
57-
uid.hash(state);
58-
}
59-
Self::WarpDocumentation { path } => {
60-
1u8.hash(state);
61-
path.hash(state);
62-
}
63-
Self::WebPage { url } => {
64-
2u8.hash(state);
65-
url.hash(state);
66-
}
67-
Self::AgentMemory {
68-
memory_store_id,
69-
memory_id,
70-
..
71-
} => {
72-
3u8.hash(state);
73-
memory_store_id.hash(state);
74-
memory_id.hash(state);
75-
}
76-
}
77-
}
78-
}
79-
8026
impl Display for AIAgentCitation {
8127
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
8228
match self {

0 commit comments

Comments
 (0)