@@ -24,6 +24,22 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngress do
2424
2525 @ json_error_type "invalid_request_error"
2626
27+ @ pruned_runtime_helper_routes [
28+ { "GET" , [ "backend-api" , "codex" , "agent-identities" , "jwks" ] } ,
29+ { "GET" , [ "backend-api" , "wham" , "agent-identities" , "jwks" ] } ,
30+ { "POST" , [ "api" , "codex" , "rate-limit-reset-credits" , "consume" ] } ,
31+ { "POST" , [ "wham" , "rate-limit-reset-credits" , "consume" ] } ,
32+ { "POST" , [ "backend-api" , "wham" , "rate-limit-reset-credits" , "consume" ] } ,
33+ { "POST" , [ "backend-api" , "codex" , "thread" , "goal" , "get" ] } ,
34+ { "POST" , [ "backend-api" , "codex" , "thread" , "goal" , "set" ] } ,
35+ { "POST" , [ "backend-api" , "codex" , "thread" , "goal" , "clear" ] } ,
36+ { "POST" , [ "backend-api" , "codex" , "analytics-events" , "events" ] } ,
37+ { "POST" , [ "backend-api" , "codex" , "memories" , "trace_summarize" ] } ,
38+ { "POST" , [ "backend-api" , "codex" , "alpha" , "search" ] } ,
39+ { "POST" , [ "backend-api" , "codex" , "realtime" , "calls" ] } ,
40+ { "POST" , [ "backend-api" , "codex" , "safety" , "arc" ] }
41+ ]
42+
2743 def init ( opts ) , do: opts
2844
2945 def call ( conn , _opts ) do
@@ -36,6 +52,9 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngress do
3652 |> admit_mcp_request ( )
3753 |> prepare_mcp_body ( settings )
3854
55+ pruned_runtime_helper_request? ( conn ) ->
56+ send_pruned_runtime_helper_absent ( conn )
57+
3958 runtime_path? ( conn . path_info ) ->
4059 settings = OperationalSettings . current ( )
4160
@@ -379,6 +398,11 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngress do
379398
380399 def protected_backend_raw_request? ( _conn ) , do: false
381400
401+ @ spec pruned_runtime_helper_request? ( Plug.Conn . t ( ) ) :: boolean ( )
402+ defp pruned_runtime_helper_request? ( % Plug.Conn { method: method , path_info: path_info } ) do
403+ { method , path_info } in @ pruned_runtime_helper_routes
404+ end
405+
382406 defp decode_or_send_compressed_body ( conn , settings ) do
383407 case CompressedBody . decode ( conn , settings ) do
384408 { :ok , conn } -> conn
@@ -387,6 +411,13 @@ defmodule CodexPoolerWeb.Plugs.RuntimeIngress do
387411 end
388412 end
389413
414+ defp send_pruned_runtime_helper_absent ( conn ) do
415+ conn
416+ |> put_resp_content_type ( "text/html" )
417+ |> send_resp ( 404 , "Not Found" )
418+ |> halt ( )
419+ end
420+
390421 defp runtime_path? ( path_info ) do
391422 Enum . any? ( @ runtime_prefixes , & List . starts_with? ( path_info , & 1 ) )
392423 end
0 commit comments