mirror of
https://github.com/openai/codex.git
synced 2026-04-27 09:51:03 +03:00
merge upstream/dev/friel/watchdog-runtime-and-prompts into collab stack
This commit is contained in:
@@ -1203,13 +1203,6 @@ impl AgentControl {
|
||||
self.watchdogs.register(registration).await
|
||||
}
|
||||
|
||||
pub(crate) async fn unregister_watchdog(
|
||||
&self,
|
||||
target_thread_id: ThreadId,
|
||||
) -> Option<RemovedWatchdog> {
|
||||
self.watchdogs.unregister(target_thread_id).await
|
||||
}
|
||||
|
||||
pub(crate) async fn unregister_watchdogs_for_owner(
|
||||
&self,
|
||||
owner_thread_id: ThreadId,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//! which role to use; the multi-agent tool handler owns that orchestration.
|
||||
|
||||
use crate::config::AgentRoleConfig;
|
||||
use crate::config::AgentRoleSpawnMode;
|
||||
use crate::config::Config;
|
||||
use crate::config::ConfigOverrides;
|
||||
use crate::config::agent_roles::parse_agent_role_file_contents;
|
||||
@@ -28,16 +27,6 @@ use toml::Value as TomlValue;
|
||||
pub const DEFAULT_ROLE_NAME: &str = "default";
|
||||
const AGENT_TYPE_UNAVAILABLE_ERROR: &str = "agent type is currently not available";
|
||||
|
||||
pub(crate) fn default_spawn_mode_for_role(
|
||||
config: &Config,
|
||||
role_name: Option<&str>,
|
||||
) -> AgentRoleSpawnMode {
|
||||
let role_name = role_name.unwrap_or(DEFAULT_ROLE_NAME);
|
||||
resolve_role_config(config, role_name)
|
||||
.and_then(|role| role.spawn_mode)
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
||||
pub(crate) fn watchdog_interval_for_role(config: &Config, role_name: Option<&str>) -> Option<i64> {
|
||||
let role_name = role_name.unwrap_or(DEFAULT_ROLE_NAME);
|
||||
resolve_role_config(config, role_name).and_then(|role| role.watchdog_interval_s)
|
||||
|
||||
@@ -2191,26 +2191,6 @@ impl Session {
|
||||
self.active_turn.lock().await.is_some()
|
||||
}
|
||||
|
||||
pub(crate) async fn parent_thread_id(&self) -> Option<ThreadId> {
|
||||
let state = self.state.lock().await;
|
||||
match &state.session_configuration.session_source {
|
||||
SessionSource::SubAgent(SubAgentSource::ThreadSpawn {
|
||||
parent_thread_id, ..
|
||||
}) => Some(*parent_thread_id),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn mark_turn_used_agent_send_input(&self) {
|
||||
self.turn_used_agent_send_input
|
||||
.store(true, Ordering::Release);
|
||||
}
|
||||
|
||||
pub(crate) fn reset_turn_agent_send_input_flag(&self) {
|
||||
self.turn_used_agent_send_input
|
||||
.store(false, Ordering::Release);
|
||||
}
|
||||
|
||||
pub(crate) fn snapshot_agent_send_input_on_turn_complete(&self) {
|
||||
let used_agent_send_input = self
|
||||
.turn_used_agent_send_input
|
||||
|
||||
@@ -30,7 +30,6 @@ use crate::hook_runtime::record_additional_contexts;
|
||||
use crate::hook_runtime::record_pending_input;
|
||||
use crate::models_manager::manager::ModelsManager;
|
||||
use crate::protocol::EventMsg;
|
||||
use crate::protocol::TokenUsage;
|
||||
use crate::protocol::TurnAbortReason;
|
||||
use crate::protocol::TurnAbortedEvent;
|
||||
use crate::protocol::TurnCompleteEvent;
|
||||
@@ -417,20 +416,6 @@ impl Session {
|
||||
self.send_event(turn_context.as_ref(), event).await;
|
||||
}
|
||||
|
||||
async fn register_new_active_task(
|
||||
&self,
|
||||
task: RunningTask,
|
||||
token_usage_at_turn_start: TokenUsage,
|
||||
) {
|
||||
self.reset_turn_agent_send_input_flag();
|
||||
let mut active = self.active_turn.lock().await;
|
||||
let mut turn = ActiveTurn::default();
|
||||
let mut turn_state = turn.turn_state.lock().await;
|
||||
turn_state.token_usage_at_turn_start = token_usage_at_turn_start;
|
||||
drop(turn_state);
|
||||
turn.add_task(task);
|
||||
*active = Some(turn);
|
||||
}
|
||||
async fn take_active_turn(&self) -> Option<ActiveTurn> {
|
||||
let mut active = self.active_turn.lock().await;
|
||||
active.take()
|
||||
|
||||
@@ -43,21 +43,6 @@ pub(crate) fn parse_agent_id_target(target: &str) -> Result<ThreadId, FunctionCa
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) fn parse_agent_id_targets(
|
||||
targets: Vec<String>,
|
||||
) -> Result<Vec<ThreadId>, FunctionCallError> {
|
||||
if targets.is_empty() {
|
||||
return Err(FunctionCallError::RespondToModel(
|
||||
"agent ids must be non-empty".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
targets
|
||||
.into_iter()
|
||||
.map(|target| parse_agent_id_target(&target))
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) use close_agent::Handler as CloseAgentHandler;
|
||||
pub(crate) use compact_parent_context::Handler as CompactParentContextHandler;
|
||||
pub(crate) use list_agents::Handler as ListAgentsHandler;
|
||||
|
||||
@@ -36,8 +36,10 @@ impl ToolHandler for Handler {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct CompactParentContextArgs {
|
||||
reason: Option<String>,
|
||||
evidence: Option<String>,
|
||||
#[serde(rename = "reason")]
|
||||
_reason: Option<String>,
|
||||
#[serde(rename = "evidence")]
|
||||
_evidence: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
|
||||
@@ -283,7 +283,8 @@ impl ToolHandler for Handler {
|
||||
struct SpawnAgentArgs {
|
||||
message: Option<String>,
|
||||
items: Option<Vec<UserInput>>,
|
||||
task_name: Option<String>,
|
||||
#[serde(rename = "task_name")]
|
||||
_task_name: Option<String>,
|
||||
agent_type: Option<String>,
|
||||
model: Option<String>,
|
||||
model_fallback_list: Option<Vec<SpawnAgentModelFallbackCandidate>>,
|
||||
|
||||
@@ -985,7 +985,7 @@ mod inbox_feature_tests {
|
||||
let stage = spec.stage;
|
||||
|
||||
assert!(matches!(stage, Stage::Experimental { .. }));
|
||||
assert_eq!(stage.experimental_menu_name(), Some("Smart Approvals"));
|
||||
assert_eq!(stage.experimental_menu_name(), Some("Guardian Approvals"));
|
||||
assert_eq!(
|
||||
stage.experimental_menu_description().map(str::to_owned),
|
||||
Some(
|
||||
|
||||
Reference in New Issue
Block a user