dermanyang-oai
b781733f95
Separate thread preparation from execution persistence ( #47199 )
...
## Why
Injecting context before the first turn currently forces a full flush. Stores need a preparation checkpoint that can leave disposable context in memory, while local storage must keep prepared context durable before the first user input.
## What changed
- Add `PersistContext::ThreadPreparation` and `CodexThread::checkpoint_preparation()`, and use the checkpoint in `inject_response_items()`.
- Allow stores to defer rollout-derived metadata writes through `record_thread_metadata()`, including during preparation and execution checkpoints. Keep standard metadata updates synchronous.
- Flush local storage at preparation checkpoints so injected context survives restart.
## Testing
Add tests showing that preparation and first sampling can proceed without waiting for durable metadata. Cover prepared context in first and follow-up requests, plus durability before first input and restoration after restart, in both legacy and paginated history modes.
GitOrigin-RevId: 74f6bb1a5f8d47192364b8bba6afd703a3b7d688
2026-09-22 05:53:29 +00:00
..
2026-09-21 18:19:07 +00:00
2026-07-06 14:29:19 -07:00
2026-09-22 03:20:04 +00:00
2026-09-21 17:29:13 +00:00
2026-09-21 13:56:17 +00:00
2026-09-01 18:24:56 +00:00
2026-09-21 23:06:36 +00:00
2026-09-09 17:45:37 +00:00
2026-09-14 15:30:22 +00:00
2026-08-21 06:41:28 +00:00
2026-08-31 22:38:23 +00:00
2026-09-19 01:21:32 +00:00
2026-09-22 02:33:29 +00:00
2026-09-19 01:03:55 +00:00
2026-09-21 20:34:46 +00:00
2026-09-19 02:15:20 +00:00
2026-09-22 03:03:52 +00:00
2026-09-19 01:27:26 +00:00
2026-08-25 13:10:24 +00:00
2026-07-28 23:49:37 +00:00
2026-09-21 17:29:13 +00:00
2026-09-19 02:15:20 +00:00
2026-09-19 01:21:32 +00:00
2026-09-16 04:59:23 +00:00
2026-09-17 04:37:54 +00:00
2026-09-02 23:58:24 +00:00
2026-05-08 12:36:02 -07:00
2026-09-14 23:25:09 +00:00
2026-09-09 17:56:06 +00:00
2026-09-21 18:19:07 +00:00
2026-09-21 18:19:07 +00:00
2026-09-19 01:27:26 +00:00
2026-09-19 01:27:26 +00:00
2026-09-22 05:53:29 +00:00
2026-03-12 08:16:36 -07:00
2026-04-01 23:06:24 -07:00
2026-09-17 23:54:31 +00:00
2026-09-09 18:40:53 +00:00
2026-09-09 18:40:53 +00:00
2026-09-16 22:26:40 +00:00
2026-09-17 01:38:13 +00:00
2026-09-17 01:38:13 +00:00
2026-09-19 00:52:56 +00:00
2026-09-16 22:26:40 +00:00
2026-09-10 18:24:13 +00:00
2026-09-21 18:19:07 +00:00
2026-09-01 13:43:27 +00:00
2026-09-20 19:42:18 +00:00
2026-06-24 22:17:43 -07:00
2026-08-25 19:54:52 +00:00
2026-07-06 11:20:32 -07:00
2026-07-06 11:20:32 -07:00
2026-09-21 17:53:03 +00:00
2026-09-21 17:53:03 +00:00
2026-09-15 21:19:08 +00:00
2026-09-15 21:19:08 +00:00
2026-08-10 01:44:30 +00:00
2026-09-03 00:17:19 +00:00
2026-09-01 14:43:27 +00:00
2026-08-20 07:03:02 +00:00
2026-09-01 18:24:56 +00:00
2026-09-19 01:21:32 +00:00
2026-09-19 01:21:32 +00:00
2026-09-18 23:07:36 +00:00
2026-09-18 23:07:36 +00:00
2026-05-13 11:31:27 +02:00
2026-08-25 21:34:05 +00:00
2026-09-14 22:58:51 +00:00
2026-08-21 21:17:42 +00:00
2026-09-21 20:34:46 +00:00
2026-09-21 22:58:49 +00:00
2026-09-21 22:58:49 +00:00
2026-04-28 13:03:28 +02:00
2026-09-21 12:35:36 +00:00
2026-09-19 01:27:26 +00:00
2026-09-11 14:25:56 +00:00
2026-08-29 06:05:28 +00:00
2026-09-20 19:42:18 +00:00
2026-09-21 20:34:46 +00:00
2026-08-06 13:37:07 +00:00
2026-09-01 13:43:27 +00:00
2026-09-19 02:07:58 +00:00
2026-09-16 15:17:41 +00:00
2026-03-25 11:05:35 -07:00
2026-07-06 14:51:34 -07:00
2026-04-09 10:53:06 -07:00
2026-04-24 17:49:29 -07:00
2026-08-17 19:06:53 +00:00
2026-09-09 17:46:00 +00:00
2026-09-04 21:17:25 +00:00
2026-08-17 04:01:37 +00:00
2026-08-18 18:41:40 +00:00
2026-09-21 20:05:21 +00:00
2026-09-15 22:52:56 +00:00
2026-08-31 22:38:23 +00:00
2026-06-01 18:45:07 +00:00
2026-09-15 17:09:11 +00:00
2026-09-21 18:19:07 +00:00
2026-07-23 19:32:26 +00:00
2026-09-19 00:46:30 +00:00
2026-09-19 01:03:55 +00:00
2026-07-23 19:19:35 +00:00
2026-09-02 23:58:24 +00:00
2026-09-02 23:58:24 +00:00
2026-08-31 23:29:20 +00:00
2026-09-17 18:20:28 +00:00
2026-06-16 14:34:54 +02:00
2026-08-23 20:08:40 +00:00
2026-08-24 10:56:54 +00:00
2026-09-14 22:58:51 +00:00
2026-09-19 01:21:32 +00:00
2026-09-19 01:21:32 +00:00
2026-09-19 20:41:55 +00:00
2026-09-09 06:04:59 +00:00
2026-08-20 06:03:25 +00:00
2026-08-20 06:03:25 +00:00
2026-09-21 20:34:46 +00:00
2026-08-13 11:11:26 +00:00
2026-05-04 11:46:03 -07:00
2026-09-13 06:53:20 +00:00
2026-09-13 06:53:20 +00:00
2026-09-21 18:19:07 +00:00
2026-09-21 20:34:46 +00:00
2026-09-21 13:28:02 +00:00
2026-09-10 18:24:13 +00:00
2026-09-18 23:37:35 +00:00
2026-09-17 19:55:20 +00:00
2026-07-22 02:19:45 +00:00
2026-07-22 02:19:45 +00:00
2026-09-21 18:19:07 +00:00
2026-09-17 18:20:28 +00:00
2026-09-05 13:02:49 +00:00
2026-09-04 12:56:26 +00:00
2026-04-20 22:39:17 -07:00
2026-08-25 17:41:22 +00:00
2026-05-14 16:54:59 -07:00
2026-09-18 00:25:37 +00:00
2026-07-20 13:45:29 +00:00
2026-05-28 15:26:55 -07:00
2026-05-28 15:26:55 -07:00
2026-09-19 01:21:32 +00:00
2026-09-19 01:21:32 +00:00
2026-09-09 19:31:12 +00:00
2026-08-20 06:29:32 +00:00