Repository navigation
Conversation
remove_url_endpoints split on the first '/v1' anywhere in the URL, so a host such as http://v1-nim:8000 matched the '//v1' in the authority and was truncated to 'http:/'. Match '/v1' only as a path segment. Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
[Medium impact] The change affects URL handling for NIM readiness and metadata requests. The PR appears safe to merge, with a non-blocking request to test longer version prefixes. Findings
Fix with agent prompt### Issue 1
nemo_retriever/tests/test_common_string_processing.py:14
The new cases cover hostname preservation, but none checks that `/v1beta` and `/v10` paths stay untouched. Add those cases to `test_remove_url_endpoints`. Without them, removing the regex’s right-hand boundary could restore the over-match while all six tests still pass.
```suggestion
("http://deplot:8000/v1", "http://deplot:8000"),
("http://deplot:8000/v1beta/chat/completions", "http://deplot:8000/v1beta/chat/completions"),
("http://deplot:8000/v10/chat/completions", "http://deplot:8000/v10/chat/completions"),
```
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryUpdates
The untouched Reviews (1) · Last reviewed commit: "fix(util): keep hostnames starting with ..." · Reviewed by Greptile |
| ("url", "expected"), | ||
| [ | ||
| ("http://deplot:8000/v1/chat/completions", "http://deplot:8000"), | ||
| ("http://deplot:8000/v1", "http://deplot:8000"), |
There was a problem hiding this comment.
Longer version paths lack tests
The new cases cover hostname preservation, but none checks that /v1beta and /v10 paths stay untouched. Add those cases to test_remove_url_endpoints. Without them, removing the regex’s right-hand boundary could restore the over-match while all six tests still pass.
| ("http://deplot:8000/v1", "http://deplot:8000"), | |
| ("http://deplot:8000/v1", "http://deplot:8000"), | |
| ("http://deplot:8000/v1beta/chat/completions", "http://deplot:8000/v1beta/chat/completions"), | |
| ("http://deplot:8000/v10/chat/completions", "http://deplot:8000/v10/chat/completions"), |
Prompt To Fix With AI
This is a comment left during a code review.
Path: nemo_retriever/tests/test_common_string_processing.py
Line: 14
Comment:
**Longer version paths lack tests**
The new cases cover hostname preservation, but none checks that `/v1beta` and `/v10` paths stay untouched. Add those cases to `test_remove_url_endpoints`. Without them, removing the regex’s right-hand boundary could restore the over-match while all six tests still pass.
```suggestion
("http://deplot:8000/v1", "http://deplot:8000"),
("http://deplot:8000/v1beta/chat/completions", "http://deplot:8000/v1beta/chat/completions"),
("http://deplot:8000/v10/chat/completions", "http://deplot:8000/v10/chat/completions"),
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Bug
remove_url_endpoints(nemo_retriever/.../common/api/util/string_processing/__init__.py) did:"/v1"matches anywhere in the string, including the//+ host. So a NIM endpoint whose hostname starts withv1is truncated tohttp:/:It's called by
_query_metadataand the NIM readiness check inmodels/nim/primitives/model_interface/helpers.py, so any NIM whose host starts withv1(e.g.v1-nim) gets a broken URL and looks permanently not-ready.Fix
Match
/v1only as a whole path segment (never inside the authority):http://v1-nim:8000/v1/chat→http://v1-nim:8000http://v1-nim:8000→ unchangedhttp://nim:8000/v1/chat→http://nim:8000(unchanged behavior)This also stops the previous over-match on
/v1beta//v10, which are no longer treated as the/v1endpoint.Tests
Adds parametrized cases to
nemo_retriever/tests/test_common_string_processing.py. Verified fail-on-revert: reverting the source makes thev1-hostname cases collapse tohttp:/; with the fix all 6 cases pass.