From 0a56150d0111c1063f99772daa0cece41614be69 Mon Sep 17 00:00:00 2001 From: weichen Date: Mon, 12 Oct 2026 15:31:27 +0000 Subject: [PATCH] Pass the exec-tool kill switch into the clean serve process Why: env -i dropped RDM_DISABLE_EXEC_TOOLS, so the real RDM binary exited immediately on runners without bwrap, and the capability probe now prints the JSON document. Evidence: SELF bash -n scripts/svc.sh; python3 -m py_compile tests/test_svc_realcombo.py. GATE run 2656 job 3831 failed on the previous head before this fix. Impact: serve and the lifecycle child forward that one switch; identity capabilities is checked as protocol 1 JSON. Refs: #485 Co-authored-by: Cursor --- scripts/svc.sh | 7 +++++++ tests/test_svc_realcombo.py | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/svc.sh b/scripts/svc.sh index e1785f07..cab87ecf 100755 --- a/scripts/svc.sh +++ b/scripts/svc.sh @@ -1396,11 +1396,15 @@ svc_launch_serve() { fi # 桩只靠 SVC_STUB_* 找到记录目录。这些变量不写入 serve.env,避免 recover # 把某次测试路径固化进实例;生产调用方没有它们。 + # RDM_DISABLE_EXEC_TOOLS 是产品兜底开关,必须到达 serve,否则无 bwrap 时拒启。 local k while IFS= read -r k; do [ -n "$k" ] || continue args+=("$k=${!k}") done < <(compgen -e | grep -E '^SVC_STUB_' || true) + if [ -n "${RDM_DISABLE_EXEC_TOOLS:-}" ]; then + args+=("RDM_DISABLE_EXEC_TOOLS=$RDM_DISABLE_EXEC_TOOLS") + fi # shellcheck disable=SC2086 nohup "${args[@]}" "$ENV_BIN" serve $exec_args >> "$ENV_DIR/svc.log" 2>&1 9>&- & } @@ -1422,6 +1426,9 @@ svc_lifecycle_child() { [ -n "$k" ] || continue args+=("$k=${!k}") done < <(compgen -e | grep -E '^(SVC_|LC_)' || true) + if [ -n "${RDM_DISABLE_EXEC_TOOLS:-}" ]; then + args+=("RDM_DISABLE_EXEC_TOOLS=$RDM_DISABLE_EXEC_TOOLS") + fi args+=(bash "$0" __lifecycle "$@") "${args[@]}" } diff --git a/tests/test_svc_realcombo.py b/tests/test_svc_realcombo.py index 9a15ae4d..63b3b8be 100644 --- a/tests/test_svc_realcombo.py +++ b/tests/test_svc_realcombo.py @@ -134,7 +134,11 @@ class RealComboTests(tsr.SvcAutoRecoverTests): "identity", "capabilities"], capture_output=True, text=True, timeout=15) self.assertEqual(cap.returncode, 0, cap.stderr) - self.assertIn("identity-capabilities: v1", cap.stdout) + doc = json.loads(cap.stdout) + self.assertEqual(doc["protocol"], 1) + self.assertEqual(doc["identity"]["open"], "existing-no-migrate") + self.assertIn("ensure", doc["identity"]["ops"]) + self.assertIn("verify", doc["identity"]["ops"]) # 错 id verify 拒绝 bad = subprocess.run([str(self.runtime("rc1") / "bin" / "agent-system"), "identity", "verify", "--instance-id",