fix: CLI headless recipe runs fail with 'Scheduler not available' error on Linux AARCH64 (v1.18.0+)#6416
fix: CLI headless recipe runs fail with 'Scheduler not available' error on Linux AARCH64 (v1.18.0+)#6416github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
…or on Linux AARCH64 (v1.18.0+)
|
/goose trace hard on this wrt the cli's functionality and make sure this won't actually break anything. We don't need the scheduler to actually run, we just need the scheduler platform tool to function appropriately and not break like in #6405 |
PR #6416 ReviewSummary: This PR correctly fixes the "Scheduler not available" error in CLI headless mode by initializing the scheduler the same way the server does. The fix is minimal, follows existing patterns exactly, and is safe to merge. ✅ HighlightsFollows established pattern correctly: The fix mirrors exactly how // Server mode (manager.rs:37-39)
let schedule_file_path = Paths::data_dir().join("schedule.json");
let scheduler = Scheduler::new(schedule_file_path).await?;
// CLI mode (this PR, builder.rs:306-314)
let schedule_file_path = Paths::data_dir().join("schedule.json");
match Scheduler::new(schedule_file_path).await {
Ok(scheduler) => { agent.set_scheduler(scheduler).await; }
Err(e) => { tracing::warn!("Failed to initialize scheduler: {}", e); }
}Appropriate error handling: Scheduler initialization failure is logged as a warning but doesn't block session creation. This is the right choice - users can still use the CLI, they just won't have access to scheduling features if initialization fails. 🟢 SuggestionsPre-existing inconsistency (not introduced by this PR): The codebase has two different scheduler storage paths:
This means CLI schedule management commands and the schedule platform tool may be looking at different files. This is a pre-existing issue that should be tracked separately. Minor performance consideration: The scheduler is now always initialized even when the schedule tool won't be used. However, this matches server behavior and the overhead is negligible for typical CLI usage patterns. Verification of SafetyTracing the control flow confirms this change is safe:
Review generated by goose |
|
Created a PR #6442 to address this error |
|
yeah, @lifeizhou-ap 's solution is better. Humans 1, Robots 0! - closing |
Closes #6405
Summary
Issue #6405 Fix Summary
Problem
CLI headless recipe runs were failing with the error:
This occurred because in CLI mode (
goose run --recipe), theAgentwas created without initializing the scheduler service, while in server mode theAgentManagerproperly initialized it.Root Cause
In
crates/goose-cli/src/session/builder.rs, thebuild_sessionfunction creates anAgentbut never callsagent.set_scheduler(). In contrast,crates/goose/src/execution/manager.rs(AgentManager) properly initializes the scheduler viaScheduler::new()and sets it on the agent.Fix
Modified
crates/goose-cli/src/session/builder.rsto initialize the scheduler in exactly the same way as the server does:Added imports:
use goose::config::paths::Paths;use goose::scheduler::Scheduler;After creating the Agent, added scheduler initialization:
Changes
crates/goose-cli/src/session/builder.rsVerification
cargo check -p goose-cli- PASSEDcargo fmt- PASSED./scripts/clippy-lint.sh- PASSEDNotes
AgentManager::new()/tmp/test_scheduler_cli.rsto verify the issue (not added to git)Generated by goose Issue Solver