refactor(epp): unexport RequestContext protocol and response state - #2457
Merged
LukeAVanDrie merged 2 commits intoAug 20, 2026
Merged
Conversation
The stream state machine, drop reason, and response-phase bookkeeping fields have no users outside the handlers package. Unexporting them gives the ext_proc protocol state a compile-time boundary, making the struct split proposed in llm-d#1189 unnecessary. Also deletes the request trailer response field and constants, which were never assigned. Signed-off-by: Luke Van Drie <lukevandrie@google.com>
LukeAVanDrie
force-pushed
the
refactor/reqctx-encapsulation
branch
from
August 19, 2026 16:41
c807938 to
60c6161
Compare
Collaborator
|
/lgtm |
Resolves the RequestContext conflict with the StreamedEvents field added on main: the field stays exported because the director reads it, and it joins the request-control group next to Usage. Signed-off-by: Luke Van Drie <lukevandrie@google.com>
Contributor
Author
thanks did a merge commit, though the conflict was only a single line from another one of my PRs that merged earlier |
LukeAVanDrie
enabled auto-merge (squash)
August 20, 2026 06:54
elevran
approved these changes
Aug 20, 2026
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.
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Issue #1189 proposed splitting
RequestContextinto a protocol struct and a request-state struct because internal layers (director, admission control) could reach raw Envoy ext_proc machinery. Most of that machinery is already unexported: the gRPC response buffers, the streaming flag, and the processing-duration bookkeeping are package-private on main. Unexporting the remaining package-private surface enforces the boundary at compile time and makes the struct split unnecessary.Unexported:
RequestStatefield, theStreamRequestStatetype and its constants, and theRequestDroppedReasonfield.FirstTokenTimestamp,LastChunkReceivedTimestamp,ResponseCompleteTimestamp,ResponseSize,ResponseComplete,ResponseStatusCode,RequestRunning.Deleted dead protocol code: the
reqTrailerRespfield was never assigned, so its send branch inupdateStateAndSendIfNeededcould not execute, and theTrailerRequestResponsesCompleteandTrailerResponseResponsesCompleteconstants were never referenced. The state constants are package-private and their values never leave the process, so the hand-numbered values are replaced withiota.The struct fields are grouped by owner (request-control layers vs the handlers package), and the TODO referencing kubernetes-sigs/gateway-api-inference-extension#2082 (closed unimplemented) is replaced with a doc comment stating the visibility rule.
Exported fields with users outside the package are unchanged:
Request,Response,SchedulingRequest,TargetPod,TargetEndpoint,TargetEndpointScores, the model names,ObjectiveKey,Priority,RequestReceivedTimestamp,RequestSize,Usage,ResponseBodyStarted,Parser. Out-of-tree implementations of theDirectorinterface lose compile-time access to the newly unexported fields; no in-tree consumer reads them, and they carry ext_proc protocol state with no external use.Observed while auditing field usage, left out of scope:
PriorityduplicatesSchedulingRequest.Objectives.Priority. Deriving it would change the priority label on error metrics for requests that fail between the two assignments.ResponseBodyStartedis director-maintained state on the shared struct. Relocating it belongs with future director-state work.Which issue(s) this PR fixes:
Fixes #1189
Release note (write
NONEif no user-facing change):