fix(doctor): migrate markerless multi-agent rosters (#126595)

This commit is contained in:
Goutam Adwant
2026-08-20 21:44:05 -07:00
committed by GitHub
parent 2e1b882845
commit 2b190b2122
2 changed files with 28 additions and 2 deletions
+27
View File
@@ -1858,6 +1858,33 @@ describe("doctor config flow", () => {
expect(result.cfg.agents).not.toHaveProperty("list");
});
it("stamps explicit ownership when Doctor migrates a markerless multi-agent list", async () => {
const rawConfig = {
agents: {
list: [{ id: "ops" }, { id: "research", model: "openai/research" }],
},
};
const result = await runDoctorConfigWithInput({
config: migratePersistedImplicitMainRoster(rawConfig).config as OpenClawConfig,
parsedConfig: rawConfig,
repair: true,
run: loadAndMaybeMigrateDoctorConfig,
});
expect(result.shouldWriteConfig).toBe(true);
expect(result.explicitSetPaths).toEqual([
["agents", "entries"],
["agents", "ownership"],
]);
expect(result.cfg.agents).toEqual({
ownership: "explicit",
entries: {
ops: {},
research: { model: "openai/research" },
},
});
});
it("materializes ambient roles for a multi-agent configured default", async () => {
const rawConfig = {
agents: {
+1 -2
View File
@@ -266,8 +266,7 @@ export async function loadAndMaybeMigrateDoctorConfig(params: {
const migratedRoster = readAgentRosterProperty(migrated);
const migratedEntries = migratedRoster?.kind === "entries" ? migratedRoster.value : undefined;
const { list: _legacyList, ...candidateAgents } = migrated.agents ?? {};
const stampsExplicitOwnership =
legacyDefaultAgentId !== undefined && Object.keys(migratedEntries ?? {}).length > 1;
const stampsExplicitOwnership = Object.keys(migratedEntries ?? {}).length > 1;
const rosterRepair = {
config: {
...migrated,