Skip to content

feat: add Lua filter to afterExtProcFilterPrefixes - #2054

Merged
nacx merged 3 commits into
envoyproxy:mainfrom
nuthalapativarun:fix/lua-filter-ordering-1469
Apr 16, 2026
Merged

feat: add Lua filter to afterExtProcFilterPrefixes#2054
nacx merged 3 commits into
envoyproxy:mainfrom
nuthalapativarun:fix/lua-filter-ordering-1469

Conversation

@nuthalapativarun

@nuthalapativarun nuthalapativarun commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Description

Allow Lua filters configured via EnvoyExtensionPolicy to run after the AI Gateway ext_proc filter, consistent with how Wasm filters are already handled.

The afterExtProcFilterPrefixes slice controls which filters AIGW's ext_proc is inserted before. Wasm was already in this list, but Lua was missing, so Lua filters would end up running before AIGW's ext_proc rather than after it. This prevented users from using Lua scripts to act on AIGW metadata (e.g. the x-ai-eg-model header set by ext_proc).

This PR adds EnvoyFilterLua to afterExtProcFilterPrefixes in the same position as EnvoyFilterWasm, and adds a corresponding test case.

Note: This code was written with AI assistance (Claude Code).

Related Issues/PRs (if applicable)

Fixes #1469

Special notes for reviewers (if applicable)

The fix follows the exact same pattern used for EnvoyFilterWasm (line 799). EnvoyFilterLua is defined in the egv1a1 package (envoy.filters.http.lua) so no new dependencies are introduced.

Allow Lua filters configured via EnvoyExtensionPolicy to run after the
AI Gateway ext_proc filter, consistent with how Wasm filters are already
handled. This enables users to leverage AIGW metadata (e.g. x-ai-eg-model
header) in Lua scripts without resorting to EnvoyPatchPolicy workarounds.

Fixes envoyproxy#1469

Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
@nuthalapativarun
nuthalapativarun requested a review from a team as a code owner April 16, 2026 05:23
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 16, 2026
@nacx
nacx enabled auto-merge (squash) April 16, 2026 07:55
@codecov-commenter

codecov-commenter commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.38%. Comparing base (9ed89f7) to head (ad3fd07).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2054   +/-   ##
=======================================
  Coverage   84.38%   84.38%           
=======================================
  Files         130      130           
  Lines       18116    18116           
=======================================
  Hits        15287    15287           
  Misses       1883     1883           
  Partials      946      946           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nacx
nacx merged commit fc5fc70 into envoyproxy:main Apr 16, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow a Lua filter to run after AIGW's ext proc?

3 participants