Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions app/src/ai/ambient_agents/task.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Ambient agent task types and utilities.

use anyhow::anyhow;
use chrono::{DateTime, Duration as ChronoDuration, Utc};
#[cfg(not(target_family = "wasm"))]
pub use cloud_object_models::HarnessModelConfig;
Expand Down Expand Up @@ -50,6 +49,11 @@ pub enum AgentSource {
GitHubWebhook,
CloudMode,
Orchestration,
Jira,
GitLabWebhook,
RunScorer,
Autofix,
BenchmarkTrial,
}

impl AgentSource {
Expand All @@ -68,6 +72,13 @@ impl AgentSource {
AgentSource::GitHubWebhook => "GITHUB_WEBHOOK",
AgentSource::CloudMode => "CLOUD_MODE",
AgentSource::Orchestration => "ORCHESTRATION",
AgentSource::Jira => "JIRA",
AgentSource::GitLabWebhook => "GITLAB_WEBHOOK",
AgentSource::RunScorer => "RUN_SCORER",
// The server surfaces the internal AUTOFIX task source under the public
// name SELF_IMPROVEMENT (mirrors AgentWebhook/"API" above).
AgentSource::Autofix => "SELF_IMPROVEMENT",
AgentSource::BenchmarkTrial => "BENCHMARK_TRIAL",
}
}

Expand All @@ -83,13 +94,23 @@ impl AgentSource {
AgentSource::GitHubAction => "GitHub Action",
AgentSource::GitHubWebhook => "GitHub",
AgentSource::Orchestration => "Orchestration",
AgentSource::Jira => "Jira",
AgentSource::GitLabWebhook => "GitLab",
AgentSource::RunScorer => "Scorer",
AgentSource::Autofix => "Self-improvement",
AgentSource::BenchmarkTrial => "Benchmark",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Benchmark" is an invented user-facing label: BENCHMARK_TRIAL has no entry in the web RUN_SOURCE_LABELS and is absent from the public RunSourceType, so no existing contract pins this string. Decide whether desktop should surface this internal source at all, and if so under which label, then pin the choice in a test.

Responding as wilson: Open session · View factory task

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open — this is the requester's call, not mine. Not resolving; waiting on his answer for whether/how BENCHMARK_TRIAL should surface on desktop before touching the label.

Responding as wilson: Open session · View factory task

}
}

/// Returns true when tasks from this source must not accept user-triggered cloud follow-ups.
pub fn blocks_cloud_followups(&self) -> bool {
match self {
AgentSource::GitHubAction | AgentSource::GitHubWebhook => true,
AgentSource::GitHubAction
| AgentSource::GitHubWebhook
| AgentSource::GitLabWebhook
| AgentSource::RunScorer
| AgentSource::Autofix
| AgentSource::BenchmarkTrial => true,
AgentSource::Linear
| AgentSource::AgentWebhook
| AgentSource::Slack
Expand All @@ -98,7 +119,8 @@ impl AgentSource {
| AgentSource::Interactive
| AgentSource::WebApp
| AgentSource::CloudMode
| AgentSource::Orchestration => false,
| AgentSource::Orchestration
| AgentSource::Jira => false,
}
}

Expand All @@ -110,13 +132,18 @@ impl AgentSource {
| AgentSource::Slack
| AgentSource::Interactive
| AgentSource::WebApp
| AgentSource::CloudMode => true,
| AgentSource::CloudMode
| AgentSource::Jira => true,
AgentSource::Cli
| AgentSource::ScheduledAgent
| AgentSource::AgentWebhook
| AgentSource::GitHubAction
| AgentSource::GitHubWebhook
| AgentSource::Orchestration => false,
| AgentSource::Orchestration
| AgentSource::GitLabWebhook
| AgentSource::RunScorer
| AgentSource::Autofix
| AgentSource::BenchmarkTrial => false,
}
}
}
Expand Down Expand Up @@ -158,8 +185,15 @@ where
"GITHUB_WEBHOOK" => Some(AgentSource::GitHubWebhook),
"CLOUD_MODE" => Some(AgentSource::CloudMode),
"ORCHESTRATION" => Some(AgentSource::Orchestration),
"JIRA" => Some(AgentSource::Jira),
"GITLAB_WEBHOOK" => Some(AgentSource::GitLabWebhook),
"RUN_SCORER" => Some(AgentSource::RunScorer),
// The server surfaces the internal AUTOFIX task source under the public
// name SELF_IMPROVEMENT; accept both spellings.
"AUTOFIX" | "SELF_IMPROVEMENT" => Some(AgentSource::Autofix),
"BENCHMARK_TRIAL" => Some(AgentSource::BenchmarkTrial),
_ => {
report_error!(anyhow!("Unknown AmbientAgentSource: {}", s));
log::warn!("Unknown AmbientAgentSource: {s}");
None
}
},
Expand Down
Loading