Repository navigation
Conversation
Agent definitions with YAML parse errors were silently skipped during discovery, making agents vanish from the callable list with no log. The only symptom was a distant "profile not found" at dispatch time. Add a warning log in _get_agents_list_from_dir naming the agent dir, its origin, and the parse error, plus a cross-check that warns (once per project per process) when slugs registered in agents.json were not discovered. Purely additive warnings; no behavior change.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
When an agent definition (
agent.yaml) contains a YAML authoring error (e.g. an unquoted colon in a description, or a bad indent),_get_agents_list_from_dir()catches the exception and silentlycontinues. The agent simply vanishes from discovery — there is no log line at all. The only symptom surfaces much later, far from the cause: dispatching that profile fails with a distant "profile not found" error.We hit this in production: four project agents were silently missing from the callable list for days before the root cause (a YAML typo) was found.
Solution
Two purely additive warnings, no behavior change:
Parse-failure warning in
_get_agents_list_from_dir(): when an agent definition fails to load/validate, log a warning naming the agent directory, its containing dir, its origin (default/user/project/plugin), and the exception. Skipping still happens exactly as before.Registered-but-undiscovered cross-check (
_warn_undiscovered_project_agents()): inget_available_agents_dict(), cross-check slugs registered in the project'sagents.jsonagainst discovered agents and warn once (per project, per process) about any registered slug that was not discovered — pointing at likelyagent.yamlparse errors. The cross-check reads both knownagents.jsonshapes (manifest{"agents": [{"slug": ...}]}and flat{"<slug>": {"enabled": ...}}).A warn-once dedupe set keeps the cross-check from spamming, since
get_available_agents_dict()is a hot path.Testing
Scratch break-tests against a fresh worktree of
main:description) + one good agent → warning fires naming the broken agent dir + error; good agent still discovered normally.agents.jsonregistering a ghost slug (no corresponding agent dir) + one real agent → exactly one warning naming the ghost slug; real agent unaffected; second call emits no additional warning (dedupe works).import helpers.subagentssanity check passes.tests/test_subagent_metadata_merge.py,tests/test_subagent_profiles.py): identical pass/fail set on patched vs. pristinemain(the 6 pre-existing failures intest_subagent_profiles.pydispatch tests are unrelated and unchanged by this patch).Backwards compatibility
Purely additive warning logs. No API, signature, or behavior changes — agents are still skipped exactly as before, only now visibly.