惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Y
Y Combinator Blog
IT之家
IT之家
博客园 - 聂微东
L
LangChain Blog
爱范儿
爱范儿
H
Help Net Security
GbyAI
GbyAI
F
Fortinet All Blogs
B
Blog
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
D
DataBreaches.Net
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(daemon): preserve container service env across regen ...
wAngByg · 2026-06-01 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -3,6 +3,7 @@ import os from "node:os";

33

import path from "node:path";

44

import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

55

import { writeStateDirDotEnv } from "../config/test-helpers.js";

6+

import { collectPreservedExistingServiceEnvVars } from "./daemon-install-helpers.js";

67
78

const mocks = vi.hoisted(() => ({

89

hasAnyAuthProfileStoreSource: vi.fn(() => true),

@@ -1488,3 +1489,46 @@ describe("gatewayInstallErrorHint", () => {

14881489

);

14891490

});

14901491

});

1492+
1493+

describe("collectPreservedExistingServiceEnvVars — operator opt-in allowlist", () => {

1494+

const managedKeys = new Set<string>();

1495+
1496+

it("continues to drop stale OPENCLAW_ALLOW_ROOT", () => {

1497+

const result = collectPreservedExistingServiceEnvVars(

1498+

{ OPENCLAW_ALLOW_ROOT: "1" },

1499+

managedKeys,

1500+

);

1501+

expect(result.OPENCLAW_ALLOW_ROOT).toBeUndefined();

1502+

});

1503+
1504+

it("preserves OPENCLAW_CLI_CONTAINER_BYPASS and OPENCLAW_CONTAINER_HINT", () => {

1505+

const result = collectPreservedExistingServiceEnvVars(

1506+

{

1507+

OPENCLAW_CLI_CONTAINER_BYPASS: "1",

1508+

OPENCLAW_CONTAINER_HINT: "ci",

1509+

},

1510+

managedKeys,

1511+

);

1512+

expect(result.OPENCLAW_CLI_CONTAINER_BYPASS).toBe("1");

1513+

expect(result.OPENCLAW_CONTAINER_HINT).toBe("ci");

1514+

});

1515+
1516+

it("still drops arbitrary OPENCLAW_FOO", () => {

1517+

const result = collectPreservedExistingServiceEnvVars({ OPENCLAW_FOO: "bar" }, managedKeys);

1518+

expect(result.OPENCLAW_FOO).toBeUndefined();

1519+

});

1520+
1521+

it("preserves container opt-ins while dropping unrelated OPENCLAW_* keys", () => {

1522+

const result = collectPreservedExistingServiceEnvVars(

1523+

{

1524+

OPENCLAW_CLI_CONTAINER_BYPASS: "1",

1525+

OPENCLAW_CONTAINER_HINT: "ci",

1526+

OPENCLAW_BAZ: "qux",

1527+

},

1528+

managedKeys,

1529+

);

1530+

expect(result.OPENCLAW_CLI_CONTAINER_BYPASS).toBe("1");

1531+

expect(result.OPENCLAW_CONTAINER_HINT).toBe("ci");

1532+

expect(result.OPENCLAW_BAZ).toBeUndefined();

1533+

});

1534+

});

Original file line numberDiff line numberDiff line change

@@ -432,7 +432,16 @@ function mergeServicePath(

432432

return segments.length > 0 ? segments.join(path.delimiter) : undefined;

433433

}

434434
435-

function collectPreservedExistingServiceEnvVars(

435+

// Operator opt-in env vars that should survive service regeneration even though

436+

// they share the OPENCLAW_ prefix that is otherwise stripped from preserved

437+

// environments. These represent intentional, user-placed configuration on the

438+

// service definition that the install/repair flow should not silently revert.

439+

const PRESERVED_OPENCLAW_OPERATOR_OPT_IN_ENV_KEYS = new Set([

440+

"OPENCLAW_CLI_CONTAINER_BYPASS",

441+

"OPENCLAW_CONTAINER_HINT",

442+

]);

443+
444+

export function collectPreservedExistingServiceEnvVars(

436445

existingEnvironment: Record<string, string | undefined> | undefined,

437446

managedServiceEnvKeys: Set<string>,

438447

): Record<string, string | undefined> {

@@ -450,7 +459,7 @@ function collectPreservedExistingServiceEnvVars(

450459

upper === "HOME" ||

451460

upper === "PATH" ||

452461

upper === "TMPDIR" ||

453-

upper.startsWith("OPENCLAW_")

462+

(upper.startsWith("OPENCLAW_") && !PRESERVED_OPENCLAW_OPERATOR_OPT_IN_ENV_KEYS.has(upper))

454463

) {

455464

continue;

456465

}