Skip to content
Merged
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions crates/goose/src/agents/platform_extensions/summon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ fn scan_recipes_from_dir(
});
}
Err(e) => {
// Files like package.json and tsconfig.json are common in project roots.
// Treat valid YAML/JSON that is missing Recipe fields as "not a recipe"
// rather than warning on every normal project config file.
if e.to_string().contains("missing field") {
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep warnings for malformed recipe-directory files

This skip applies to every directory scanned by discover_filesystem_sources, including .goose/recipes, .agents/recipes, configured recipe paths, and the working directory. In those recipe-specific locations, a real recipe with a typo or missing required field such as description now disappears with no warning, whereas other parse failures are still surfaced; limiting this suppression to known project config files or only the raw working-directory scan would avoid hiding broken user recipes.

Useful? React with 👍 / 👎.

}
warn!("Failed to parse recipe {}: {}", path.display(), e);
}
}
Expand Down Expand Up @@ -1998,6 +2004,34 @@ You review code."#;
assert_eq!(sources[0].name, "reviewer");
}

#[test]
fn test_recipe_scan_skips_non_recipe_project_config_files() {
let temp_dir = TempDir::new().unwrap();
fs::write(
temp_dir.path().join("package.json"),
r#"{"scripts":{"test":"cargo test"}}"#,
)
.unwrap();
fs::write(
temp_dir.path().join("tsconfig.json"),
r#"{"compilerOptions":{"strict":true}}"#,
)
.unwrap();
fs::write(
temp_dir.path().join("valid.yaml"),
"title: Valid\ndescription: Real recipe\ninstructions: Run valid steps",
)
.unwrap();

let mut sources = Vec::new();
let mut seen = HashSet::new();
scan_recipes_from_dir(temp_dir.path(), SourceType::Recipe, &mut sources, &mut seen);

assert_eq!(sources.len(), 1);
assert_eq!(sources[0].name, "valid");
assert_eq!(sources[0].description, "Real recipe");
}

#[tokio::test]
async fn test_discover_recipes_and_agents() {
let temp_dir = TempDir::new().unwrap();
Expand Down