Allow any format for X-Request-Id

Open Beginner friendly
#1,337 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
api, backend

Research direction

The issue is in starlette-context's request ID validation. Look at the linked test file to see the UUID validation. Find where starlette-context is integrated in the llama-cpp-python server code, likely around middleware setup. Modify the validation to accept any string format for X-Request-Id, not just UUIDs. Test by sending a request with a non-UUID X-Request-Id header and ensure a 200 response.

Written by the indexing model from the issue text.

Description

enhancement

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I am running the latest code. Development is very rapid so there are no tagged versions as of now.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new bug or useful enhancement to share.

Expected Behavior

Normal response (200)

Current Behavior

400, Bad request

Environment and Context

Huggingface spaces docker

Failure Information (for bugs)

Feature introduced in https://github.com/abetlen/llama-cpp-python/pull/703, Huggingface Spaces already has x-request-id in the request, but it was not a valid uuid that starlette-context expected (https://github.com/tomwojcik/starlette-context/blob/992ab9401a9f557994379053fbd98471c601eda9/tests/test_plugins/test_request_id.py#L37), resulting in the server returning bad request 400.

Dominant language
Python
Stars
10.6k
Forks
1.5k
Avg merge
23m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from abetlen/llama-cpp-python

All issues in abetlen/llama-cpp-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.