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

推荐订阅源

U
Unit 42
Vercel News
Vercel News
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
量子位
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
IT之家
IT之家
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)

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: close native hook relay replacement race · openclaw/...
steipete · 2026-05-30 · via Recent Commits to openclaw:main

@@ -201,6 +201,7 @@ const MAX_PERMISSION_ALLOW_ALWAYS_ENTRIES = 512;

201201

const MAX_NATIVE_HOOK_BRIDGE_BODY_BYTES = 5_000_000;

202202

const MAX_NATIVE_HOOK_BRIDGE_RESPONSE_BYTES = 5_000_000;

203203

const NATIVE_HOOK_BRIDGE_RETRY_INTERVAL_MS = 25;

204+

const NATIVE_HOOK_BRIDGE_REPLACEMENT_RECORD_GRACE_MS = 250;

204205

const NATIVE_HOOK_RELAY_BRIDGE_STALE_REGISTRATION_ERROR =

205206

"native hook relay bridge stale registration";

206207

const ANSI_ESCAPE_PATTERN = new RegExp(`${String.fromCharCode(27)}\\[[0-?]*[ -/]*[@-~]`, "g");

@@ -717,7 +718,12 @@ export async function invokeNativeHookRelayBridge(

717718

) {

718719

break;

719720

}

720-

if (!isRetryableNativeHookRelayBridgeError(error)) {

721+

if (

722+

!isRetryableNativeHookRelayBridgeLookupError({

723+

error,

724+

elapsedMs: Date.now() - startedAt,

725+

})

726+

) {

721727

break;

722728

}

723729

await delay(

@@ -894,7 +900,9 @@ function registerNativeHookRelayBridge(registration: ActiveNativeHookRelayRegist

894900

} catch (error) {

895901

log.debug("native hook relay bridge dir prune skipped", { error });

896902

}

897-

unregisterNativeHookRelayBridge(registration.relayId);

903+

unregisterNativeHookRelayBridge(registration.relayId, {

904+

deferRegistryRemovalMs: NATIVE_HOOK_BRIDGE_REPLACEMENT_RECORD_GRACE_MS,

905+

});

898906

const token = randomUUID();

899907

const bridgeDir = ensureNativeHookRelayBridgeDir();

900908

const bridgeKey = nativeHookRelayBridgeKey(registration.relayId);

@@ -954,7 +962,10 @@ function writeNativeHookRelayBridgeRecordForRegistration(

954962

writeNativeHookRelayBridgeRecord(bridge.registryPath, record);

955963

}

956964957-

function unregisterNativeHookRelayBridge(relayId: string): void {

965+

function unregisterNativeHookRelayBridge(

966+

relayId: string,

967+

options?: { deferRegistryRemovalMs?: number },

968+

): void {

958969

const bridge = relayBridges.get(relayId);

959970

if (!bridge) {

960971

return;

@@ -963,6 +974,19 @@ function unregisterNativeHookRelayBridge(relayId: string): void {

963974

bridge.server.close();

964975

const record = readNativeHookRelayBridgeRecordIfExists(relayId);

965976

if (record?.token === bridge.token) {

977+

const deferRegistryRemovalMs = normalizePositiveInteger(options?.deferRegistryRemovalMs, 0);

978+

if (deferRegistryRemovalMs > 0) {

979+

// During stable-id replacement, leave the old record in place until the

980+

// new bridge writes over it. Hook subprocesses can then retry

981+

// ECONNREFUSED/stale-registration instead of observing a missing relay.

982+

const timeout = setTimeout(() => {

983+

if (readNativeHookRelayBridgeRecordIfExists(relayId)?.token === bridge.token) {

984+

rmSync(bridge.registryPath, { force: true });

985+

}

986+

}, deferRegistryRemovalMs);

987+

timeout.unref();

988+

return;

989+

}

966990

rmSync(bridge.registryPath, { force: true });

967991

}

968992

}

@@ -1221,6 +1245,17 @@ function isRetryableNativeHookRelayBridgeError(error: unknown): boolean {

12211245

);

12221246

}

122312471248+

function isRetryableNativeHookRelayBridgeLookupError(params: {

1249+

error: unknown;

1250+

elapsedMs: number;

1251+

}): boolean {

1252+

return (

1253+

isRetryableNativeHookRelayBridgeError(params.error) ||

1254+

(params.elapsedMs < NATIVE_HOOK_BRIDGE_REPLACEMENT_RECORD_GRACE_MS &&

1255+

isNativeHookRelayBridgeStaleRegistrationError(params.error))

1256+

);

1257+

}

1258+12241259

function nativeHookRelayBridgeDir(): string {

12251260

const uid = typeof process.getuid === "function" ? process.getuid() : "nouid";

12261261

return path.join(tmpdir(), `openclaw-native-hook-relays-${uid}`);

@@ -2235,6 +2270,9 @@ export const testing = {

22352270

const record = readNativeHookRelayBridgeRecordIfExists(relayId);

22362271

return record ? { ...record } : undefined;

22372272

},

2273+

isNativeHookRelayBridgeLookupRetryableForTests(error: unknown, elapsedMs = 0): boolean {

2274+

return isRetryableNativeHookRelayBridgeLookupError({ error, elapsedMs });

2275+

},

22382276

formatPermissionApprovalDescriptionForTests(

22392277

request: NativeHookRelayPermissionApprovalRequest,

22402278

): string {