Skip to content

Commit a1a56dc

Browse files
szguptawarp-agent
andcommitted
Honor repository head overrides for agent runs
Co-Authored-By: Warp <agent@warp.dev>
1 parent e08ab1d commit a1a56dc

7 files changed

Lines changed: 1025 additions & 31 deletions

File tree

app/src/ai/agent_sdk/driver.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use repo_metadata::local_model::IndexedRepoState;
2222
use repo_metadata::{RepoMetadataModel, RepositoryIdentifier};
2323
use session_sharing_protocol::sharer::SessionRetentionReason;
2424
use uuid::Uuid;
25-
use warp_cli::agent::{Harness, OutputFormat};
25+
use warp_cli::agent::{Harness, OutputFormat, RepositoryHeadOverride};
2626
use warp_cli::mcp::MCPSpec;
2727
use warp_cli::share::ShareRequest;
2828
use warp_cli::skill::SkillSpec;
@@ -297,6 +297,8 @@ pub struct AgentDriverOptions {
297297
pub cloud_providers: Vec<Box<dyn cloud_provider::CloudProvider>>,
298298
/// Resolved environment configuration, if any.
299299
pub environment: Option<AmbientAgentEnvironment>,
300+
/// Overrides for repository HEADs in the agent's session.
301+
pub repository_head_overrides: Vec<RepositoryHeadOverride>,
300302
/// Selected execution harness for this run.
301303
pub selected_harness: Harness,
302304
/// Model config for the selected harness. Only used for non-Oz harnesses.
@@ -364,6 +366,7 @@ pub struct AgentDriver {
364366

365367
/// Resolved environment configuration.
366368
environment: Option<AmbientAgentEnvironment>,
369+
repository_head_overrides: Vec<RepositoryHeadOverride>,
367370

368371
// End-of-run snapshot upload controls.
369372
snapshot_disabled: bool,
@@ -635,6 +638,7 @@ impl AgentDriver {
635638
resume,
636639
cloud_providers,
637640
environment,
641+
repository_head_overrides,
638642
selected_harness,
639643
third_party_harness_model_config,
640644
snapshot_disabled,
@@ -761,6 +765,7 @@ impl AgentDriver {
761765
resume_payload,
762766
cloud_providers,
763767
environment,
768+
repository_head_overrides,
764769
snapshot_disabled: snapshot_disabled_value,
765770
snapshot_upload_timeout: snapshot_upload_timeout
766771
.unwrap_or(snapshot::DEFAULT_SNAPSHOT_UPLOAD_TIMEOUT),
@@ -805,6 +810,7 @@ impl AgentDriver {
805810
resume_payload: None,
806811
cloud_providers: Vec::new(),
807812
environment: None,
813+
repository_head_overrides: Vec::new(),
808814
snapshot_disabled: false,
809815
snapshot_upload_timeout: snapshot::DEFAULT_SNAPSHOT_UPLOAD_TIMEOUT,
810816
snapshot_script_timeout: snapshot::DEFAULT_DECLARATIONS_SCRIPT_TIMEOUT,
@@ -2156,7 +2162,9 @@ impl AgentDriver {
21562162
.await?;
21572163
let mut environment_skill_repos = Vec::new();
21582164

2159-
let environment_opt = foreground.spawn(|me, _| me.environment.clone()).await?;
2165+
let (environment_opt, repository_head_overrides) = foreground
2166+
.spawn(|me, _| (me.environment.clone(), me.repository_head_overrides.clone()))
2167+
.await?;
21602168

21612169
if let Some(environment) = environment_opt {
21622170
log::info!("Loading environment...");
@@ -2197,6 +2205,9 @@ impl AgentDriver {
21972205
working_dir,
21982206
false, /* is_sandbox */
21992207
harness,
2208+
environment::RepositoryHeadOverrideContext::new(
2209+
repository_head_overrides,
2210+
),
22002211
setup_events_for_environment,
22012212
ctx,
22022213
)

0 commit comments

Comments
 (0)