fix(cli): keep config file queries fast and read-only (#114660)

This commit is contained in:
Peter Steinberger
2026-07-27 13:56:00 -04:00
committed by GitHub
parent 600fac1cf7
commit 2b11203eb3
5 changed files with 39 additions and 0 deletions

View File

@@ -248,6 +248,7 @@ describe("registerPreActionHooks", () => {
.argument("<value>")
.option("--json")
.action(() => {});
config.command("file").action(() => {});
config
.command("validate")
.option("--json")
@@ -830,6 +831,19 @@ describe("registerPreActionHooks", () => {
expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
});
it.each([
["default profile", ["node", "openclaw", "config", "file"]],
["named profile", ["node", "openclaw", "--profile", "work", "config", "file"]],
])("bypasses config guard for a %s config path query", async (_name, processArgv) => {
await runPreAction({
parseArgv: ["config", "file"],
processArgv,
});
expect(ensureConfigReadyMock).not.toHaveBeenCalled();
expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
});
it("bypasses config guard for config validate", async () => {
await runPreAction({
parseArgv: ["config", "validate"],