Load agent metadata from role files#14177
Conversation
|
@codex review |
codex-rs/core/src/config/mod.rs
Outdated
| } | ||
|
|
||
| #[derive(Debug, Clone, PartialEq)] | ||
| pub(crate) struct ParsedAgentRoleFile { |
There was a problem hiding this comment.
this looks very similar to AgentRoleFileToml
codex-rs/core/src/config/mod.rs
Outdated
| Ok(()) | ||
| } | ||
|
|
||
| fn read_parsed_agent_role_file( |
There was a problem hiding this comment.
this can be written inline in parse_agent_role_file_contents
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7808e45bf8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
codex-rs/core/src/config/mod.rs
Outdated
| Self::validate_required_agent_role_description( | ||
| &role_name, | ||
| role.description.as_deref(), | ||
| )?; |
There was a problem hiding this comment.
Defer role description validation until after layer merge
In Config::load_agent_roles, validate_required_agent_role_description is called on each layer’s role entry before cross-layer merge. A higher-precedence layer that overrides only nickname_candidates or config_file (without repeating description) now fails config loading, even if a lower layer already provides a description. This breaks expected layered config merge behavior.
Useful? React with 👍 / 👎.
Load role metadata from standalone agent files, keep legacy config-file behavior, and add recursive agents directory discovery plus precedence tests. Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
7808e45 to
de7ab6e
Compare
Co-authored-by: Codex <noreply@openai.com>
Move the new agent-role loader, parser, and discovery logic into a dedicated config module so mod.rs stays focused on config types and entry points. Co-authored-by: Codex <noreply@openai.com>
Return a config error when an auto-discovered agent file omits its required name, and cover that path with a regression test. Co-authored-by: Codex <noreply@openai.com>
Keep legacy agent role config_file entries in agents/ compatible with standalone discovery by only enforcing missing-name failures for true standalone files. Co-authored-by: Codex <noreply@openai.com>
Skip declared legacy role config_file paths during standalone discovery and keep developer_instructions required only for true standalone role files. Co-authored-by: Codex <noreply@openai.com>
Update the developer_instructions regression test to assert the strict standalone discovery path instead of the legacy config_file path. Co-authored-by: Codex <noreply@openai.com>
Summary
agents/**/*.tomlfiles[agents.<role>]+config_filebehavior, with file metadata taking precedencedeveloper_instructionsin role files and requiredescriptionafter metadata precedence resolvesTesting
just fmtcargo test -p codex-core agent_role_file_requires_developer_instructions --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core agent_role_requires_description_after_merge --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core loads_legacy_split_agent_roles_from_config_toml --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core discovers_multiple_standalone_agent_role_files --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core mixed_legacy_and_standalone_agent_role_sources_merge_with_precedence --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core apply_role_ignores_agent_metadata_fields_in_user_role_file --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core apply_role_preserves_unspecified_keys --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core apply_role_uses_role_profile_instead_of_current_profile --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core apply_role_uses_role_model_provider_instead_of_current_profile_provider --target-dir /tmp/codex-agents-metadata-target4cargo test -p codex-core apply_role_skills_config_disables_skill_for_spawned_agent --target-dir /tmp/codex-agents-metadata-target4just fix -p codex-coreNote: tests were not rerun after
just fix -p codex-core.