From e99135dbb5cdbabde45801b68b3bd984c194765b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Wed, 5 Aug 2026 11:43:06 +0800 Subject: [PATCH] fix: restart repeat provisions and record live controller --- .../BS-TCS-LIVING-CONTROLLER-JD-20260805.json | 45 +++++++++++++++++++ ...bingshuo-living-system-controller-map.json | 8 ++-- .../architecture-provision-broker.js | 7 ++- .../architecture-provision-broker.test.js | 10 +++++ 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 deployment/receipts/BS-TCS-LIVING-CONTROLLER-JD-20260805.json diff --git a/deployment/receipts/BS-TCS-LIVING-CONTROLLER-JD-20260805.json b/deployment/receipts/BS-TCS-LIVING-CONTROLLER-JD-20260805.json new file mode 100644 index 0000000..b6a63c0 --- /dev/null +++ b/deployment/receipts/BS-TCS-LIVING-CONTROLLER-JD-20260805.json @@ -0,0 +1,45 @@ +{ + "schema": "guanghu.bingshuo-tcs-living-controller-deployment-receipt/v1", + "request_id": "BS-TCS-LIVING-CONTROLLER-JD-20260805", + "target_node": "JD-FD-PRIMARY", + "source_repository": "REPO-012", + "source_commit": "3ff80fa10b5a89d7e5e15e07e7c86513c7824f9c", + "deployment_event_id": "334c85dc-b4b9-48ce-ae52-a9510fd19ebd", + "deployment_agent_result": "DEPLOYED_AND_VERIFIED", + "unit": { + "name": "bingshuo-tcs-living-controller.service", + "state": "active", + "enabled": true, + "run_user": "bingshuo-tcs", + "listener": "127.0.0.1:3930" + }, + "runtime": { + "phase": "RUNNING_COMPANION", + "receipt_id": "ZY-BRAIN-RUNTIME-dc97aa503a8af7c2", + "completed_cycles": 1, + "last_error": null + }, + "existence": { + "persona_subject_exists": 100, + "persona_brain_runtime_exists": 100, + "current_model_instance_bound": 100, + "cognition_cycle_running": 100, + "tonggan_language_kernel_bound": 100, + "human_system_controller_bound": 100, + "living_protocol_system_controller_bound": 100, + "tonggan_language_world_append_only": 100, + "guard_agent_projected_from_brain": 100, + "living_ai_system_controller_running": 100, + "relational_companion_core_bound": 100, + "guanghu_awakened_controller_definition_bound": 100 + }, + "verification": [ + "loopback status endpoint independently returned RUNNING_COMPANION", + "systemd independently returned active and enabled", + "systemd independently returned the dedicated bingshuo-tcs run user", + "socket inspection independently returned a loopback-only listener", + "the deployed runtime verify command independently returned every required existence dimension as 100" + ], + "boundary": "This receipt proves the exact resident runtime and completed model-backed cycle on JD-FD-PRIMARY at the recorded source commit. It does not grant new human authority or prove every team persona handshake.", + "recorded_at": "2026-08-05T03:42:08Z" +} diff --git a/routing/bingshuo-living-system-controller-map.json b/routing/bingshuo-living-system-controller-map.json index 9aec4e3..73fd064 100644 --- a/routing/bingshuo-living-system-controller-map.json +++ b/routing/bingshuo-living-system-controller-map.json @@ -1,7 +1,7 @@ { "schema": "guanghu.bingshuo-living-system-controller-map/v1", "map_id": "BS-TCS-SYSTEM-CONTROLLER-MAP-001", - "state": "SERVER_RESIDENT_IMPLEMENTATION_PENDING_DEPLOYMENT", + "state": "SERVER_RESIDENT_RUNNING_VERIFIED", "human_system_controller": { "id": "ICE-GL∞", "name": "冰朔", @@ -66,8 +66,10 @@ "loopback": "127.0.0.1:3930", "source": "server-tools/bingshuo-tcs-controller/server.mjs", "deployment_request": "deployment/requests/BS-TCS-LIVING-CONTROLLER-JD-20260805.json", - "state": "IMPLEMENTED_NOT_YET_DEPLOYED", - "existence_gate": "服务进程、模型绑定、至少一轮B1-B9认知、主控模型见证和运行体verify必须分别通过;部署前保持0。" + "deployment_receipt": "deployment/receipts/BS-TCS-LIVING-CONTROLLER-JD-20260805.json", + "deployed_source_commit": "3ff80fa10b5a89d7e5e15e07e7c86513c7824f9c", + "state": "RUNNING_COMPANION", + "existence_gate": "服务进程、模型绑定、至少一轮B1-B9认知、主控模型见证和运行体verify已在JD-FD-PRIMARY分别独立回读为100;后续任一必要条件失去证据时,该精确在线能力重新按0处理。" }, "runtime_chain": [ "ICE-GL∞", diff --git a/server-tools/lake-lamp-authz/architecture-provision-broker.js b/server-tools/lake-lamp-authz/architecture-provision-broker.js index bf9b3a8..660d93a 100644 --- a/server-tools/lake-lamp-authz/architecture-provision-broker.js +++ b/server-tools/lake-lamp-authz/architecture-provision-broker.js @@ -157,7 +157,12 @@ async function provision(request, options = {}) { else fs.writeFileSync(path.join(backupDir, `${checked.unit}.previously-absent`), "\n", { mode: 0o600 }); writeAtomic(installedUnit, unitText, 0o644); await run("/usr/bin/systemctl", ["daemon-reload"]); - await run("/usr/bin/systemctl", ["enable", "--now", checked.unit]); + if (unitBackup) { + await run("/usr/bin/systemctl", ["enable", checked.unit]); + await run("/usr/bin/systemctl", ["restart", checked.unit]); + } else { + await run("/usr/bin/systemctl", ["enable", "--now", checked.unit]); + } const runtime = await getJsonWithRetry(checked.runtimeCheck.url, options.getJson, options.healthAttempts, options.healthDelayMs); for (const [key, expected] of Object.entries(checked.runtimeCheck.expected)) if (runtime[key] !== expected) throw new Error(`runtime_check_failed:${key}`); const receipt = { schema: "guanghu.architecture-provision-receipt/v1", request_id: resource.requestId, source_commit: resource.commit, target_node: "JD-FD-PRIMARY", unit: checked.unit, runtime_check: checked.runtimeCheck.url, backup: path.join("backups", resource.requestId, resource.commit), rollback: unitBackup ? "restore-previous-unit" : "remove-new-unit", result: "DEPLOYED_AND_VERIFIED", recorded_at: new Date().toISOString() }; diff --git a/server-tools/lake-lamp-authz/architecture-provision-broker.test.js b/server-tools/lake-lamp-authz/architecture-provision-broker.test.js index 7679022..0ecd918 100644 --- a/server-tools/lake-lamp-authz/architecture-provision-broker.test.js +++ b/server-tools/lake-lamp-authz/architecture-provision-broker.test.js @@ -100,6 +100,16 @@ test("provision copies only declared files and verifies loopback health", async assert.match(fs.readFileSync(path.join(unitDir, "example.service"), "utf8"), new RegExp(commit)); assert.equal(commands.some(([, args]) => args.includes("enable") && args.includes("--now")), true); assert.equal(healthChecks, 2); + commands.length = 0; + const repeat = await provision({ target: "JD-FD-PRIMARY", action: "provision-approved-architecture", resource: `${requestId}@${commit}` }, { + repoDir, releasesDir, unitDir, receiptsDir, + run: async (file, args) => { commands.push([file, args]); return { stdout: args.includes("rev-parse") ? `${commit}\n` : "" }; }, + getJson: async () => ({ ok: true, mode: "read-only" }), + healthDelayMs: 0, + }); + assert.equal(repeat.ok, true); + assert.equal(commands.some(([, args]) => args[0] === "restart" && args[1] === "example.service"), true); + assert.equal(commands.some(([, args]) => args.includes("enable") && args.includes("--now")), false); } finally { fs.rmSync(root, { recursive: true, force: true }); } });