Track window and fork positions in turn metadata (#40987)

## What changed

- Add the zero-based `window_number` to Responses turn metadata and include it in prewarm requests.
- Persist `forked_from_ordinal_exclusive` separately from the physical history base so fork lineage remains accurate after reverts and cold resumes.
- Report context-inheriting subagents through `parent_thread_id` without also emitting fork lineage.
- Reserve the new metadata keys while accepting and filtering previously valid configured values so Codex-owned values take precedence.

## Testing

- Cover window numbering across compaction, resume, and fork operations.
- Cover fork cutoff persistence across direct forks, legacy rollouts, reverts into inherited history, and cold resumes.

GitOrigin-RevId: 288f6cd632254814c1f166668b33828082d799a1
This commit is contained in:
Brandon Zhang authored and copyberry committed 2026-08-26 22:37:59 +00:00
1 parent 102ae5e2e6
commit 0d654e6536
33 files changed
+562 -44

No files matched your search

+1
View File
@@ -328,6 +328,7 @@ fn write_rollout_with_user_message(
session_id: thread_id.into(),
id: thread_id,
forked_from_id: None,
forked_from_ordinal_exclusive: None,
parent_thread_id: None,
timestamp: "2026-06-01T14:26:25Z".to_string(),
cwd: home.to_path_buf(),