Repository navigation
fix(sse): pass real response payload into plugin onResponse hooks - #8806
Merged
diegosouzapw merged 1 commit intoJul 28, 2026
Conversation
Plugins always received a hard-coded {status:200} stub, so hooks like
request-logger never saw response bodies. Forward translated JSON for
non-streaming completions and a streamed flag for SSE without reading
the body twice.
Closes cheaper-inference#8711
diegosouzapw
merged commit Jul 28, 2026
2538565
into
cheaper-inference:release/v3.8.49
5 checks passed
diegosouzapw
added a commit
that referenced
this pull request
Jul 28, 2026
…0 test file-size: apiKeys.ts 1518 -> 1529 (#8805, treating cx/* and codex/* as equivalent provider prefixes in API-key model permissions) and chatCore.ts 5006 -> 5020 (#8806, passing the real response payload into plugin onResponse hooks instead of a hardcoded {status:200}). Both extend existing call sites rather than adding a branch. stryker: account-fallback-cf1010-no-retry-8775.test.ts covers accountFallback.ts but was missing from tap.testFiles, which would redden Fast Quality Gates on every subsequent PR.
Merged
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 2, 2026
…eaper-inference#8806) Plugins always received a hard-coded {status:200} stub, so hooks like request-logger never saw response bodies. Forward translated JSON for non-streaming completions and a streamed flag for SSE without reading the body twice. Closes cheaper-inference#8711
HouMinXi
pushed a commit
to HouMinXi/OmniRoute
that referenced
this pull request
Aug 2, 2026
…0 test file-size: apiKeys.ts 1518 -> 1529 (cheaper-inference#8805, treating cx/* and codex/* as equivalent provider prefixes in API-key model permissions) and chatCore.ts 5006 -> 5020 (cheaper-inference#8806, passing the real response payload into plugin onResponse hooks instead of a hardcoded {status:200}). Both extend existing call sites rather than adding a branch. stryker: account-fallback-cf1010-no-retry-8775.test.ts covers accountFallback.ts but was missing from tap.testFiles, which would redden Fast Quality Gates on every subsequent PR.
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…eaper-inference#8806) Plugins always received a hard-coded {status:200} stub, so hooks like request-logger never saw response bodies. Forward translated JSON for non-streaming completions and a streamed flag for SSE without reading the body twice. Closes cheaper-inference#8711
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…0 test file-size: apiKeys.ts 1518 -> 1529 (cheaper-inference#8805, treating cx/* and codex/* as equivalent provider prefixes in API-key model permissions) and chatCore.ts 5006 -> 5020 (cheaper-inference#8806, passing the real response payload into plugin onResponse hooks instead of a hardcoded {status:200}). Both extend existing call sites rather than adding a branch. stryker: account-fallback-cf1010-no-retry-8775.test.ts covers accountFallback.ts but was missing from tap.testFiles, which would redden Fast Quality Gates on every subsequent PR.
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
runPluginOnResponseHookalways forwarded a hard-coded{ status: 200 }stub, so plugins never saw response bodies.{ status: 200, data: translatedResponse }.{ status: 200, streamed: true }without materializing/double-reading the SSE body.Closes #8711
Test plan
node --import tsx/esm --test tests/unit/chatcore-plugin-onresponse.test.ts tests/unit/8395-plugin-hooks-fire.test.tsnode --import tsx/esm --test tests/unit/plugins-hooks.test.tsincludeBodyon a non-streaming chat completion and confirm loggedresponse.datastreamed: true