Add back regular tasks

This commit is contained in:
jif-oai
2025-12-16 14:54:07 +00:00
parent 6b006b8672
commit 5cfb225f99
5 changed files with 59 additions and 3 deletions

View File

@@ -1935,6 +1935,7 @@ mod handlers {
use crate::review_prompts::resolve_review_request;
use crate::tasks::CollaborationTask;
use crate::tasks::CompactTask;
use crate::tasks::RegularTask;
use crate::tasks::UndoTask;
use crate::tasks::UserShellCommandTask;
use codex_protocol::custom_prompts::CustomPrompt;
@@ -2015,8 +2016,13 @@ mod handlers {
.await;
}
sess.spawn_task(Arc::clone(&current_context), items, CollaborationTask)
.await;
if sess.enabled(Feature::MultiAgents) {
sess.spawn_task(Arc::clone(&current_context), items, CollaborationTask)
.await;
} else {
sess.spawn_task(Arc::clone(&current_context), items, RegularTask)
.await;
}
*previous_context = Some(current_context);
}
}

View File

@@ -64,6 +64,8 @@ pub enum Feature {
ShellSnapshot,
/// Experimental TUI v2 (viewport) implementation.
Tui2,
/// Enable multi-agent collaboration workflows.
MultiAgents,
}
impl Feature {
@@ -353,6 +355,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::Experimental,
default_enabled: false,
},
FeatureSpec {
id: Feature::MultiAgents,
key: "multi_agents",
stage: Stage::Experimental,
default_enabled: false,
},
FeatureSpec {
id: Feature::ShellSnapshot,
key: "shell_snapshot",

View File

@@ -1,6 +1,7 @@
mod collaboration;
mod compact;
mod ghost_snapshot;
mod regular;
mod review;
mod undo;
mod user_shell;
@@ -33,6 +34,7 @@ pub(crate) use collaboration::CollaborationSupervisor;
pub(crate) use collaboration::CollaborationTask;
pub(crate) use compact::CompactTask;
pub(crate) use ghost_snapshot::GhostSnapshotTask;
pub(crate) use regular::RegularTask;
pub(crate) use review::ReviewTask;
pub(crate) use undo::UndoTask;
pub(crate) use user_shell::UserShellCommandTask;

View File

@@ -0,0 +1,39 @@
use std::sync::Arc;
use async_trait::async_trait;
use codex_protocol::user_input::UserInput;
use tokio_util::sync::CancellationToken;
use tracing::Instrument;
use tracing::info_span;
use crate::codex::TurnContext;
use crate::codex::run_task;
use crate::state::TaskKind;
use super::SessionTask;
use super::SessionTaskContext;
#[derive(Clone, Copy, Default)]
pub(crate) struct RegularTask;
#[async_trait]
impl SessionTask for RegularTask {
fn kind(&self) -> TaskKind {
TaskKind::Regular
}
async fn run(
self: Arc<Self>,
session: Arc<SessionTaskContext>,
ctx: Arc<TurnContext>,
input: Vec<UserInput>,
cancellation_token: CancellationToken,
) -> Option<String> {
let sess = session.clone_session();
let run_task_span =
info_span!(parent: sess.services.otel_manager.current_span(), "run_task");
run_task(sess, ctx, input, cancellation_token)
.instrument(run_task_span)
.await
}
}

View File

@@ -51,6 +51,7 @@ Supported features:
| `enable_experimental_windows_sandbox` | false | Experimental | Use the Windows restricted-token sandbox |
| `tui2` | false | Experimental | Use the experimental TUI v2 (viewport) implementation |
| `skills` | false | Experimental | Enable discovery and injection of skills |
| `multi_agents` | false | Experimental | Enable multi-agent collaboration workflows |
Notes:
@@ -59,7 +60,7 @@ Notes:
## Agent profiles
Codex can optionally load multi-agent profiles from `$CODEX_HOME/agents.toml`. When this file exists and is valid, Codex starts as the `main` profile (agent 0) and, on supported models, exposes the `collaboration_*` tools. Each profile can control which sub-agents it can spawn.
Codex can optionally load multi-agent profiles from `$CODEX_HOME/agents.toml`. When this file exists and is valid, Codex starts as the `main` profile (agent 0) and, on supported models, exposes the `collaboration_*` tools. Each profile can control which sub-agents it can spawn. Enable the `multi_agents` feature flag to run the collaboration workflow.
Example: