fix(plugins): deliver onStreamComplete to disk-installed plugins (#11825) - #11934
Merged
diegosouzapw merged 2 commits intoAug 30, 2026
Conversation
pacocartones
added a commit
to pacocartones/OmniRoute
that referenced
this pull request
Aug 28, 2026
pacocartones
force-pushed
the
fix/plugin-onstreamcomplete-delivery
branch
from
August 28, 2026 19:19
af5f241 to
9387e49
Compare
…gosouzapw#11825) onStreamComplete (shipped in v3.8.50, diegosouzapw#9669) was emitted on the gateway side but never delivered to disk-installed plugins: the manifest HooksSchema dropped hooks.onStreamComplete, and the loader/manager only knew the seven legacy hooks. Declare it as a manifest hook, wire it through the loader as a fire-and-forget notification, register it in the manager, and thread requestId (the request traceId) into the payload so consumers can correlate the event.
pacocartones
force-pushed
the
fix/plugin-onstreamcomplete-delivery
branch
from
August 29, 2026 02:49
9387e49 to
af7675d
Compare
Contributor
Author
|
CI note — the red checks are not this change's doing (delivering onStreamComplete to disk-installed plugins). |
…n-only antigravity lock-exact-model drift)
diegosouzapw
merged commit Aug 30, 2026
66e02ec
into
diegosouzapw:release/v3.8.51
4 of 7 checks passed
This was referenced Aug 30, 2026
diegosouzapw
pushed a commit
that referenced
this pull request
Aug 30, 2026
…ok fields reach existing installs (#12120) Refresca o manifest do plugin a partir do disco ao ativar, para que instalações pré-existentes ganhem hooks novos adicionados por schema updates (ex.: `onStreamComplete` do #11825/#11934 nunca chegava a plugins já instalados antes do upgrade, pois o manifest persistido no DB era stripado pelo schema antigo). Finding 3 do #12113. Teste próprio (259 linhas). Validado no worktree combinado. Obrigado!
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…gosouzapw#11825) (diegosouzapw#11934) Resynced onto release/v3.8.51 (originally targeted main; retargeted since the default branch is release/v3.8.51). One real conflict in open-sse/handlers/chatCore.ts, but it was entirely unrelated to this PR's actual purpose: the antigravity-aware lockExactModel branching and deferAntigravityQuotaStateToCaller state exist on main but haven't been synced to release/v3.8.51 yet (confirmed by diffing your branch against its own main merge-base — the only change there was a Prettier reformat, not new logic). Discarded that unrelated drift and kept the release tip's current quota-lock shape; the onStreamComplete plugin wiring itself is untouched and intact. typecheck:core clean, 13/13 plugin delivery tests pass. Thanks for the thorough three-layer root-cause writeup.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…ok fields reach existing installs (diegosouzapw#12120) Refresca o manifest do plugin a partir do disco ao ativar, para que instalações pré-existentes ganhem hooks novos adicionados por schema updates (ex.: `onStreamComplete` do diegosouzapw#11825/diegosouzapw#11934 nunca chegava a plugins já instalados antes do upgrade, pois o manifest persistido no DB era stripado pelo schema antigo). Finding 3 do diegosouzapw#12113. Teste próprio (259 linhas). Validado no worktree combinado. Obrigado!
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
onStreamComplete(shipped in v3.8.50, feat(plugins): add onStreamComplete built-in event exposing streaming usage and timing (#9571) #9669) was emitted on the gateway side but never delivered to disk-installed plugins — the plugin-facing wiring was missing, so no plugin could subscribe to it.HooksSchemahad noonStreamCompletefield (Zod silently stripped it fromplugin.json);loader.tsbuilt no IPC wrapper for it; andmanager.ts's hardcodedhookNameslist never registered it. The event fired into an empty registry and was dropped. The existingchatcore-plugin-onresponsetests only passed because they callregisterHook("onStreamComplete", …)directly — a path real plugins don't have.onStreamCompleteas a manifest hook, wire it through the loader as a fire-and-forget notification (same pattern as the lifecycle hooks), and register it in the manager. The payload now also carriesrequestId(the requesttraceId) so consumers can correlate the stream-completion event withonRequest/onResponsefor the same request.Related Issues
Validation
tests/unit/plugins-onstreamcomplete-delivery-11825.test.ts— drives the real install → activate → emit path (notregisterHookdirectly). Verified failing on the pre-fix tree (manifest.hooks.onStreamComplete must survive validation;installed plugin should declare onStreamComplete; got "[]") and passing after (2/2).npm run lint(pre-commit prettier + eslint ran clean on all touched files)main; focused test rerun afterwardTests Added Or Updated
tests/unit/plugins-onstreamcomplete-delivery-11825.test.ts: installs + activates a plugin declaringonStreamComplete, emits throughrunPluginOnStreamCompleteHook, and asserts the plugin process receives the payload includingrequestId. Also asserts the manifest schema preserves the hook flag.Reviewer Notes
onStreamCompleteis wired alongside the lifecycle hooks because it is a one-way fire-and-forget notification (no return value consumed); no blocking-hook path changes.onStreamCompletestream-finalization callback instreamFailureFinalization.ts/streamingCost.ts— that is a different concept.