fix(batches): persist real terminal status when billing expired batches

This commit is contained in:
mateo-berri 2026-08-13 21:24:54 -07:00
parent 19184694f5
commit eacea13a25
2 changed files with 4 additions and 1 deletions

View file

@ -698,7 +698,7 @@ class CheckBatchCost:
# mark the job as complete
try:
update_data: dict = {
"status": "complete",
"status": response.status if response.status != "completed" else "complete",
"file_object": response.model_dump_json(),
}
if self._has_batch_processed_column:

View file

@ -1036,6 +1036,9 @@ class TestCheckBatchCost:
1
]["data"]
assert update_data["batch_processed"] is True
assert (
update_data["status"] == "expired"
), "billed expired batch must keep its real terminal status in the DB"
@pytest.mark.asyncio
async def test_raw_output_file_id_converted_to_managed_id(