fix(doctor): suppress clean-state repair trailer (#103233)

Co-authored-by: Ke Wang <ke@pika.art>
This commit is contained in:
Peter Steinberger
2026-07-10 03:48:44 +01:00
committed by GitHub
co-authored by Ke Wang
parent b752384586
commit 0fa49ad4dd
2 changed files with 20 additions and 5 deletions
@@ -3213,6 +3213,26 @@ describe("doctor health contributions", () => {
);
});
it("does not suggest --fix after a clean doctor run", async () => {
const cfg = {};
const runtime = { log: vi.fn(), error: vi.fn(), exit: vi.fn() };
await requireDoctorContribution("doctor:write-config").run({
cfg,
cfgForPersistence: cfg,
configResult: { cfg, shouldWriteConfig: false },
configPath: "/tmp/fake-openclaw.json",
sourceConfigValid: true,
prompter: buildDoctorPrompter(false),
runtime,
options: {},
env: {},
} as DoctorContributionRunContext);
expect(mocks.replaceConfigFile).not.toHaveBeenCalled();
expect(runtime.log).not.toHaveBeenCalled();
});
describe("config size drops during update", () => {
beforeEach(() => {
mocks.replaceConfigFile.mockReset();
-5
View File
@@ -1268,7 +1268,6 @@ async function runGatewayDaemonHealth(ctx: DoctorHealthFlowContext): Promise<voi
}
async function runWriteConfigHealth(ctx: DoctorHealthFlowContext): Promise<void> {
const { formatCliCommand } = await loadCommandFormatModule();
const { applyWizardMetadata } = await loadOnboardHelpersModule();
const { replaceConfigFile } = await loadConfigModule();
const { logConfigUpdated } = await import("../config/logging.js");
@@ -1312,10 +1311,6 @@ async function runWriteConfigHealth(ctx: DoctorHealthFlowContext): Promise<void>
if (fs.existsSync(backupPath)) {
ctx.runtime.log(`Backup: ${shortenHomePath(backupPath)}`);
}
return;
}
if (!ctx.prompter.shouldRepair) {
ctx.runtime.log(`Run "${formatCliCommand("openclaw doctor --fix")}" to apply changes.`);
}
}