From a24f0f495539100c732e594cc02a222d1f2b1114 Mon Sep 17 00:00:00 2001 From: Naveen Chatlapalli Date: Thu, 29 Jan 2026 01:26:52 -0600 Subject: [PATCH] fix(gateway): prevent unnecessary restarts from meta.lastTouchedAt changes Add `{ prefix: "meta", kind: "none" }` to BASE_RELOAD_RULES_TAIL to prevent gateway restarts when only metadata fields like `lastTouchedAt` change. Previously, when a tool modified the config (e.g., `clawdbot agents add`), the `meta.lastTouchedAt` field would update, triggering a full gateway restart via SIGUSR1. This aborted any in-flight LLM requests, causing users to never receive the agent's response. Now changes to `meta.*` fields are treated as no-ops, similar to other metadata-like fields (identity, wizard, etc.). Fixes #3811 Co-Authored-By: Claude Opus 4.5 --- src/gateway/config-reload.test.ts | 6 ++++++ src/gateway/config-reload.ts | 1 + 2 files changed, 7 insertions(+) diff --git a/src/gateway/config-reload.test.ts b/src/gateway/config-reload.test.ts index 3ad545855..79aeb414e 100644 --- a/src/gateway/config-reload.test.ts +++ b/src/gateway/config-reload.test.ts @@ -108,6 +108,12 @@ describe("buildGatewayReloadPlan", () => { expect(plan.noopPaths).toContain("gateway.remote.url"); }); + it("treats meta.lastTouchedAt as no-op", () => { + const plan = buildGatewayReloadPlan(["meta.lastTouchedAt"]); + expect(plan.restartGateway).toBe(false); + expect(plan.noopPaths).toContain("meta.lastTouchedAt"); + }); + it("defaults unknown paths to restart", () => { const plan = buildGatewayReloadPlan(["unknownField"]); expect(plan.restartGateway).toBe(true); diff --git a/src/gateway/config-reload.ts b/src/gateway/config-reload.ts index 8579dc4a0..c5fc4edb0 100644 --- a/src/gateway/config-reload.ts +++ b/src/gateway/config-reload.ts @@ -77,6 +77,7 @@ const BASE_RELOAD_RULES_TAIL: ReloadRule[] = [ { prefix: "session", kind: "none" }, { prefix: "talk", kind: "none" }, { prefix: "skills", kind: "none" }, + { prefix: "meta", kind: "none" }, { prefix: "plugins", kind: "restart" }, { prefix: "ui", kind: "none" }, { prefix: "gateway", kind: "restart" },