Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions crates/goose/src/agents/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1139,8 +1139,8 @@ impl Agent {
let mode = session.and_then(|s| s.execution_mode.as_deref());

match mode {
Some("foreground") => "auto".to_string(),
Some("background") => "chat".to_string(),
Some("foreground") => "chat".to_string(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I never understood this code, how would chat help in either foreground or background mode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a good question. My understanding is:

  • This is only used in the default scheduler mode (not the temporal scheduler mode)

  • For temporal mode, it opens a new window with the foreground job.

  • I tested default mode with foreground job, it seems working as the same as background job except different mode. Just wondering do we still need foreground for default schedule job? @Kvadratni

Some("background") => "auto".to_string(),
_ => config
.get_param("GOOSE_MODE")
.unwrap_or_else(|_| "auto".to_string()),
Expand Down
11 changes: 11 additions & 0 deletions crates/goose/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,17 @@ async fn run_scheduled_job_internal(
),
})?;
}
if let Some(recipe_extensions) = recipe.extensions {
for extension in recipe_extensions {
agent
.add_extension(extension.clone())
.await
.map_err(|e| JobExecutionError {
job_id: job.id.clone(),
error: format!("Failed to add extension '{}': {}", extension.name(), e),
})?;
}
}

if let Err(e) = agent.update_provider(agent_provider).await {
return Err(JobExecutionError {
Expand Down
8 changes: 5 additions & 3 deletions ui/desktop/src/components/BaseChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function BaseChatContent({
chatState,
error,
setMessages,
input: _input,
input,
setInput: _setInput,
handleSubmit: engineHandleSubmit,
onStopGoose,
Expand Down Expand Up @@ -231,7 +231,9 @@ function BaseChatContent({
useEffect(() => {
const isProcessingResponse =
chatState !== ChatState.Idle && chatState !== ChatState.WaitingForUserInput;
handleAutoExecution(append, isProcessingResponse);
handleAutoExecution(append, isProcessingResponse, () => {
setHasStartedUsingRecipe(true);
});
}, [handleAutoExecution, append, chatState]);

// Use shared session continuation
Expand Down Expand Up @@ -528,7 +530,7 @@ function BaseChatContent({
chatState={chatState}
onStop={onStopGoose}
commandHistory={commandHistory}
initialValue={_input || ''}
initialValue={input || ''}
setView={setView}
numTokens={sessionTokenCount}
inputTokens={sessionInputTokens || localInputTokens}
Expand Down
9 changes: 7 additions & 2 deletions ui/desktop/src/hooks/useRecipeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt

// Get the recipe's initial prompt (always return the actual prompt, don't modify based on conversation state)
const initialPrompt = useMemo(() => {
if (!recipeConfig?.prompt || !recipeAccepted) {
if (!recipeConfig?.prompt || !recipeAccepted || recipeConfig?.isScheduledExecution) {
return '';
}

Expand Down Expand Up @@ -184,7 +184,11 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt
};

// Auto-execution handler for scheduled recipes
const handleAutoExecution = (append: (message: Message) => void, isLoading: boolean) => {
const handleAutoExecution = (
append: (message: Message) => void,
isLoading: boolean,
onAutoExecute?: () => void
) => {
const hasRequiredParams = recipeConfig?.parameters && recipeConfig.parameters.length > 0;

if (
Expand All @@ -205,6 +209,7 @@ export const useRecipeManager = (messages: Message[], locationState?: LocationSt

const userMessage = createUserMessage(finalPrompt);
append(userMessage);
onAutoExecute?.();
}
};

Expand Down
Loading