Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(health): move config reload status type to leaf contract
Move GatewayHotReloadStatus out of config-reload.ts into a leaf
config-reload-status.types.ts so health/request-context/runtime-handles
callers no longer pull the full config-reload implementation into the
shared server-method type graph (ClawSweeper-flagged architecture cycle).
  • Loading branch information
masatohoshino authored and vincentkoc committed Jul 6, 2026
commit cd4027a9589e84265c9da7514f6fe8bae942174e
2 changes: 1 addition & 1 deletion src/commands/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
DEFAULT_CHANNEL_STALE_EVENT_THRESHOLD_MS,
evaluateChannelHealth,
} from "../gateway/channel-health-policy.js";
import type { GatewayHotReloadStatus } from "../gateway/config-reload.js";
import type { GatewayHotReloadStatus } from "../gateway/config-reload-status.types.js";
import { isGatewaySecretRefUnavailableError } from "../gateway/credentials.js";
import { getGatewayModelPricingHealth } from "../gateway/model-pricing-cache-state.js";
import { isGatewayModelPricingEnabled } from "../gateway/model-pricing-config.js";
Expand Down
2 changes: 1 addition & 1 deletion src/commands/health.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type ModelPricingHealthSummary =

/** Config hot-reload watcher status, present only when a reloader is running. */
export type ConfigReloadHealthSummary = {
hotReloadStatus: import("../gateway/config-reload.js").GatewayHotReloadStatus;
hotReloadStatus: import("../gateway/config-reload-status.types.js").GatewayHotReloadStatus;
};

/** Full gateway health payload consumed by `openclaw health`. */
Expand Down
9 changes: 9 additions & 0 deletions src/gateway/config-reload-status.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Leaf contract for the config hot-reload watcher's terminal status.
// Kept separate from config-reload.ts so callers that only need the status
// shape (health summaries, request context, runtime handles) do not pull in
// the full config-reload implementation.

// Hot-reload stays "active" while a watcher is live. It flips to "disabled" only
// after watcher re-creation fails past the retry budget, so operators/callers
// can detect silent degradation instead of assuming reloads still fire.
export type GatewayHotReloadStatus = "active" | "disabled";
6 changes: 1 addition & 5 deletions src/gateway/config-reload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
type GatewayReloadPlan,
} from "./config-reload-plan.js";
import { resolveGatewayReloadSettings } from "./config-reload-settings.js";
import type { GatewayHotReloadStatus } from "./config-reload-status.types.js";

export {
buildGatewayReloadPlan,
Expand Down Expand Up @@ -90,11 +91,6 @@ function isNoopReloadPlan(plan: GatewayReloadPlan): boolean {
);
}

// Hot-reload stays "active" while a watcher is live. It flips to "disabled" only
// after watcher re-creation fails past the retry budget, so operators/callers
// can detect silent degradation instead of assuming reloads still fire.
export type GatewayHotReloadStatus = "active" | "disabled";

type GatewayConfigReloader = {
stop: () => Promise<void>;
hotReloadStatus: () => GatewayHotReloadStatus;
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/server-methods/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { buildDeliveryQueueHealthSummary } from "../../commands/health.js";
import type { ChannelHealthSummary, HealthSummary } from "../../commands/health.types.js";
import { getStatusSummary } from "../../commands/status.js";
import { listContextEngineQuarantines } from "../../context-engine/registry.js";
import type { GatewayHotReloadStatus } from "../config-reload.js";
import type { GatewayHotReloadStatus } from "../config-reload-status.types.js";
import { getGatewayModelPricingHealth } from "../model-pricing-cache-state.js";
import type { ChannelRuntimeSnapshot } from "../server-channel-runtime.types.js";
import { HEALTH_REFRESH_INTERVAL_MS } from "../server-constants.js";
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/server-methods/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { createSubsystemLogger } from "../../logging/subsystem.js";
import type { WizardSession } from "../../wizard/session.js";
import type { AgentRuntimeIdentity } from "../agent-runtime-identity-token.js";
import type { ChatAbortControllerEntry } from "../chat-abort.js";
import type { GatewayHotReloadStatus } from "../config-reload.js";
import type { GatewayHotReloadStatus } from "../config-reload-status.types.js";
import type { ExecApprovalManager, ExecApprovalRecord } from "../exec-approval-manager.js";
import type { GatewayMethodRegistryView } from "../methods/descriptor.js";
import type { NodeRegistry } from "../node-registry.js";
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/server-runtime-handles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import type { OpenClawConfig } from "../config/types.openclaw.js";
import type { HeartbeatRunner } from "../infra/heartbeat-runner.js";
import type { ChannelHealthMonitor } from "./channel-health-monitor.js";
import type { GatewayHotReloadStatus } from "./config-reload.js";
import type { GatewayHotReloadStatus } from "./config-reload-status.types.js";
import type { GatewayPostReadySidecarHandle } from "./server-startup-post-attach.js";

// Mutable server handles track timers, sidecars, subscriptions, and service
Expand Down
2 changes: 1 addition & 1 deletion src/gateway/server/health-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { listSystemPresence } from "../../infra/system-presence.js";
import { getUpdateAvailable } from "../../infra/update-startup.js";
import { normalizeMainKey } from "../../routing/session-key.js";
import { resolveGatewayAuth } from "../auth.js";
import type { GatewayHotReloadStatus } from "../config-reload.js";
import type { GatewayHotReloadStatus } from "../config-reload-status.types.js";
import type { ChannelRuntimeSnapshot } from "../server-channel-runtime.types.js";
import type { GatewayEventLoopHealth } from "./event-loop-health.js";

Expand Down
Loading