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 <noreply@anthropic.com>
This commit is contained in:
Naveen Chatlapalli 2026-01-29 01:26:52 -06:00
parent da71eaebd2
commit a24f0f4955
2 changed files with 7 additions and 0 deletions

View File

@ -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);

View File

@ -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" },