-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(server): add middleware for provider data and test context #4367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+171
−47
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d8f747d to
dd814f2
Compare
3507982 to
3218597
Compare
ashwinb
reviewed
Dec 11, 2025
3218597 to
05ec343
Compare
ashwinb
requested changes
Dec 12, 2025
0610806 to
806b2b5
Compare
806b2b5 to
bb9e3e6
Compare
leseb
approved these changes
Dec 16, 2025
Collaborator
leseb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nit otherwise LGTM, thanks for catching this!
Ensures provider data and test context from X-LlamaStack-Provider-Data header is available to all routes, enabling deterministic ID generation in replay mode. Remove duplicate context setup from create_dynamic_typed_route(). Signed-off-by: Matthew F Leader <mleader@redhat.com>
bb9e3e6 to
3463505
Compare
ashwinb
approved these changes
Dec 16, 2025
cdoern
approved these changes
Dec 16, 2025
r-bit-rry
pushed a commit
to r-bit-rry/llama-stack
that referenced
this pull request
Dec 23, 2025
…stack#4367) # What does this PR do? Consolidates provider data context handling into middleware, eliminating duplication between FastAPI router routes and legacy @webmethod routes. Closes llamastack#4366 ## Test Plan Added unit test suite `test_test_context_middleware`, specifically `test_middleware_extracts_test_id_from_header` to validate the expected behavior. ``` ❯ ./scripts/unit-tests.sh tests/unit/ ``` Integration of the middleware test context with the `files` FastAPI router migration from [pull/4339](llamastack#4339). ``` ❯ git switch migrate-files-api Switched to branch 'migrate-files-api' ❯ git rebase fix-test-ctx-middleware Successfully rebased and updated refs/heads/migrate-files-api. ❯ ./scripts/integration-tests.sh --inference-mode replay --suite base --setup ollama --stack-config server:starter --subdirs files ``` Signed-off-by: Matthew F Leader <mleader@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Consolidates provider data context handling into middleware, eliminating
duplication between FastAPI router routes and legacy @webmethod routes.
Closes #4366
Test Plan
Added unit test suite
test_test_context_middleware, specificallytest_middleware_extracts_test_id_from_headerto validate the expected behavior.Integration of the middleware test context with the
filesFastAPI router migration from pull/4339.