fix: restart repeat provisions and record live controller

This commit is contained in:
冰朔 2026-08-05 11:43:06 +08:00
commit e99135dbb5
4 changed files with 66 additions and 4 deletions

View file

@ -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"
}

View file

@ -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∞",

View file

@ -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() };

View file

@ -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 }); }
});