From ce833cd6de2a27e8fad39fb3d5a0e985ed811f94 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 26 Feb 2026 14:20:43 +0000 Subject: [PATCH] fix(browser): land PR #24142 flush relay pending timers on stop Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR #24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> --- CHANGELOG.md | 1 + src/browser/extension-relay.ts | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02c424634..b9104467e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Docs: https://docs.openclaw.ai - Browser/Extension relay CORS: handle `/json*` `OPTIONS` preflight before auth checks, allow Chrome extension origins, and return extension-origin CORS headers on relay HTTP responses so extension token validation no longer fails cross-origin. Landed from contributor PR #23962 by @miloudbelarebia. (#23842) - Browser/Extension relay auth: allow `?token=` query-param auth on relay `/json*` endpoints (consistent with relay WebSocket auth) so curl/devtools-style `/json/version` and `/json/list` probes work without requiring custom headers. Landed from contributor PR #26015 by @Sid-Qin. (#25928) +- Browser/Extension relay shutdown: flush pending extension-request timers/rejections during relay `stop()` before socket/server teardown so in-flight extension waits do not survive shutdown windows. Landed from contributor PR #24142 by @kevinWangSheng. - Auth/Auth profiles: normalize `auth-profiles.json` alias fields (`mode -> type`, `apiKey -> key`) before credential validation so entries copied from `openclaw.json` auth examples are no longer silently dropped. (#26950) thanks @byungsker. - Cron/Hooks isolated routing: preserve canonical `agent:*` session keys in isolated runs so already-qualified keys are not double-prefixed (for example `agent:main:main` no longer becomes `agent:main:agent:main:main`). Landed from contributor PR #27333 by @MaheshBhushan. (#27289, #27282) - iOS/Talk mode: stop injecting the voice directive hint into iOS Talk prompts and remove the Voice Directive Hint setting, reducing model bias toward tool-style TTS directives and keeping relay responses text-first by default. (#27543) thanks @ngutman. diff --git a/src/browser/extension-relay.ts b/src/browser/extension-relay.ts index 7ad80420b..514988a62 100644 --- a/src/browser/extension-relay.ts +++ b/src/browser/extension-relay.ts @@ -820,6 +820,11 @@ export async function ensureChromeExtensionRelayServer(opts: { extensionConnected, stop: async () => { relayRuntimeByPort.delete(port); + for (const [, pending] of pendingExtension) { + clearTimeout(pending.timer); + pending.reject(new Error("server stopping")); + } + pendingExtension.clear(); try { extensionWs?.close(1001, "server stopping"); } catch {