Skip to content

Conversation

@lifeizhou-ap
Copy link
Collaborator

@lifeizhou-ap lifeizhou-ap commented Jan 12, 2026

Summary

Fixed "Scheduler not available" error in issue #6405

Changes:

  1. Exclude schedule tool in CLI mode - Only add platform__manage_schedule tool when scheduler is available. In CLI mode, there's no persistent scheduler service running, so the tool would fail if the LLM tried to use it.

  2. Unified schedule file - CLI and Desktop now both use schedule.json (was using different files). Using schedule.json because Desktop users already have data in this file for scheduled job. For schedules.json created by CLI, the data in this file are not used to execute the recipe with schedule, it only used in run now which triggers the job manually. Losing this data has very minimal user impact.

  3. Refactoring: create_scheduler() helper to reduce duplication

  4. Improved tool description - Added "Goose" to description and all actions to prevent confusion with external schedulers

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit test and Manually Testing

Copilot AI review requested due to automatic review settings January 12, 2026 03:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the "Scheduler not available" error in CLI mode by conditionally including the schedule management tool only when a scheduler service is present. The PR also standardizes the scheduler storage filename from schedules.json to schedule.json throughout the codebase.

Changes:

  • Added scheduler availability check before including the schedule management tool in the available tools list
  • Updated error message in schedule tool handler to reflect that it should only be called when scheduler is available
  • Standardized scheduler storage filename to schedule.json (singular) across all files
  • Refactored CLI schedule commands to use a shared helper function for creating scheduler instances

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/goose/src/agents/agent.rs Added scheduler service availability check in list_tools to conditionally include schedule management tool
crates/goose/src/agents/schedule_tool.rs Updated error message to reflect internal assertion rather than user-facing error
crates/goose/src/agents/platform_tools.rs Updated tool description to clarify it manages "Goose's internal scheduled recipe execution"
crates/goose/src/scheduler.rs Standardized storage filename to schedule.json and improved error logging with path display
crates/goose/src/execution/manager.rs Refactored to use get_default_scheduler_storage_path() helper function
crates/goose/src/session/diagnostics.rs Removed duplicate schedules.json reference, keeping only schedule.json
crates/goose-cli/src/commands/schedule.rs Added create_scheduler() helper function to reduce code duplication
crates/goose/tests/agent.rs Updated tests to verify tool is not available without scheduler and added scheduler setup to tests requiring it

Copilot AI review requested due to automatic review settings January 12, 2026 04:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

- "delete": Remove a Goose scheduled job
- "kill": Terminate a currently running Goose scheduled job
- "inspect": Get details about a running Goose scheduled job
- "sessions": List execution history for a Goose scheduled job
Copy link
Collaborator

Choose a reason for hiding this comment

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

goose should not be capitalized. why is this change happening?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I am sorry that I forgot to mention this change in the PR summary. In the original issue, user has some prompts related to k8s that could be related to schedule and agent triggers the platform_schedule_tool. I guess the agent got confused with k8s scheduler with goose scheduler. That's why I added goose in the tool description, so that the agent won't use this tool when having the context with non goose schedule.

I will change to the goose instead of Goose

let (tools, _toolshim_tools, _system_prompt) =
agent.prepare_tools_and_prompt(&working_dir).await?;

// Ensure both platform and frontend tools are present
Copy link
Collaborator

Choose a reason for hiding this comment

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

or just delete this test

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I checked the code, it seems it still worthwhile to use this test to test the ordering of the tools. I changed the test name to reflect the purpose of this test.

LONG_RESPONSE_PROMPT="Count from 1 to 200, one number per line."

echo "Step 1: Creating session with first message (generating tokens for threshold)..."
(cd "$TESTDIR" && "$GOOSE_BIN" run --text "$LONG_RESPONSE_PROMPT" 2>&1) | tee "$OUTPUT"
Copy link
Collaborator

Choose a reason for hiding this comment

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

what happened here? from a different branch maybe?

Copy link
Collaborator Author

