Revert "Add reminder message about system prompt" (#28482)

This breaks the agentic loop.
This commit is contained in:
Antonio Scandurra 2025-04-09 22:12:33 -06:00 committed by GitHub
parent e20daa7639
commit 9dfb907f97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 73 deletions

View file

@ -1 +0,0 @@
In your response, make sure to remember and follow my instructions about how to format code blocks (and don't mention that you are remembering it, just follow the instructions).

View file

@ -1000,20 +1000,6 @@ impl Thread {
self.attached_tracked_files_state(&mut request.messages, cx);
// Add reminder to the last user message about code blocks
if let Some(last_user_message) = request
.messages
.iter_mut()
.rev()
.find(|msg| msg.role == Role::User)
{
last_user_message
.content
.push(MessageContent::Text(system_prompt_reminder(
&self.prompt_builder,
)));
}
request
}
@ -1889,12 +1875,6 @@ impl Thread {
}
}
pub fn system_prompt_reminder(prompt_builder: &prompt_store::PromptBuilder) -> String {
prompt_builder
.generate_assistant_system_prompt_reminder()
.unwrap_or_default()
}
#[derive(Debug, Clone)]
pub enum ThreadError {
PaymentRequired,
@ -1964,7 +1944,7 @@ mod tests {
)
.await;
let (_workspace, _thread_store, thread, context_store, prompt_builder) =
let (_workspace, _thread_store, thread, context_store) =
setup_test_environment(cx, project.clone()).await;
add_file_to_context(&project, &context_store, "test/code.rs", cx)
@ -2018,14 +1998,8 @@ fn main() {{
});
assert_eq!(request.messages.len(), 1);
let actual_message = request.messages[0].string_contents();
let expected_content = format!(
"{}Please explain this code{}",
expected_context,
system_prompt_reminder(&prompt_builder)
);
assert_eq!(actual_message, expected_content);
let expected_full_message = format!("{}Please explain this code", expected_context);
assert_eq!(request.messages[0].string_contents(), expected_full_message);
}
#[gpui::test]
@ -2042,7 +2016,7 @@ fn main() {{
)
.await;
let (_, _thread_store, thread, context_store, _prompt_builder) =
let (_, _thread_store, thread, context_store) =
setup_test_environment(cx, project.clone()).await;
// Open files individually
@ -2142,7 +2116,7 @@ fn main() {{
)
.await;
let (_, _thread_store, thread, _context_store, prompt_builder) =
let (_, _thread_store, thread, _context_store) =
setup_test_environment(cx, project.clone()).await;
// Insert user message without any context (empty context vector)
@ -2168,14 +2142,11 @@ fn main() {{
});
assert_eq!(request.messages.len(), 1);
let actual_message = request.messages[0].string_contents();
let expected_content = format!(
"What is the best way to learn Rust?{}",
system_prompt_reminder(&prompt_builder)
assert_eq!(
request.messages[0].string_contents(),
"What is the best way to learn Rust?"
);
assert_eq!(actual_message, expected_content);
// Add second message, also without context
let message2_id = thread.update(cx, |thread, cx| {
thread.insert_user_message("Are there any good books?", vec![], None, cx)
@ -2191,17 +2162,14 @@ fn main() {{
});
assert_eq!(request.messages.len(), 2);
// First message should be the system prompt
assert_eq!(request.messages[0].role, Role::User);
// Second message should be the user message with prompt reminder
let actual_message = request.messages[1].string_contents();
let expected_content = format!(
"Are there any good books?{}",
system_prompt_reminder(&prompt_builder)
assert_eq!(
request.messages[0].string_contents(),
"What is the best way to learn Rust?"
);
assert_eq!(
request.messages[1].string_contents(),
"Are there any good books?"
);
assert_eq!(actual_message, expected_content);
}
#[gpui::test]
@ -2214,7 +2182,7 @@ fn main() {{
)
.await;
let (_workspace, _thread_store, thread, context_store, prompt_builder) =
let (_workspace, _thread_store, thread, context_store) =
setup_test_environment(cx, project.clone()).await;
// Open buffer and add it to context
@ -2274,14 +2242,11 @@ fn main() {{
// The last message should be the stale buffer notification
assert_eq!(last_message.role, Role::User);
let actual_message = last_message.string_contents();
let expected_content = format!(
"These files changed since last read:\n- code.rs\n{}",
system_prompt_reminder(&prompt_builder)
);
// Check the exact content of the message
let expected_content = "These files changed since last read:\n- code.rs\n";
assert_eq!(
actual_message, expected_content,
last_message.string_contents(),
expected_content,
"Last message should be exactly the stale buffer notification"
);
}
@ -2319,27 +2284,24 @@ fn main() {{
Entity<ThreadStore>,
Entity<Thread>,
Entity<ContextStore>,
Arc<PromptBuilder>,
) {
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let prompt_builder = Arc::new(PromptBuilder::new(None).unwrap());
let thread_store = cx.update(|_, cx| {
ThreadStore::new(project.clone(), Arc::default(), prompt_builder.clone(), cx).unwrap()
ThreadStore::new(
project.clone(),
Arc::default(),
Arc::new(PromptBuilder::new(None).unwrap()),
cx,
)
.unwrap()
});
let thread = thread_store.update(cx, |store, cx| store.create_thread(cx));
let context_store = cx.new(|_cx| ContextStore::new(project.downgrade(), None));
(
workspace,
thread_store,
thread,
context_store,
prompt_builder,
)
(workspace, thread_store, thread, context_store)
}
async fn add_file_to_context(

View file

@ -261,12 +261,6 @@ impl PromptBuilder {
.render("assistant_system_prompt", context)
}
pub fn generate_assistant_system_prompt_reminder(&self) -> Result<String, RenderError> {
self.handlebars
.lock()
.render("assistant_system_prompt_reminder", &())
}
pub fn generate_inline_transformation_prompt(
&self,
user_prompt: String,