fix: non-streaming conversation messages endpoint (#9159)

* fix: non-streaming conversation messages endpoint

**Problems:**
1. `AssertionError: run_id is required when enforce_run_id_set is True`
   - Non-streaming path didn't create a run before calling `step()`

2. `ResponseValidationError: Unable to extract tag using discriminator 'message_type'`
   - `response_model=LettaStreamingResponse` but non-streaming returns `LettaResponse`

**Fixes:**
1. Add run creation before calling `step()` (mirrors agents endpoint)
2. Set run_id in Redis for cancellation support
3. Pass `run_id` to `step()`
4. Change `response_model` from `LettaStreamingResponse` to `LettaResponse`
   (streaming returns `StreamingResponse` which bypasses response_model validation)

**Test:**
Added `test_conversation_non_streaming_raw_http` to verify the fix.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

* api sync

---------

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
cthomas
2026-01-28 11:51:01 -08:00
committed by Caren Thomas
parent dd7e28fae6
commit d992aa0df4
3 changed files with 89 additions and 6 deletions

View File

@@ -8859,7 +8859,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LettaStreamingResponse"
"$ref": "#/components/schemas/LettaResponse"
},
"description": "JSON response (when streaming=false)"
},