mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
feat: fix hinting 3 (#19963)
Fix https://github.com/openai/codex/pull/19805#discussion_r3153265562
This commit is contained in:
committed by
GitHub
Unverified
parent
b7c0f26910
commit
54d1401170
@@ -394,6 +394,7 @@ impl AgentControl {
|
||||
if let Some(parent_thread) = parent_thread.as_ref() {
|
||||
parent_thread
|
||||
.codex
|
||||
.session
|
||||
.configured_multi_agent_v2_usage_hint_texts()
|
||||
.await
|
||||
} else if config.features.enabled(Feature::MultiAgentV2) {
|
||||
|
||||
@@ -764,22 +764,6 @@ impl Codex {
|
||||
state.session_configuration.thread_config_snapshot()
|
||||
}
|
||||
|
||||
pub(crate) async fn configured_multi_agent_v2_usage_hint_texts(&self) -> Vec<String> {
|
||||
let state = self.session.state.lock().await;
|
||||
let config = &state.session_configuration.original_config_do_not_use;
|
||||
if !config.features.enabled(Feature::MultiAgentV2) {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
[
|
||||
config.multi_agent_v2.root_agent_usage_hint_text.clone(),
|
||||
config.multi_agent_v2.subagent_usage_hint_text.clone(),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn state_db(&self) -> Option<state_db::StateDbHandle> {
|
||||
self.session.state_db()
|
||||
}
|
||||
@@ -857,6 +841,22 @@ impl Session {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) async fn configured_multi_agent_v2_usage_hint_texts(&self) -> Vec<String> {
|
||||
if !self.features.enabled(Feature::MultiAgentV2) {
|
||||
return Vec::new();
|
||||
}
|
||||
|
||||
let state = self.state.lock().await;
|
||||
let config = &state.session_configuration.original_config_do_not_use;
|
||||
[
|
||||
config.multi_agent_v2.root_agent_usage_hint_text.clone(),
|
||||
config.multi_agent_v2.subagent_usage_hint_text.clone(),
|
||||
]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn managed_network_proxy_active_for_permission_profile(
|
||||
permission_profile: &PermissionProfile,
|
||||
) -> bool {
|
||||
|
||||
@@ -5431,6 +5431,40 @@ async fn build_initial_context_omits_multi_agent_v2_usage_hints_when_feature_dis
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn configured_multi_agent_v2_usage_hint_texts_use_effective_enabled_feature_state() {
|
||||
let (mut session, _turn_context) =
|
||||
make_multi_agent_v2_usage_hint_test_session(/*enable_multi_agent_v2*/ false).await;
|
||||
let mut effective_features = Features::with_defaults();
|
||||
effective_features.enable(Feature::MultiAgentV2);
|
||||
Arc::get_mut(&mut session)
|
||||
.expect("session should not be shared")
|
||||
.features = effective_features.into();
|
||||
|
||||
let hint_texts = session.configured_multi_agent_v2_usage_hint_texts().await;
|
||||
|
||||
assert_eq!(
|
||||
hint_texts,
|
||||
vec![
|
||||
"Root guidance.".to_string(),
|
||||
"Subagent guidance.".to_string()
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn configured_multi_agent_v2_usage_hint_texts_omit_effectively_disabled_feature() {
|
||||
let (mut session, _turn_context) =
|
||||
make_multi_agent_v2_usage_hint_test_session(/*enable_multi_agent_v2*/ true).await;
|
||||
Arc::get_mut(&mut session)
|
||||
.expect("session should not be shared")
|
||||
.features = Features::with_defaults().into();
|
||||
|
||||
let hint_texts = session.configured_multi_agent_v2_usage_hint_texts().await;
|
||||
|
||||
assert_eq!(hint_texts, Vec::<String>::new());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn build_initial_context_omits_default_image_save_location_with_image_history() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
|
||||
Reference in New Issue
Block a user