Skip to content

Commit c2ec352

Browse files
committed
fix(agent): correct tuple variant pattern + no-snapshot + error message
Three issues from Copilot review: 1. AgentCommand::Run { .. } -> AgentCommand::Run(_) — Run is a tuple variant; struct pattern does not compile. AgentCommand::RunCloud { .. } -> AgentCommand::RunCloud(_) for same reason (already correct in command_requires_cloud_services, now fixed in command_requires_hosted_auth). 2. Remove args.snapshot.no_snapshot from local_agent_run_uses_cloud_services. --no-snapshot only disables upload; snapshot upload is already skipped in local-only builds, so rejecting it is overly restrictive. 3. Improve cloud-service-unavailable error message to name the specific cloud-only flags (--task-id, --share, --environment) and clarify that 'cast-codes agent run' itself is valid in local-only builds.
1 parent a964c87 commit c2ec352

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

app/src/ai/agent_sdk/mod.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,8 @@ fn local_agent_run_uses_cloud_services(args: &RunAgentArgs) -> bool {
13971397
|| args.bedrock_inference_role.is_some()
13981398
|| args.conversation.is_some()
13991399
|| args.profile.is_some()
1400-
|| args.snapshot.no_snapshot
1400+
// --no-snapshot only disables upload; snapshot upload is already skipped in local-only
1401+
// builds, so treat it as a no-op rather than requiring cloud services.
14011402
|| args.snapshot.snapshot_upload_timeout.is_some()
14021403
|| args.snapshot.snapshot_script_timeout.is_some()
14031404
}
@@ -1406,8 +1407,8 @@ fn local_agent_run_uses_cloud_services(args: &RunAgentArgs) -> bool {
14061407
fn command_requires_hosted_auth(command: &CliCommand) -> bool {
14071408
match command {
14081409
CliCommand::Agent(agent_cmd) => match agent_cmd {
1409-
AgentCommand::Run { .. } => true,
1410-
AgentCommand::RunCloud { .. } => true,
1410+
AgentCommand::Run(_) => true,
1411+
AgentCommand::RunCloud(_) => true,
14111412
AgentCommand::Profile(sub) => match sub {
14121413
AgentProfileCommand::List => true,
14131414
},
@@ -1458,7 +1459,9 @@ fn launch_command(
14581459
) -> anyhow::Result<()> {
14591460
if !ChannelState::cloud_services_available() && command_requires_cloud_services(&command) {
14601461
return Err(anyhow::anyhow!(
1461-
"This command is unavailable in local-only CastCodes builds."
1462+
"This command requires cloud services (hosted tasks, accounts, or cloud-backed flags) \
1463+
which are unavailable in local-only CastCodes builds. \
1464+
Run without cloud-only flags (e.g. --task-id, --share, --environment) to use agent run locally."
14621465
));
14631466
}
14641467

0 commit comments

Comments
 (0)