Owen Lin
5f79a92e39
Persist response token usage in rollout history ( #41912 )
...
## Why
Resumed threads need to continue per-turn and per-thread token totals without scanning arbitrarily far beyond the latest compaction checkpoint.
## What changed
- Add durable `TokenUsageRecord` rollout items with response, turn, thread, session, and root-turn attribution.
- Restore accumulated usage on resume and snapshot the latest record plus the compaction response ID in compaction checkpoints.
- Preserve root-turn lineage in persisted turn context, while ensuring forked child threads start with their own usage totals.
## Testing
- Cover usage accumulation across multiple responses and resumed turns.
- Cover local and remote compaction checkpoints, invalid remote compaction output, rollout reconstruction, and fork isolation.
GitOrigin-RevId: ef9e0c4a9102a08a2c382be4cdac68c84353c90a
2026-08-31 21:15:38 +00:00
..
2026-08-13 00:30:08 +00:00
2026-08-24 21:39:48 +00:00
2026-08-27 02:19:10 +00:00
2026-08-17 12:26:59 +00:00
2026-08-24 21:39:48 +00:00
2026-08-10 22:39:29 +00:00
2026-08-21 19:04:32 +00:00
2026-07-09 00:17:38 +00:00
2026-08-24 21:39:48 +00:00
2026-08-27 02:19:10 +00:00
2026-08-29 03:04:26 +00:00
2026-07-08 00:15:49 +00:00
2026-08-21 20:15:23 +00:00
2026-08-29 19:57:06 +00:00
2026-08-21 19:56:52 +00:00
2026-08-21 21:41:55 +00:00
2026-05-28 14:54:39 -07:00
2026-08-18 22:00:25 +00:00
2026-08-27 08:44:54 +00:00
2026-08-13 21:53:52 +00:00
2026-08-25 19:54:52 +00:00
2026-08-27 00:02:26 +00:00
2026-07-22 16:30:12 +00:00
2026-07-15 05:21:13 +00:00
2026-08-24 06:43:07 +00:00
2026-07-14 01:49:16 +00:00
2026-06-27 19:34:10 +00:00
2026-08-24 06:43:07 +00:00
2026-08-24 23:00:57 +00:00
2026-08-25 17:55:50 +00:00
2026-08-17 12:26:59 +00:00
2026-08-19 01:06:12 +00:00
2026-07-31 16:17:44 +00:00
2026-08-18 21:46:18 +00:00
2026-07-08 00:15:49 +00:00
2026-08-25 19:10:35 +00:00
2026-08-31 17:10:38 +00:00
2026-08-31 17:10:38 +00:00
2026-08-31 15:19:38 +00:00
2026-08-20 06:29:32 +00:00
2026-07-15 20:59:21 +00:00
2026-08-25 21:38:10 +00:00
2026-08-04 15:23:43 +00:00
2026-07-23 15:32:36 +00:00
2026-08-25 19:38:39 +00:00
2026-08-20 05:24:56 +00:00
2026-08-20 17:49:35 +00:00
2026-08-18 18:01:39 +00:00
2026-08-27 20:05:08 +00:00
2026-08-29 02:43:10 +00:00
2026-08-25 20:26:23 +00:00
2026-08-30 13:02:11 +00:00
2026-07-23 19:19:35 +00:00
2026-08-26 18:42:44 +00:00
2026-08-27 00:02:26 +00:00
2026-08-18 06:22:04 +00:00
2026-08-14 05:49:33 +00:00
2026-08-14 01:23:59 +00:00
2026-08-24 20:47:10 +00:00
2026-08-07 00:28:32 +00:00
2026-07-22 16:30:12 +00:00
2026-07-22 16:30:12 +00:00
2026-07-22 16:30:12 +00:00
2026-08-25 20:26:23 +00:00
2026-08-27 21:10:10 +00:00
2026-08-28 00:07:32 +00:00
2026-08-04 16:16:30 +00:00
2026-07-29 01:16:29 +00:00
2026-08-12 13:33:01 +00:00
2026-08-08 16:58:26 +00:00
2026-08-27 23:43:46 +00:00
2026-07-22 16:30:12 +00:00
2026-08-31 00:20:06 +00:00
2026-08-25 01:03:20 +00:00
2026-08-18 05:42:39 +00:00
2026-07-29 22:00:20 +00:00
2026-08-25 19:10:35 +00:00
2026-08-20 07:03:02 +00:00
2026-08-20 07:03:02 +00:00
2026-08-20 19:19:41 +00:00
2026-08-20 07:33:27 +00:00
2026-08-25 19:10:35 +00:00
2026-08-25 18:14:32 +00:00
2026-08-26 18:42:44 +00:00
2026-08-25 16:47:13 +00:00
2026-08-20 08:10:08 +00:00
2026-08-07 18:38:24 +00:00
2026-07-22 16:30:12 +00:00
2026-08-26 19:02:02 +00:00
2026-08-28 12:40:10 +00:00
2026-08-23 03:25:56 +00:00
2026-07-23 23:18:06 +00:00
2026-08-26 22:37:59 +00:00
2026-08-26 23:58:10 +00:00
2026-08-25 21:34:05 +00:00
2026-07-22 16:30:12 +00:00
2026-07-23 19:19:35 +00:00
2026-08-25 21:34:05 +00:00
2026-05-12 18:40:53 -07:00
2026-08-25 18:11:04 +00:00
2026-08-25 19:10:35 +00:00
2026-08-31 21:15:38 +00:00
2026-08-29 19:57:06 +00:00
2026-08-25 19:10:35 +00:00
2026-08-10 23:32:42 +00:00
2026-07-22 16:30:12 +00:00
2026-08-28 18:07:40 +00:00
2026-08-25 19:10:35 +00:00
2026-08-20 07:03:02 +00:00
2026-08-25 01:03:20 +00:00
2026-08-10 23:32:42 +00:00
2026-07-22 16:30:12 +00:00
2026-08-20 17:46:05 +00:00
2026-08-25 17:55:50 +00:00
2026-08-20 18:29:35 +00:00
2026-08-30 07:40:36 +00:00
2026-08-20 17:46:05 +00:00
2026-08-27 08:44:54 +00:00
2026-07-23 00:02:15 +00:00
2026-07-08 00:15:49 +00:00