Skip to content

Commit f871b49

Browse files
committed
fix(infra): drop consumer-less gateway supervision exports
333c4f9 and 244f496 landed six exports with no production consumers, failing the hard-zero deadcode gate on every PR: a dead re-export block in restart-handoff (the contract module's real importer uses it directly), three result/mode types only referenced inside their own modules, and two supervision symbols whose only consumers were their tests. The types and helpers stay defined for the in-flight supervisor work to re-export alongside real consumers; the supervision test now proves mode resolution through the public isGatewayExternallySupervised surface.
1 parent 8bf4d38 commit f871b49

5 files changed

Lines changed: 11 additions & 17 deletions

File tree

src/cli/daemon-cli/restart-lock-replacement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from "../../infra/gateway-lock.js";
66
import { sleep } from "../../utils.js";
77

8-
export type GatewayLockReplacementWaitResult =
8+
type GatewayLockReplacementWaitResult =
99
| { status: "replacement"; attemptsUsed: number }
1010
| { status: "timeout" };
1111

src/infra/gateway-supervision.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import { describe, expect, it } from "vitest";
22
import {
33
assertGatewayServiceMutationAllowed,
44
formatExternalSupervisorUpdateRequired,
5-
GATEWAY_SUPERVISOR_MODE_ENV,
65
isGatewayExternallySupervised,
7-
resolveGatewaySupervisorMode,
86
} from "./gateway-supervision.js";
97

8+
// The env variable name is part of the observable contract the messages
9+
// reference; the mode resolver is internal and proven through the public
10+
// isGatewayExternallySupervised surface.
11+
const GATEWAY_SUPERVISOR_MODE_ENV = "OPENCLAW_SUPERVISOR_MODE";
12+
1013
describe("gateway supervision", () => {
1114
it.each([
1215
{ value: undefined, expected: "auto" },
@@ -17,7 +20,6 @@ describe("gateway supervision", () => {
1720
])("resolves $value as $expected", ({ value, expected }) => {
1821
const env = { [GATEWAY_SUPERVISOR_MODE_ENV]: value };
1922

20-
expect(resolveGatewaySupervisorMode(env)).toBe(expected);
2123
expect(isGatewayExternallySupervised(env)).toBe(expected === "external");
2224
});
2325

src/infra/gateway-supervision.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
// Defines gateway lifecycle ownership shared by service, restart, and update paths.
2-
export const GATEWAY_SUPERVISOR_MODE_ENV = "OPENCLAW_SUPERVISOR_MODE";
2+
const GATEWAY_SUPERVISOR_MODE_ENV = "OPENCLAW_SUPERVISOR_MODE";
33
export const EXTERNAL_SUPERVISOR_UPDATE_REQUIRED_REASON = "external-supervisor-update-required";
44

5-
export type GatewaySupervisorMode = "auto" | "external";
5+
type GatewaySupervisorMode = "auto" | "external";
66

7-
export function resolveGatewaySupervisorMode(
8-
env: NodeJS.ProcessEnv = process.env,
9-
): GatewaySupervisorMode {
7+
function resolveGatewaySupervisorMode(env: NodeJS.ProcessEnv = process.env): GatewaySupervisorMode {
108
return env[GATEWAY_SUPERVISOR_MODE_ENV]?.trim().toLowerCase() === "external"
119
? "external"
1210
: "auto";

src/infra/restart-handoff.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ import {
1414
getNodeSqliteKysely,
1515
} from "./kysely-sync.js";
1616

17-
export {
18-
createGatewayRestartHandoffCapabilities,
19-
GATEWAY_RESTART_HANDOFF_PROTOCOL,
20-
GATEWAY_RESTART_HANDOFF_PROTOCOL_VERSION,
21-
} from "./restart-handoff-contract.js";
22-
2317
// Restart handoff rows let a supervisor explain a recent gateway restart after
2418
// the old process exits. The row is short-lived, bounded, and replaced on write.
2519
const GATEWAY_SUPERVISOR_RESTART_HANDOFF_KIND = "gateway-supervisor-restart-handoff";
@@ -77,7 +71,7 @@ export type GatewayRestartHandoff = {
7771
};
7872
};
7973

80-
export type GatewayRestartHandoffConsumeResult =
74+
type GatewayRestartHandoffConsumeResult =
8175
| {
8276
status: "accepted";
8377
handoff: GatewayRestartHandoff;

src/infra/supervisor-markers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const SUPERVISOR_HINT_ENV_VARS = [
2323

2424
/** Supported supervisor families that can respawn the gateway after update/restart handoff. */
2525
export type RespawnSupervisor = "launchd" | "systemd" | "schtasks";
26-
export type GatewayRespawnSupervisor = RespawnSupervisor | "external";
26+
type GatewayRespawnSupervisor = RespawnSupervisor | "external";
2727

2828
interface DetectRespawnSupervisorOptions {
2929
includeLinuxOpenClawGatewayServiceMarker?: boolean;

0 commit comments

Comments
 (0)