perf(phone-control): use startup config for expiry guard

This commit is contained in:
Peter Steinberger
2026-06-01 03:32:12 +01:00
parent 1e7510ae10
commit 4c824aa809
2 changed files with 6 additions and 6 deletions

View File

@@ -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() {} },
});

View File

@@ -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(() => {});