You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RSPEED-2885: sanitize model and MCP output in all response paths (#1563)
* test(responses): add failing tests for output and model sanitization
Red tests for _sanitize_response_dict to cover:
- mcp_list_tools/mcp_call items not filtered from output array
- model field not stripping provider prefix (google-vertex/...)
These tests document the expected behavior before the fix.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix(responses): sanitize model and MCP output in all response paths
Move output array filtering into _sanitize_response_dict() so both
streaming and non-streaming paths strip server-deployed MCP items
(mcp_list_tools, mcp_call, mcp_approval_request). Strip provider
routing prefix from model field (e.g. google-vertex/.../gemini-2.5-flash
becomes gemini-2.5-flash).
Removes redundant ad-hoc output filtering from the streaming generator
that was missing from the non-streaming path, causing the leak QE found.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* test(e2e): update response model assertions for sanitized model field
E2E feature files now use {MODEL_SHORT} placeholder for response body
assertions since the model field is stripped of provider prefix.
Request bodies still send {PROVIDER}/{MODEL} unchanged.
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* fix(responses): only strip model prefix when server-substituted
Follow the same pattern as instructions: if the client specified a model,
echo it back unchanged. Only strip the provider routing prefix when the
server chose the model (client sent empty/no model).
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
* docs(responses): document model sanitization behavior
* Revert "test(e2e): update response model assertions for sanitized model field"
This reverts commit d49aa55.
* test: assert model prefix is stripped when server auto-selects
Update e2e auto-select scenarios to verify the response model field
contains just the model name (no provider prefix) when the client
omits the model parameter and the server substitutes it.
* style: add docstring to _make_streaming_completed_chunk helper
* test: align auto-select e2e assertions with string input scenario
Use full response structure assertion (object, status, model, output)
matching the pattern from 'Responses accepts string input' scenario,
per reviewer feedback.
---------
Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Copy file name to clipboardExpand all lines: docs/responses.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -399,7 +399,7 @@ The following response attributes are inherited directly from the LLS OpenAPI sp
399
399
|`completed_at`| integer | Completion time (Unix), if set |
400
400
|`error`| object | Error details if failed or incompleted |
401
401
|`id`| string | Unique response ID or moderation ID |
402
-
|`model`| string | Model ID (provider/model) used|
402
+
|`model`| string | Model used for generation. If the client specified `model` in the request, it is echoed unchanged; if the server selected the model, the provider routing prefix is stripped (see [Model Selection](#model-selection))|
@@ -515,6 +515,8 @@ In OpenResponses the `model` field is required; in LCORE it is optional. If you
515
515
3.**First available** — Otherwise, the first available LLM model is used.
516
516
4. If no model can be selected (e.g. no default and no LLM models), the request fails with 404 (model not found).
517
517
518
+
**Model in response:** If the client specified a `model` in the request, it is echoed back unchanged in the response. If the server selected the model (because `model` was omitted from the request), the provider routing prefix is stripped and only the base model name is returned (e.g. `google-vertex/publishers/google/models/gemini-2.5-flash` → `gemini-2.5-flash`). This prevents leaking server infrastructure details and follows the same pattern as [System Prompt Resolution](#system-prompt-resolution).
0 commit comments