From 68b452b71a6680375c42bbb34976611880dc2f4c Mon Sep 17 00:00:00 2001 From: octo-patch Date: Wed, 8 Apr 2026 12:51:05 +0800 Subject: [PATCH 1/2] fix: read request_id and traceparent early in on_http_request_headers Fixes #643 Move request_id and traceparent initialization to the start of on_http_request_headers so that all subsequent log messages within the same handler (including select_llm_provider) carry the correct request ID instead of showing 'no_request_id'. --- crates/llm_gateway/src/stream_context.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/llm_gateway/src/stream_context.rs b/crates/llm_gateway/src/stream_context.rs index afb0b0506..c5bc064b4 100644 --- a/crates/llm_gateway/src/stream_context.rs +++ b/crates/llm_gateway/src/stream_context.rs @@ -809,6 +809,10 @@ impl HttpContext for StreamContext { return Action::Continue; } + // Capture request ID and traceparent early so all subsequent log messages include them + self.request_id = self.get_http_request_header(REQUEST_ID_HEADER); + self.traceparent = self.get_http_request_header(TRACE_PARENT_HEADER); + // Capture HTTP method and protocol for tracing self.http_method = self.get_http_request_header(":method"); self.http_protocol = self.get_http_request_header(":scheme"); @@ -884,9 +888,6 @@ impl HttpContext for StreamContext { self.delete_content_length_header(); self.save_ratelimit_header(); - self.request_id = self.get_http_request_header(REQUEST_ID_HEADER); - self.traceparent = self.get_http_request_header(TRACE_PARENT_HEADER); - Action::Continue } From 9f76ca2bf1b25f044cd7249ff00ef6e8d745bd9c Mon Sep 17 00:00:00 2001 From: octo-patch Date: Fri, 10 Apr 2026 12:00:00 +0800 Subject: [PATCH 2/2] fix: exclude internal providers from routing_preferences model validation (fixes #645) --- crates/brightstaff/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/brightstaff/src/main.rs b/crates/brightstaff/src/main.rs index bc88b60b9..49881c449 100644 --- a/crates/brightstaff/src/main.rs +++ b/crates/brightstaff/src/main.rs @@ -189,10 +189,13 @@ async fn init_app_state( // Validate that all models referenced in top-level routing_preferences exist in model_providers. // The CLI renders model_providers with `name` = "openai/gpt-4o" and `model` = "gpt-4o", // so we accept a match against either field. + // Internal providers (arch-router, arch-function, etc.) are excluded since they are not + // valid routing targets for user-defined routing_preferences. if let Some(ref route_prefs) = config.routing_preferences { let provider_model_names: std::collections::HashSet<&str> = config .model_providers .iter() + .filter(|p| p.internal != Some(true)) .flat_map(|p| std::iter::once(p.name.as_str()).chain(p.model.as_deref())) .collect(); for pref in route_prefs {