mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-25 11:55:47 -06:00
fix(doctor): migrate markerless multi-agent rosters (#126595)
This commit is contained in:
@@ -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: {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user