fix: publish agents.yaml JSON Schema + wire editor autocomplete/validation - #3437
Conversation
β¦#3427) Derive a JSON Schema from YAMLConfig (generate_agents_schema), publish it as a committed agents.schema.json artefact, expose it via `praisonai validate schema --agents/--output`, and prepend a `# yaml-language-server: $schema=` header when auto.py scaffolds agents.yaml so editors give autocomplete / inline validation out of the box. Authoring-time only; runtime parsing and execution are unchanged (a leading YAML comment is ignored by safe_load). Co-authored-by: MervinPraison <MervinPraison@users.noreply.github.com>
|
@coderabbitai review |
|
/review |
β Action performedReview finished.
|
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more β On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reached
Next review available in: 19 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review detailsβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: π Files selected for processing (7)
β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryAdds published editor-schema support for agents.yaml.
Confidence Score: 4/5The PR appears safe to merge, with only the previously reported header-diagnostic weakness remaining. The schema/runtime compatibility issue is addressed, while header failures still continue without a user-visible diagnostic under default logging. Files Needing Attention: src/praisonai/praisonai/auto.py
|
| Filename | Overview |
|---|---|
| src/praisonai/praisonai/config/schema.py | Generates the editor schema and relaxes agent requirements and collection forms to reflect runtime normalization. |
| src/praisonai/praisonai/config/agents.schema.json | Adds the committed schema artifact consumed by YAML-aware editors. |
| src/praisonai/praisonai/auto.py | Prepends the schema directive while preserving atomic YAML generation. |
| src/praisonai/praisonai/cli/commands/validate.py | Adds CLI options to emit the agents schema to stdout or a local file. |
| src/praisonai/tests/unit/test_agents_schema_publish.py | Verifies schema metadata, artifact freshness, normalized forms, header wiring, and YAML validation. |
Reviews (2): Last reviewed commit: "fix: align published agents schema with ..." | Re-trigger Greptile
|
@claude You are the FINAL architecture reviewer. If the branch is under MervinPraison/PraisonAI (not a fork), you are able to make modifications to this branch and push directly. SCOPE: Focus ONLY on Python packages (praisonaiagents, praisonai). Do NOT modify praisonai-rust or praisonai-ts. Read ALL comments above from Gemini, Qodo, CodeRabbit, and Copilot carefully before responding. Phase 1: Review per AGENTS.md
Phase 2: FIX Valid Issues Phase 3: Final Verdict |
|
Claude finished @MervinPraison's task ββ View job Claude β Final Architecture Review (PR #3437) βPhase 1 β Architecture verdict: β
Correctly scoped. Wrapper-only ( Phase 2 β Valid issues fixed (pushed to this branch as
Files modified
Skipped: No changes to the strict validator (correct β editor schema should be a superset of the runtime contract, not identical to the strict form). No top-level Tests: β
5/5 new schema-publish tests pass; 82/82 across schema + Phase 3 β Verdict: β Approve. All reviewer-flagged issues are valid and now resolved; the published schema is a faithful superset of the runtime contract. No blocking issues remain. Job run Β· branch |
β¦ failures Addresses reviewer feedback on PR #3437: - Greptile P1: the published editor schema was stricter than the runtime. generate_agents_schema() now relaxes AgentConfig (drops required role/goal/backstory, which the runtime auto-fills or maps from 'instructions') and allows list-form roles/agents (runtime _list_to_dict), so editors no longer flag valid, executable YAML. The strict YAMLConfig used by ConfigValidator is unchanged. - Greptile P2: replace the silent `except Exception: pass` around the yaml-language-server header write with a debug log so a dropped directive is diagnosable. - Regenerate agents.schema.json; add a runtime-parity guard test. π€ Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
Fixes #3427
Summary
Adds first-class editor support for the
agents.yamlauthoring surface by publishing a JSON Schema derived fromYAMLConfigand wiring the# yaml-language-server: $schema=header into scaffolded agent files. Authoring-time tooling only β runtime parsing/execution is unchanged.Changes (wrapper-only:
praisonai/config/+ CLI)config/schema.py: addAGENTS_SCHEMA_URL,AGENTS_SCHEMA_HEADER, andgenerate_agents_schema()(decoratesYAMLConfig.model_json_schema()with$schema/$id/title metadata, mirroring the CLI-config schema convention).config/agents.schema.json: committed, published artefact (served at the stable raw URL, same hosting pattern asconfig.schema.json); added to[tool.setuptools.package-data].cli/commands/validate.py: extend the existingvalidate schemacommand with--agents(emit JSON to stdout) and--output/-o(write a local file for offline/pinned editor setups).auto.py: prepend the# yaml-language-serverheader when scaffoldingagents.yaml. A leading YAML comment is ignored byyaml.safe_load, so execution is unaffected.Usage
Tests
tests/unit/test_agents_schema_publish.py:generate_agents_schema()exposesroles/agents/tasks/tools/llm/workflow.agents.schema.jsonmatches the model (stale-artefact guard).agents.yamlstarts with the header and still round-trips throughConfigValidator.All 4 new tests pass; 57 related auto-generator/validation tests pass with no regressions. Fully backwards-compatible.
Generated with Claude Code