mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
fix(gateway): ignore inherited launchd env for respawn
This commit is contained in:
committed by
Peter Steinberger
parent
b0c8a4d11d
commit
177ebdc24c
@@ -1306,7 +1306,7 @@ describe("runGatewayLoop", () => {
|
||||
peekGatewaySigusr1RestartReason.mockReturnValue(undefined);
|
||||
try {
|
||||
setPlatform("darwin");
|
||||
process.env.LAUNCH_JOB_LABEL = "ai.openclaw.gateway";
|
||||
process.env.OPENCLAW_LAUNCHD_LABEL = "ai.openclaw.gateway";
|
||||
restartGatewayProcessWithFreshPid.mockReturnValueOnce({
|
||||
mode: "supervised",
|
||||
});
|
||||
@@ -1331,7 +1331,7 @@ describe("runGatewayLoop", () => {
|
||||
});
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
delete process.env.LAUNCH_JOB_LABEL;
|
||||
delete process.env.OPENCLAW_LAUNCHD_LABEL;
|
||||
if (originalPlatformDescriptor) {
|
||||
Object.defineProperty(process, "platform", originalPlatformDescriptor);
|
||||
}
|
||||
@@ -1343,7 +1343,7 @@ describe("runGatewayLoop", () => {
|
||||
consumeGatewayRestartIntentPayloadSync.mockReturnValueOnce({ reason: "gateway.restart" });
|
||||
try {
|
||||
setPlatform("darwin");
|
||||
process.env.LAUNCH_JOB_LABEL = "ai.openclaw.gateway";
|
||||
process.env.OPENCLAW_LAUNCHD_LABEL = "ai.openclaw.gateway";
|
||||
restartGatewayProcessWithFreshPid.mockReturnValueOnce({
|
||||
mode: "supervised",
|
||||
});
|
||||
@@ -1365,7 +1365,7 @@ describe("runGatewayLoop", () => {
|
||||
});
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
delete process.env.LAUNCH_JOB_LABEL;
|
||||
delete process.env.OPENCLAW_LAUNCHD_LABEL;
|
||||
if (originalPlatformDescriptor) {
|
||||
Object.defineProperty(process, "platform", originalPlatformDescriptor);
|
||||
}
|
||||
|
||||
@@ -606,6 +606,16 @@ describe("buildServiceEnvironment", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("sets the OpenClaw-owned launchd marker for macOS gateway services", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: { HOME: "/Users/user" },
|
||||
port: 18789,
|
||||
platform: "darwin",
|
||||
});
|
||||
|
||||
expect(env.OPENCLAW_LAUNCHD_LABEL).toBe("ai.openclaw.gateway");
|
||||
});
|
||||
|
||||
it("passes through OPENCLAW_WRAPPER for gateway services", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: {
|
||||
@@ -675,6 +685,16 @@ describe("buildServiceEnvironment", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("sets a profile-specific launchd marker for macOS gateway services", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: { HOME: "/Users/user", OPENCLAW_PROFILE: "work" },
|
||||
port: 18789,
|
||||
platform: "darwin",
|
||||
});
|
||||
|
||||
expect(env.OPENCLAW_LAUNCHD_LABEL).toBe("ai.openclaw.work");
|
||||
});
|
||||
|
||||
it("does not persist ambient proxy environment variables for launchd/systemd runtime", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: {
|
||||
@@ -756,6 +776,15 @@ describe("buildNodeServiceEnvironment", () => {
|
||||
expect(env.HOME).toBe("/home/user");
|
||||
});
|
||||
|
||||
it("sets the OpenClaw-owned launchd marker for macOS node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/Users/user" },
|
||||
platform: "darwin",
|
||||
});
|
||||
|
||||
expect(env.OPENCLAW_LAUNCHD_LABEL).toBe("ai.openclaw.node");
|
||||
});
|
||||
|
||||
it("passes through OPENCLAW_GATEWAY_TOKEN for node services", () => {
|
||||
const env = buildNodeServiceEnvironment({
|
||||
env: { HOME: "/home/user", OPENCLAW_GATEWAY_TOKEN: " node-token " },
|
||||
|
||||
Reference in New Issue
Block a user