Skip to content

Refactor: Split RequestContext into ProtocolContext and RequestState #2082

@LukeAVanDrie

Description

@LukeAVanDrie

What would you like to be added:

Consider refactoring pkg/epp/handlers/RequestContext. Currently, it is a monolithic struct containing:

  • Envoy External Proc protocol fields (reqHeaderResp, respBodyResp)
  • Request metadata (IncomingModelName)
  • Lifecycle state (RequestRunning, ResponseComplete, TargetPod)

Why is this needed:

As noted in the code TODO, this object exposes too much data to too many layers. As we add complex features, the lack of isolation makes it difficult to reason about the request lifecycle state machine.

We should split this into:

  1. ProtocolContext: Handles the gRPC/Envoy interaction.
  2. RequestState: Tracks the logical request lifecycle (Start/End times, Pod assignment).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions