Skip to content

Add subagent lineage turn metadata#24161

Draft
owenlin0 wants to merge 1 commit into
owen/forked_from_thread_idfrom
owen/subagent_lineage
Draft

Add subagent lineage turn metadata#24161
owenlin0 wants to merge 1 commit into
owen/forked_from_thread_idfrom
owen/subagent_lineage

Conversation

@owenlin0
Copy link
Copy Markdown
Collaborator

Why

Stacked on #24160.

forked_from_thread_id captures copied-history lineage, but it intentionally does not describe subagent control lineage. A subagent can be spawned without copied history, and when history is copied the copied-history source and immediate spawning parent are related but distinct concepts. Responses API metadata should preserve that distinction so consumers can accurately classify the current thread and reconstruct its lineage.

What changed

  • Adds parent_thread_id and subagent_type to core-owned x-codex-turn-metadata.
  • Documents the distinction between copied-history lineage (forked_from_thread_id) and subagent/control lineage (parent_thread_id) beside the turn metadata model.
  • Derives subagent_type from SessionSource::SubAgent and sets parent_thread_id only for SubAgentSource::ThreadSpawn.
  • Rehydrates resumed session source metadata from stored thread metadata so follow-up turns after app-server restart plus thread/resume preserve subagent lineage.
  • Extends reserved-key, git-enrichment, thread-spawn, and app-server v2 metadata coverage for the new subagent fields.

Verification

  • Not run to completion after splitting this stack; the focused subagent codex-core test run was canceled before completion.

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