agent: Less disruptive changed file notification (#31693)
When the user edits one of the tracked files, we used to notify the agent by inserting a user message at the end of the thread. This was causing a few problems: - The agent would stop doing its work and start reading changed files - The agent would write something like, "Thank you for letting me know about these changed files." This fix contains two parts: 1. Changing the prompt to indicate this is a service message 2. Moving the message higher in the conversation thread This works, but it slightly hurts caching. We may consider making these notification messages stick in history, trading context tokens count for the cache. This might be related to #30906 Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
parent
92addb005a
commit
6df4c537b9
6 changed files with 140 additions and 30 deletions
|
@ -456,18 +456,18 @@ impl ActionLog {
|
|||
})?
|
||||
}
|
||||
|
||||
/// Track a buffer as read, so we can notify the model about user edits.
|
||||
/// Track a buffer as read by agent, so we can notify the model about user edits.
|
||||
pub fn buffer_read(&mut self, buffer: Entity<Buffer>, cx: &mut Context<Self>) {
|
||||
self.track_buffer_internal(buffer, false, cx);
|
||||
}
|
||||
|
||||
/// Mark a buffer as edited, so we can refresh it in the context
|
||||
/// Mark a buffer as created by agent, so we can refresh it in the context
|
||||
pub fn buffer_created(&mut self, buffer: Entity<Buffer>, cx: &mut Context<Self>) {
|
||||
self.edited_since_project_diagnostics_check = true;
|
||||
self.track_buffer_internal(buffer.clone(), true, cx);
|
||||
}
|
||||
|
||||
/// Mark a buffer as edited, so we can refresh it in the context
|
||||
/// Mark a buffer as edited by agent, so we can refresh it in the context
|
||||
pub fn buffer_edited(&mut self, buffer: Entity<Buffer>, cx: &mut Context<Self>) {
|
||||
self.edited_since_project_diagnostics_check = true;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue