Revert "Load Profile state from Thread and tie visibility to the thread's model" (#30413)

This reverts commit 3615d6d96c.

Ultimately, we want to restore the ability to store a profile
per-thread, but for now reverting this fixes a fairly disruptive bug.

Release Notes:

- Fixed a bug causing the agent to use the wrong profile in some cases.
This commit is contained in:
Cole Miller 2025-05-09 14:09:38 -04:00 committed by GitHub
parent 8f07135201
commit d6ab416168
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 44 deletions

View file

@ -5,7 +5,7 @@ use std::sync::Arc;
use std::time::Instant;
use anyhow::{Result, anyhow};
use assistant_settings::{AgentProfileId, AssistantSettings, CompletionMode};
use assistant_settings::{AssistantSettings, CompletionMode};
use assistant_tool::{ActionLog, AnyToolCard, Tool, ToolWorkingSet};
use chrono::{DateTime, Utc};
use collections::HashMap;
@ -359,7 +359,6 @@ pub struct Thread {
>,
remaining_turns: u32,
configured_model: Option<ConfiguredModel>,
configured_profile_id: Option<AgentProfileId>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -380,8 +379,6 @@ impl Thread {
) -> Self {
let (detailed_summary_tx, detailed_summary_rx) = postage::watch::channel();
let configured_model = LanguageModelRegistry::read_global(cx).default_model();
let assistant_settings = AssistantSettings::get_global(cx);
let configured_profile_id = assistant_settings.default_profile.clone();
Self {
id: ThreadId::new(),
@ -424,7 +421,6 @@ impl Thread {
request_callback: None,
remaining_turns: u32::MAX,
configured_model,
configured_profile_id: Some(configured_profile_id),
}
}
@ -472,8 +468,6 @@ impl Thread {
.completion_mode
.unwrap_or_else(|| AssistantSettings::get_global(cx).preferred_completion_mode);
let configured_profile_id = serialized.profile.clone();
Self {
id,
updated_at: serialized.updated_at,
@ -547,7 +541,6 @@ impl Thread {
request_callback: None,
remaining_turns: u32::MAX,
configured_model,
configured_profile_id,
}
}
@ -603,19 +596,6 @@ impl Thread {
cx.notify();
}
pub fn configured_profile_id(&self) -> Option<AgentProfileId> {
self.configured_profile_id.clone()
}
pub fn set_configured_profile_id(
&mut self,
id: Option<AgentProfileId>,
cx: &mut Context<Self>,
) {
self.configured_profile_id = id;
cx.notify();
}
pub const DEFAULT_SUMMARY: SharedString = SharedString::new_static("New Thread");
pub fn summary_or_default(&self) -> SharedString {
@ -1120,7 +1100,6 @@ impl Thread {
provider: model.provider.id().0.to_string(),
model: model.model.id().0.to_string(),
}),
profile: this.configured_profile_id.clone(),
completion_mode: Some(this.completion_mode),
})
})