Skip to content

DoctorContractProtocol for runtime config migration #1941

@MervinPraison

Description

@MervinPraison

Problem

Migrating from agent-level cli_backend to model-scoped runtime requires repeatable, plugin-extensible doctor rules so legacy configs are detected and rewritten safely.

Current state

  • Legacy field cli_backend in YAML and Python (praisonai/agents_generator.py, praisonai/agent.py, praisonaiagents/agent/agent.py).
  • Doctor infrastructure in praisonai/cli/commands/doctor.py without a DoctorContractProtocol for third-party migration rules.
  • Deploy doctor helpers in praisonai/deploy/doctor.py are deployment-focused, not agent runtime schema.

Proposed design

  • Add DoctorContractProtocol in praisonaiagents/runtime/doctor_protocol.py (or praisonaiagents/hooks/ if shared): collect_findings(config) -> list[Finding], apply_fix(config) -> config, rule_id.
  • Core registers built-in rule: migrate cli_backendmodels.<default>.runtime with mapping table for known ids (claude-code → same runtime id).
  • Plugins register additional rules via entry point praisonai.doctor_contracts.
  • Wire into praisonai doctor runtime --fix (extends preflight issue).

Acceptance criteria

  • Protocol defined with lazy plugin discovery.
  • Built-in migration rule covered by unit test on sample YAML.
  • --fix is idempotent and creates backup hint in doctor output.
  • Does not auto-fix without explicit --fix flag.

Layer

Primary: core (DoctorContractProtocol, built-in rule)

Secondary: wrapper (praisonai doctor runtime), plugins (custom rules)

3-way parity (Python / YAML / CLI)

Surface Supported
Python yes — programmatic lint/fix API
YAML yes — primary migration target
CLI yes — praisonai doctor runtime --fix

Priority

P2

Related modules

praisonai/cli/commands/doctor.py, praisonai/agents_generator.py, praisonaiagents/agent/agent.py, praisonaiagents/plugins/

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeAuto-trigger Claude analysis

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions