fix: persist elevated off override

This commit is contained in:
Peter Steinberger
2026-01-10 05:23:29 +01:00
parent e4abd06094
commit 66db6c749d
3 changed files with 17 additions and 10 deletions

View File

@@ -811,6 +811,7 @@ describe("directive behavior", () => {
it("returns status alongside directive-only acks", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
const storePath = path.join(home, "sessions.json");
const res = await getReplyFromConfig(
{
@@ -834,13 +835,21 @@ describe("directive behavior", () => {
},
},
whatsapp: { allowFrom: ["+1222"] },
session: { store: path.join(home, "sessions.json") },
session: { store: storePath },
},
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toContain("Elevated mode disabled.");
expect(text).toContain("Session: agent:main:main");
const optionsLine = text
?.split("\n")
.find((line) => line.trim().startsWith("⚙️"));
expect(optionsLine).toBeTruthy();
expect(optionsLine).not.toContain("elevated");
const store = loadSessionStore(storePath);
expect(store["agent:main:main"]?.elevatedLevel).toBe("off");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});