From 4c824aa809cac194b6ab43cd804ad0124b1a8d0a Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 1 Jun 2026 03:32:12 +0100 Subject: [PATCH] perf(phone-control): use startup config for expiry guard --- extensions/phone-control/index.test.ts | 8 ++++---- extensions/phone-control/index.ts | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/phone-control/index.test.ts b/extensions/phone-control/index.test.ts index 200e1aa3ad07..cecc6b5f06ff 100644 --- a/extensions/phone-control/index.test.ts +++ b/extensions/phone-control/index.test.ts @@ -369,7 +369,7 @@ describe("phone-control plugin", () => { } await service.start({ - config: {}, + config: createPhoneControlConfig(), stateDir, logger: { info() {}, warn() {}, error() {}, debug() {} }, }); @@ -381,7 +381,7 @@ describe("phone-control plugin", () => { expect(lookup).toHaveBeenCalledWith("current"); await service.stop?.({ - config: {}, + config: createPhoneControlConfig(), stateDir, logger: { info() {}, warn() {}, error() {}, debug() {} }, }); @@ -439,7 +439,7 @@ describe("phone-control plugin", () => { } await service.start({ - config: {}, + config, stateDir, logger: { info() {}, warn() {}, error() {}, debug() {} }, }); @@ -454,7 +454,7 @@ describe("phone-control plugin", () => { }); await service.stop?.({ - config: {}, + config, stateDir, logger: { info() {}, warn() {}, error() {}, debug() {} }, }); diff --git a/extensions/phone-control/index.ts b/extensions/phone-control/index.ts index 4f1b40da0186..b7fd143e267a 100644 --- a/extensions/phone-control/index.ts +++ b/extensions/phone-control/index.ts @@ -300,7 +300,7 @@ export default definePluginEntry({ const timerService: OpenClawPluginService = { id: "phone-control-expiry", - start: async () => { + start: async (ctx) => { const tick = async () => { const state = await readArmState(api); if (!state || state.expiresAtMs == null) { @@ -320,7 +320,7 @@ export default definePluginEntry({ }, 15_000); expiryInterval.unref?.(); - if (hasPhoneControlAllowOverride(api.runtime.config.current())) { + if (hasPhoneControlAllowOverride(ctx.config)) { // Active dangerous command allows must be reconciled before gateway // readiness; otherwise an expired phone-control window can survive. await tick().catch(() => {});