Conversation
bgrablin
force-pushed
the
fix/plugins-isolate-timed-out-hook-state
branch
from
August 28, 2026 03:23
380fef6 to
233a951
Compare
bgrablin
force-pushed
the
fix/plugins-isolate-timed-out-hook-state
branch
from
August 28, 2026 06:09
233a951 to
5571a03
Compare
Contributor
fix(plugins): isolate timed-out hook worker state — prevents a late first worker from completing a successor.
|
Contributor
Author
|
Closing as superseded. On base |
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
A timed-out plugin hook can currently publish its late result into a later callback invocation. This can return the wrong plugin value, surface the wrong exception, or complete a successor callback before that callback finishes.
The cause is late-bound closure state in
PluginManager.invoke_hook(): the timeout worker closes over loop-local context, result, failure, and completion objects that are reassigned for the next callback. Each worker now owns its invocation state for its full lifetime.Changes
pre_tool_callbehavior, caller-thread-only hooks, and context propagation.Validation
['late-first', 'third']instead of['third']['third']; the late first result cannot complete or populate the successorThe existing timeout test missed this overlap because it exercised one blocked callback followed by a healthy callback. It did not allow the timed-out worker to finish after the invocation loop advanced while a successor worker was also active. Therefore, it verified caller non-blocking behavior but not isolation of late completion state.
Timeout duration and configuration defaults are unchanged. Timeout suppression, timeout abandonment without joining,
pre_tool_callfail-closed semantics, caller-thread-only hooks, and contextvars propagation are unchanged.Duplicate search across current source and all issue/PR states found no equivalent report or change for late timed-out hook state. Related results were distinct: open #6622 covers the earlier hook-timeout/WAL work; merged #93824 established the current bounded-callback design; closed #39751 is an older lifecycle-timeout attempt; open #61656 requests opt-in strict policy hooks; merged #84901 covers shell-hook process-tree cleanup; and open #24557 is a broad plugin-isolation proposal. Exact searches for
timed-out hook next callback,stale hook result,hook worker closure,bind per-callback hook state, andB023 plugins modulefound no equivalent issue or PR.Infographic