Skip to content

Studio: keep the base URL query string on connection requests - #16951

Merged
danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:base-url-query-string
Nov 7, 2026
Merged

danielhanchen merged 3 commits into
unslothai:mainfrom
NilayYadav:base-url-query-string

Conversation

@NilayYadav

Copy link
Copy Markdown
Collaborator

A connection whose base URL carries a query string, such as an Azure OpenAI endpoint ending in ?api-version=preview, could be saved but did not work. Loading its models said there was no /models endpoint, the connection check failed with a 404, and every chat message came back as "Not found". The endpoint path was appended after the query string, so the server received /v1?api-version=preview/chat/completions instead of /v1/chat/completions?api-version=preview.

Chat, the connection check, the model list and audio transcription now put the endpoint path before the query string, the same way Read Aloud, image generation and the Responses API already did. Base URLs without a query string send exactly the same requests as before.

@NilayYadav NilayYadav self-assigned this Nov 6, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T11:39:36.838510Z 8d2fa53 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 0441108698

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 8d2fa533f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 7256cb4 into unslothai:main Nov 7, 2026
danielhanchen added a commit that referenced this pull request Nov 7, 2026
…ain (#17040)

## Summary

Two tests have been red on main since this morning's merges. Every PR
based on main now inherits them: #17010, which changes only the Windows
bash tool, fails both. Both reproduce on main locally:

```
(Python 3.13, a-f)  studio/backend/tests/test_custom_provider_api_type.py::test_base_url_query_survives_native_provider_calls
    At index 0 diff: ('/v1/models/claude-sonnet-4-5', 'tenant=a') != ('/v1/messages', 'tenant=a')

Repo tests (CPU, studio)  tests/studio/test_model_picker_contracts.py::test_batch_sizes_reach_an_api_load_through_the_server_mirror
    assert 'strip_batch = "n_batch" in kwargs,' in '...openai_auto_switch_settings.py...'
```

In both cases the product change is correct and the test is out of date.

- **#16951 and #16953.** #16951 (keep the base URL query string on
provider calls) added a test that lists every request the three native
providers make. #16953 merged four minutes later. It looks up the
model's output cap with `GET /v1/models/<model>` before a Messages API
stream that sets no `max_tokens`, so that provider now makes one more
request. That request goes through `_append_provider_path`, so it keeps
`?tenant=a`, which is the invariant #16951 cares about. The test simply
predates it. Each PR was green on its own.
- **#16927.** It moved the llama.cpp flag stripping into
`strip_args_shadowed_by(args, fields)`, so the line now reads
`strip_batch = "n_batch" in fields,` and is called with the same kwargs.
What gets stripped is unchanged. The contract test grepped for the old
source line.

## Change

Tests only:

- `test_base_url_query_survives_native_provider_calls` expects the
output-cap lookup first, with its query string kept. It also empties
`_anthropic_output_caps` first, so the lookup happens whatever ran
earlier in the worker. That cache is module-global, and with an entry
already cached the request list would change with test order.
- `test_batch_sizes_reach_an_api_load_through_the_server_mirror` stops
grepping that line. It calls the real `model_override_load_kwargs`,
imported the same way as the lookup-ladder helper already in that file:
  - a stored `-b` is dropped when the override has `n_batch`;
  - a stored `-ub` is dropped when the override has `n_ubatch`;
  - both stay when neither field is set.

## Testing

| | main | this branch |
|---|---|---|
| `test_custom_provider_api_type.py` +
`test_anthropic_default_max_tokens.py` | 1 failed | 29 passed, in either
file order |
| `tests/studio/test_model_picker_contracts.py` | 1 failed | 203 passed
|
| the batch test with `strip_batch = False` planted in
`strip_args_shadowed_by` | | fails |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants