Skip to content

Add forked_from_thread_id turn metadata#24160

Draft
owenlin0 wants to merge 1 commit into
mainfrom
owen/forked_from_thread_id
Draft

Add forked_from_thread_id turn metadata#24160
owenlin0 wants to merge 1 commit into
mainfrom
owen/forked_from_thread_id

Conversation

@owenlin0
Copy link
Copy Markdown
Collaborator

Why

Responses API turn metadata already carries the current session, thread, and turn IDs, but forked threads do not currently identify the thread they copied history from. That makes it harder for downstream consumers to distinguish a brand-new root thread from a fork and to reconstruct history lineage from x-codex-turn-metadata.

What changed

  • Adds forked_from_thread_id as a core-owned field in x-codex-turn-metadata.
  • Introduces ThreadMetadataLineage as the explicit input for thread-lineage metadata instead of passing another loose Option through turn metadata construction.
  • Captures the copied-history source at fork/spawn boundaries before rollout truncation can drop copied session metadata.
  • Reserves forked_from_thread_id during client metadata merging and preserves it when git enrichment rebuilds the metadata bag.
  • Adds app-server/root fork and core turn metadata coverage for the new field.

Verification

  • just test -p codex-core --lib turn_metadata_state_includes_root_fork_lineage turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields turn_metadata_state_preserves_lineage_after_git_enrichment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant