Repair markerless legacy multi-agent roster migration in doctor --fix
Fixed `openclaw doctor --fix` so markerless legacy multi-agent rosters migrate with explicit ownership metadata, preventing downstream config validation regressions.
openclaw/openclaw · #126595
User-facing reliability improvement
Legacy multi-agent rosters can now migrate via doctor without getting blocked by missing ownership metadata.
Problem
When migrating markerless legacy multi-agent rosters, `openclaw doctor --fix` wrote canonicalized entries but omitted `agents.ownership`. This left repaired configs failing validation and forced manual follow-up steps.
Approach
Recorded explicit ownership during canonicalization unless a unique default agent is already declared, preserved existing behavior for ambient ownership, added defensive checks, and kept the migration deterministic for both defaulted and multi-agent legacy structures.
Impact and scope
- Enables smooth migration of legacy rosters with multiple agents without post-fix manual ownership edits.
- Improves reliability of `doctor --fix` for real-world multi-agent configs by ensuring repaired state passes schema validation.
- Keeps migration surface small and auditable within the doctor config flow, reducing risk of future ownership regressions.
Validation
- Added and ran targeted coverage in `doctor-config-flow.test.ts` and `legacy.roster.test.ts` for repaired multi-agent migration.
- Validated repaired rosters by writing valid schema payloads with explicit ownership and checking standalone config validation passes.
- Verified formatting, static checks, and root/type test commands reported clean execution in PR evidence.