Fix scheduled recipe session params (#9553)

Signed-off-by: Angie Jones <jones.angie@gmail.com>
This commit is contained in:
Angie Jones
2026-06-01 18:28:58 -05:00
committed by GitHub
parent f69a1780da
commit cd8f718bbb
3 changed files with 68 additions and 45 deletions
+56 -40
View File
@@ -468,27 +468,35 @@ async fn update_from_session(
status: StatusCode::INTERNAL_SERVER_ERROR,
})?;
if let Some(recipe) = session.recipe {
match build_recipe_with_parameter_values(
&recipe,
session.user_recipe_values.unwrap_or_default(),
)
.await
{
Ok(Some(recipe)) => {
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
if session.session_type == SessionType::Scheduled {
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
}
} else {
match build_recipe_with_parameter_values(
&recipe,
session.user_recipe_values.unwrap_or_default(),
)
.await
{
Ok(Some(recipe)) => {
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
}
}
Ok(None) => {
// Recipe has missing parameters
}
Err(e) => {
return Err(ErrorResponse {
message: e.to_string(),
status: StatusCode::INTERNAL_SERVER_ERROR,
});
}
}
Ok(None) => {
// Recipe has missing parameters
}
Err(e) => {
return Err(ErrorResponse {
message: e.to_string(),
status: StatusCode::INTERNAL_SERVER_ERROR,
});
}
}
}
@@ -758,27 +766,35 @@ async fn restart_agent_internal(
})?;
if let Some(ref recipe) = session.recipe {
match build_recipe_with_parameter_values(
recipe,
session.user_recipe_values.clone().unwrap_or_default(),
)
.await
{
Ok(Some(recipe)) => {
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
if session.session_type == SessionType::Scheduled {
if let Some(prompt) = apply_recipe_to_agent(&agent, recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
}
} else {
match build_recipe_with_parameter_values(
recipe,
session.user_recipe_values.clone().unwrap_or_default(),
)
.await
{
Ok(Some(recipe)) => {
if let Some(prompt) = apply_recipe_to_agent(&agent, &recipe, true).await {
agent
.extend_system_prompt("recipe".to_string(), prompt)
.await;
}
}
Ok(None) => {
// Recipe has missing parameters
}
Err(e) => {
return Err(ErrorResponse {
message: e.to_string(),
status: StatusCode::INTERNAL_SERVER_ERROR,
});
}
}
Ok(None) => {
// Recipe has missing parameters
}
Err(e) => {
return Err(ErrorResponse {
message: e.to_string(),
status: StatusCode::INTERNAL_SERVER_ERROR,
});
}
}
}