fix(browser): flush pending extension timers on relay stop#24142
Closed
kevinWangSheng wants to merge 3 commits intoopenclaw:mainfrom
Closed
fix(browser): flush pending extension timers on relay stop#24142kevinWangSheng wants to merge 3 commits intoopenclaw:mainfrom
kevinWangSheng wants to merge 3 commits intoopenclaw:mainfrom
Conversation
The stop() method closes WebSocket connections and the HTTP server but does not explicitly clean up pendingExtension Map entries and their associated timers. If extensionWs?.close() triggers the close event asynchronously after server.close() has already completed, timer callbacks could fire against torn-down state. Flush all pending extension request timers before closing connections, matching the cleanup pattern already used in the WebSocket close handler. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The yieldMs: 10 parameter causes a race condition on Windows CI where the exec result status is still 'running' instead of 'completed'. Upstream PR openclaw#24070 identified this as a known flaky test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
steipete
added a commit
that referenced
this pull request
Feb 26, 2026
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>
Contributor
|
Landed on What I landed from this PR:
SHA mapping:
Thanks for the fix, @kevinWangSheng. |
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
execute008
pushed a commit
to execute008/openclaw
that referenced
this pull request
Feb 27, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
wanjizheng
pushed a commit
to wanjizheng/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com> (cherry picked from commit 19e722f)
vincentkoc
pushed a commit
to Sid-Qin/openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
vincentkoc
pushed a commit
to rylena/rylen-openclaw
that referenced
this pull request
Feb 28, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
steipete
added a commit
to Sid-Qin/openclaw
that referenced
this pull request
Mar 2, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
robertchang-ga
pushed a commit
to robertchang-ga/openclaw
that referenced
this pull request
Mar 2, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
dorgonman
pushed a commit
to kanohorizonia/openclaw
that referenced
this pull request
Mar 3, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
thebenjaminlee
pushed a commit
to escape-velocity-ventures/openclaw
that referenced
this pull request
Mar 7, 2026
Flush pending extension request timers/rejections during relay shutdown and document in changelog. Landed from contributor @kevinWangSheng (PR openclaw#24142). Co-authored-by: Shawn <118158941+kevinWangSheng@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stop()method inextension-relay.tscloses WebSocket connections and the HTTP server but does not explicitly clean uppendingExtensionMap entries and their associated timers.extensionWs?.close()triggers the close event asynchronously afterserver.close()has already completed, timer callbacks could fire against torn-down state, leading to potential errors or undefined behavior.stop()method, before closing connections and the server.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
None
Security Impact (required)
NoNoNoNoNoRepro + Verification
Environment
Steps
stop()on the relay serverExpected
Actual
Evidence
Human Verification (required)
Compatibility / Migration
YesNoNoFailure Recovery (if this breaks)
src/browser/extension-relay.tsRisks and Mitigations
🤖 Generated with Claude Code
Greptile Summary
Fixed a race condition in the extension relay server shutdown sequence by adding explicit cleanup of pending extension request timers before closing connections. The cleanup pattern matches the existing WebSocket close handler (lines 653-657) and prevents timer callbacks from firing against torn-down state.
stop()method before closing WebSocket connectionsConfidence Score: 5/5
Last reviewed commit: c0f68ec