Preserve floating-point values when decoding rollout lines (#38399)

## Why

Serde's generic buffering for flattened and internally tagged fields is incompatible with `serde_json`'s `arbitrary_precision` representation. As a result, persisted rollout items containing nested floating-point values can fail to decode.

## What changed

- Decode the rollout envelope at the JSON persistence boundary before deserializing the item payload.
- Use the shared decoder for both session resume and thread-history projection.
- Cover token-count floats, response-item metadata, field ordering, and ignored metadata in the decoder compatibility test.

GitOrigin-RevId: 59c7f6fbcf83162b5ed6980a69381fe45fc20a0a
This commit is contained in:
Tamir Duberstein authored and copyberry committed 2026-08-13 16:03:20 +00:00
1 parent 053dda6b89
commit 2bd8727a0c
4 files changed
+60 -4

No files matched your search

+1 -2
View File
@@ -57,7 +57,6 @@ use super::session_index::find_thread_names_by_ids;
use crate::InitialHistory;
use crate::ResumedHistory;
use crate::RolloutItem;
use crate::RolloutLine;
use crate::config::RolloutConfigView;
use crate::state_db;
use crate::state_db::StateDbHandle;
@@ -1035,7 +1034,7 @@ impl RolloutRecorder {
reject_unknown_thread_history_mode(&value)?;
}
let rollout_line = match serde_json::from_value::<RolloutLine>(value) {
let rollout_line = match crate::decode_rollout_line(value) {
Ok(rollout_line) => rollout_line,
Err(e) => {
trace!("failed to parse rollout line: {e}");