fix: Check YAML kind field before parsing agent configs #90
+79
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #89
When loading agents from a directory, the daemon now checks the
kindfield before attempting to parse files as Agent configs. This prevents confusing errors when the directory contains non-Agent YAML files (Trigger, Fleet, Flow, etc.).Problem
Previously, when the agents directory contained a Trigger file (or any non-Agent YAML), the daemon would try to parse it as an Agent and fail with:
This was confusing because:
Solution
Added a
yaml_file_has_kindhelper function that checks thekindfield before attempting full deserialization:Changes
crates/aof-core/src/registry.rs:yaml_file_has_kindhelper functionAgentRegistry.load_directoryto skip non-Agent filescrates/aof-triggers/src/handler/mod.rs:TriggerHandler::yaml_file_has_kindmethodload_agents_from_directoryto check kind before parsingTesting
Checklist
🤖 Generated with Claude Code