@lifeizhou-ap lifeizhou-ap Jan 12, 2026

Choose a reason for hiding this comment

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

Because we removed the platform_schedule_tool from CLI, the context usage is getting smaller and the original test prompt cannot reach to the context size to trigger the compact. So I changed the prompt to generate a bit longer response so that it reached to the threshold of 0.5% to trigger the compact

Copilot AI review requested due to automatic review settings January 12, 2026 23:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

ErrorData::new(
ErrorCode::INTERNAL_ERROR,
"Scheduler not available. This tool only works in server mode.".to_string(),
"Scheduler service should be available when schedule tool is called"
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

This error message will never be seen by users since the tool is now only added when the scheduler is available. Consider removing the defensive check or updating the error to indicate this is an internal error (bug) if it ever triggers.

Copilot generated this review using guidance from repository custom instructions.
@lifeizhou-ap lifeizhou-ap merged commit 637049c into main Jan 13, 2026
28 of 30 checks passed
@lifeizhou-ap lifeizhou-ap deleted the lifei/opt-out-schedule-tool-in-cli branch January 13, 2026 00:36
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Jan 13, 2026
zanesq added a commit that referenced this pull request Jan 13, 2026
…ased

* 'main' of github.com:block/goose: (23 commits)
  Use Intl.NumberFormat for token formatting in SessionsInsights (#6466)
  feat(ui): format large and small token counts for readability (#6449)
  fix: apply subrecipes when using slash commands (#6460)
  Fix: exclude platform_schedule_tool in CLI (#6442)
  Fix: Small update in how ML-based prompt injection determines final result (#6439)
  docs: remove SSE transport and rename to Streamable HTTP (#6319)
  fix: correct Cloudinary extension command and env variable (#6453)
  fix: add gap between buttons in MacDesktopInstallButtons.js (#6452)
  refactor: include hidden dotfiles folders in file picker search (#6315)
  upgraded safe npm packages (#6450)
  chore(deps): bump react-router and react-router-dom in /ui/desktop (#6408)
  chore(deps): bump lru from 0.12.5 to 0.16.3 (#6379)
  chore(deps-dev): bump @modelcontextprotocol/sdk from 1.24.0 to 1.25.2 in /ui/desktop (#6375)
  fix: inconsistent API url requirement between desktop and CLI versions (#6419)
  feat(vertexai): Add streaming support (#6409)
  fix deeplink recipe launch cold start (#6210)
  Spell check setting (#6446)
  File bug directly (#6413)
  fix(cli): incorrect bin name in shell completions (#6444)
  Use crunchy from crates instead of git fork (#6415)
  ...
wpfleger96 added a commit that referenced this pull request Jan 13, 2026
* main: (41 commits)
  Allow customizing the new line keybinding in the CLI (#5956)
  Ask for permission in the CLI (#6475)
  docs: add Ralph Loop tutorial for multi-model iterative development (#6455)
  Remove gitignore fallback from gooseignore docs (#6480)
  fix: clean up result recording for code mode (#6343)
  fix(code_execution): handle model quirks with tool calls (#6352)
  feat(ui): support prefersBorder option for MCP Apps (#6465)
  fixed line breaks (#6459)
  Use Intl.NumberFormat for token formatting in SessionsInsights (#6466)
  feat(ui): format large and small token counts for readability (#6449)
  fix: apply subrecipes when using slash commands (#6460)
  Fix: exclude platform_schedule_tool in CLI (#6442)
  Fix: Small update in how ML-based prompt injection determines final result (#6439)
  docs: remove SSE transport and rename to Streamable HTTP (#6319)
  fix: correct Cloudinary extension command and env variable (#6453)
  fix: add gap between buttons in MacDesktopInstallButtons.js (#6452)
  refactor: include hidden dotfiles folders in file picker search (#6315)
  upgraded safe npm packages (#6450)
  chore(deps): bump react-router and react-router-dom in /ui/desktop (#6408)
  chore(deps): bump lru from 0.12.5 to 0.16.3 (#6379)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants