Skip to content

Conversation

@zetxqx
Copy link
Contributor

@zetxqx zetxqx commented Jan 12, 2026

What type of PR is this?

/kind bug

What this PR does / why we need it:

This PR updates the prefixCacheScorer plugin to defer updating the cache index and recording metrics until
the ResponseReceived phase. This will prevent the case when request is shedded the prefix cache index is still updated.

See: #971 (comment) and #971 (comment)

Changes:

  1. Moved the indexer update logic from PreRequest to ResponseReceived to ensure only served requests update
    the cache (avoiding updates from shedded requests).
  2. Updated SchedulingContextState for prefixCacheScorer to persist selected servers and metric stats across the request lifecycle for ResponseReceived to process. This will prevent a larger refactor since the interface of ResponseReceived only have targetPod *datalayer.EndpointMetadata.

Which issue(s) this PR fixes:

Fixes partially #971

Does this PR introduce a user-facing change?:

Almost none, delayed the prefix cache update just after response is received.

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jan 12, 2026
@netlify
Copy link

netlify bot commented Jan 12, 2026

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 7da5041
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/696522e985d4a90008c5b285
😎 Deploy Preview https://deploy-preview-2125--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: zetxqx
Once this PR has been reviewed and has the lgtm label, please assign liu-cong for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 12, 2026
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 12, 2026
@zetxqx zetxqx force-pushed the pcreponsereceived branch from 53b7b1f to 7da5041 Compare January 12, 2026 16:35
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 20, 2026
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ahg-g
Copy link
Contributor

ahg-g commented Jan 20, 2026

/assign @liu-cong

var (
_ framework.Scorer = &Plugin{}
_ requestcontrol.PreRequest = &Plugin{}
_ requestcontrol.ResponseReceived = &Plugin{}
Copy link
Contributor

@nirrozenbaum nirrozenbaum Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just as a clarification for any reviewer - the extension point ResponseReceived is called when the response HEADERS are received, it is NOT waiting for the body to arrive.
(naming selection here is bad, we have an open issue to update the extension point name).

// ResponseReceived is called by the director after the response headers are successfully received
// which indicates the beginning of the response handling by the model server.
// The given pod argument is the pod that served the request.
type ResponseReceived interface {
plugins.Plugin
ResponseReceived(ctx context.Context, request *types.LLMRequest, response *Response, targetEndpoint *datalayer.EndpointMetadata)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants