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

推荐订阅源

爱范儿
爱范儿
腾讯CDC
博客园 - 司徒正美
A
About on SuperTechFans
H
Help Net Security
J
Java Code Geeks
C
Check Point Blog
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
MyScale Blog
MyScale Blog
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
I
InfoQ
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
博客园 - 【当耐特】
雷峰网
雷峰网

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(raft): support current bridge protocol · openclaw/ope...
vincentkoc · 2026-06-22 · via Recent Commits to openclaw:main
11

// Raft gateway lifecycle owns the loopback-only wake endpoint and bridge child process.

22

import { spawn, type ChildProcess } from "node:child_process";

3-

import { createHash, randomBytes, timingSafeEqual } from "node:crypto";

3+

import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";

44

import type { EventEmitter } from "node:events";

55

import {

66

createServer,

@@ -23,9 +23,11 @@ import { RAFT_CHANNEL_ID, type ResolvedRaftAccount } from "./accounts.js";

2323

import { dispatchRaftWake } from "./inbound.js";

24242525

const BRIDGE_HOST = "127.0.0.1";

26+

const ACTIVITY_DRAIN_PATH = "/activity/drain";

2627

const HEALTH_PATH = "/health";

2728

const WAKE_PATH = "/wake";

2829

const WAKE_TOKEN_HEADER = "x-raft-bridge-token";

30+

const RAFT_ACTIVITY_DRAIN_SCHEMA = "raft-activity-drain.v1";

2931

const MAX_WAKE_BODY_BYTES = 16 * 1024;

3032

const WAKE_DEDUPE_TTL_MS = 24 * 60 * 60 * 1000;

3133

const WAKE_DEDUPE_MEMORY_MAX_SIZE = 1_000;

@@ -245,8 +247,9 @@ export async function startRaftGatewayAccount(

245247

onDiskError: (error) => {

246248

ctx.log?.warn?.(`Raft wake dedupe storage failed: ${String(error)}`);

247249

},

248-

});

250+

});

249251

const token = (deps.createToken ?? createToken)();

252+

const runtimeSession = randomUUID();

250253

const sockets = new Set<Socket>();

251254

let stopped = false;

252255

let bridgeExited: Error | undefined;

@@ -256,6 +259,24 @@ export async function startRaftGatewayAccount(

256259

sendJson(response, 200, { ok: true });

257260

return;

258261

}

262+

if (

263+

request.method === "GET" &&

264+

new URL(request.url ?? "/", `http://${BRIDGE_HOST}`).pathname === ACTIVITY_DRAIN_PATH

265+

) {

266+

if (!hasMatchingToken(request, token)) {

267+

sendJson(response, 401, { error: "unauthorized" });

268+

return;

269+

}

270+

// Raft drains runtime activity after each wake pass. OpenClaw has no

271+

// portable Raft activity events to export, but must acknowledge an

272+

// empty batch so the bridge's current protocol remains healthy.

273+

sendJson(response, 200, {

274+

schema: RAFT_ACTIVITY_DRAIN_SCHEMA,

275+

events: [],

276+

dropped: 0,

277+

});

278+

return;

279+

}

259280

if (request.method !== "POST" || request.url !== WAKE_PATH) {

260281

sendJson(response, 404, { error: "not found" });

261282

return;

@@ -304,7 +325,12 @@ export async function startRaftGatewayAccount(

304325

await wakeDedupe.commit(dedupeKey, { namespace: ctx.accountId });

305326

return true;

306327

});

307-

sendJson(response, 202, { accepted: true, ...(dispatched ? {} : { duplicate: true }) });

328+

sendJson(response, 202, {

329+

ok: true,

330+

accepted: true,

331+

runtimeSession,

332+

...(dispatched ? {} : { duplicate: true }),

333+

});

308334

})().catch((error: unknown) => {

309335

const statusCode = error instanceof WakeRequestError ? error.statusCode : 500;

310336

const message = error instanceof WakeRequestError ? error.message : "Internal server error.";