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

推荐订阅源

freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
Vercel News
Vercel News
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
罗磊的独立博客
B
Blog
博客园_首页
A
About on SuperTechFans
有赞技术团队
有赞技术团队
V
V2EX
U
Unit 42
I
InfoQ
IT之家
IT之家
博客园 - 司徒正美
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
The Cloudflare Blog
H
Help Net Security

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
test: cover gateway wrapper persistence in docker e2e · o...
steipete · 2026-04-27 · via Recent Commits to openclaw:main

@@ -139,6 +139,49 @@ LOGINCTL

139139

fi

140140

}

141141142+

assert_exec_arg() {

143+

local unit_path="$1"

144+

local index="$2"

145+

local expected="$3"

146+

local exec_line=""

147+

local actual=""

148+

exec_line=$(grep -m1 "^ExecStart=" "$unit_path" || true)

149+

if [ -z "$exec_line" ]; then

150+

echo "Missing ExecStart in $unit_path"

151+

exit 1

152+

fi

153+

exec_line="${exec_line#ExecStart=}"

154+

actual=$(echo "$exec_line" | awk -v field="$index" "{print \$field}")

155+

actual="${actual%\"}"

156+

actual="${actual#\"}"

157+

if [ "$actual" != "$expected" ]; then

158+

echo "Expected ExecStart arg $index to be $expected, got $actual"

159+

cat "$unit_path"

160+

exit 1

161+

fi

162+

}

163+164+

assert_env_value() {

165+

local unit_path="$1"

166+

local key="$2"

167+

local expected="$3"

168+

if ! grep -Fxq "Environment=${key}=${expected}" "$unit_path"; then

169+

echo "Expected Environment=${key}=${expected} in $unit_path"

170+

cat "$unit_path"

171+

exit 1

172+

fi

173+

}

174+175+

assert_no_env_key() {

176+

local unit_path="$1"

177+

local key="$2"

178+

if grep -q "^Environment=${key}=" "$unit_path"; then

179+

echo "Expected no Environment=${key}= line in $unit_path"

180+

cat "$unit_path"

181+

exit 1

182+

fi

183+

}

184+142185

# Each flow: install service with one variant, run doctor from the other,

143186

# and verify ExecStart entrypoint switches accordingly.

144187

run_flow() {

@@ -191,4 +234,83 @@ LOGINCTL

191234

"$git_entry" \

192235

"$npm_bin doctor --repair --force --yes" \

193236

"$npm_entry"

237+238+

run_wrapper_flow() {

239+

local name="wrapper-persistence"

240+

local install_log="/tmp/openclaw-doctor-switch-${name}-install.log"

241+

local reinstall_log="/tmp/openclaw-doctor-switch-${name}-reinstall.log"

242+

local env_repair_log="/tmp/openclaw-doctor-switch-${name}-env-repair.log"

243+

local doctor_log="/tmp/openclaw-doctor-switch-${name}-doctor.log"

244+

local clear_log="/tmp/openclaw-doctor-switch-${name}-clear.log"

245+

local command_timeout="${OPENCLAW_DOCKER_DOCTOR_SWITCH_COMMAND_TIMEOUT:-300s}"

246+247+

echo "== Flow: $name =="

248+

home_dir=$(mktemp -d "/tmp/openclaw-switch-${name}.XXXXXX")

249+

export HOME="$home_dir"

250+

export USER="testuser"

251+

mkdir -p "$HOME/.local/bin"

252+

local wrapper="$HOME/.local/bin/openclaw-wrapper"

253+

cat > "$wrapper" <<WRAPPER

254+

#!/usr/bin/env bash

255+

set -euo pipefail

256+

printf "%s\n" "\$@" >> "$HOME/openclaw-wrapper-argv.log"

257+

exec "$npm_bin" "\$@"

258+

WRAPPER

259+

chmod +x "$wrapper"

260+261+

local unit_path="$HOME/.config/systemd/user/openclaw-gateway.service"

262+263+

if ! timeout "$command_timeout" "$npm_bin" gateway install --wrapper "$wrapper" --force >"$install_log" 2>&1; then

264+

cat "$install_log"

265+

exit 1

266+

fi

267+

assert_exec_arg "$unit_path" 1 "$wrapper"

268+

assert_exec_arg "$unit_path" 2 "gateway"

269+

assert_env_value "$unit_path" "OPENCLAW_WRAPPER" "$wrapper"

270+271+

if ! timeout "$command_timeout" "$npm_bin" gateway install --force >"$reinstall_log" 2>&1; then

272+

cat "$reinstall_log"

273+

exit 1

274+

fi

275+

assert_exec_arg "$unit_path" 1 "$wrapper"

276+

assert_exec_arg "$unit_path" 2 "gateway"

277+

assert_env_value "$unit_path" "OPENCLAW_WRAPPER" "$wrapper"

278+279+

sed -i "/^Environment=OPENCLAW_WRAPPER=/d" "$unit_path"

280+

if ! timeout "$command_timeout" "$npm_bin" gateway install --wrapper "$wrapper" >"$env_repair_log" 2>&1; then

281+

cat "$env_repair_log"

282+

exit 1

283+

fi

284+

assert_exec_arg "$unit_path" 1 "$wrapper"

285+

assert_env_value "$unit_path" "OPENCLAW_WRAPPER" "$wrapper"

286+287+

sed -i "s#^Environment=OPENCLAW_WRAPPER=.*#Environment=OPENCLAW_WRAPPER=/tmp/stale-openclaw-wrapper#" "$unit_path"

288+

if ! timeout "$command_timeout" "$npm_bin" gateway install --wrapper "$wrapper" >"$env_repair_log" 2>&1; then

289+

cat "$env_repair_log"

290+

exit 1

291+

fi

292+

assert_exec_arg "$unit_path" 1 "$wrapper"

293+

assert_env_value "$unit_path" "OPENCLAW_WRAPPER" "$wrapper"

294+295+

if ! timeout "$command_timeout" node "$git_cli" doctor --repair --force --yes >"$doctor_log" 2>&1; then

296+

cat "$doctor_log"

297+

exit 1

298+

fi

299+

if ! grep -Fq "Gateway service invokes OPENCLAW_WRAPPER:" "$doctor_log"; then

300+

echo "Expected doctor to report active wrapper"

301+

cat "$doctor_log"

302+

exit 1

303+

fi

304+

assert_exec_arg "$unit_path" 1 "$wrapper"

305+

assert_env_value "$unit_path" "OPENCLAW_WRAPPER" "$wrapper"

306+307+

if ! timeout "$command_timeout" env OPENCLAW_WRAPPER= "$npm_bin" gateway install --force >"$clear_log" 2>&1; then

308+

cat "$clear_log"

309+

exit 1

310+

fi

311+

assert_no_env_key "$unit_path" "OPENCLAW_WRAPPER"

312+

assert_entrypoint "$unit_path" "$npm_entry"

313+

}

314+315+

run_wrapper_flow

194316

'