store and expose parent_thread_id on Threads#25113
Draft
owenlin0 wants to merge 4 commits into
Draft
Conversation
79f0199 to
5019c4d
Compare
5e9ee64 to
21583d8
Compare
jif-oai
approved these changes
May 30, 2026
Collaborator
jif-oai
left a comment
There was a problem hiding this comment.
lgtm if you're sure it does not break anything in the app UX for multi-agent (I guess not but double check please)
| })?; | ||
| if let Ok(meta_line) = read_session_meta_line(path.as_path()).await { | ||
| thread.forked_from_id = meta_line.meta.forked_from_id; | ||
| thread.parent_thread_id = meta_line.meta.parent_thread_id; |
Collaborator
There was a problem hiding this comment.
Just for the record: this is not backward compatible
But it's good for now
21583d8 to
17702d3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This PR #24161 (comment) revealed a subagent data modeling issue, where we overloaded
forked_from_idto also meanparent_thread_id. That's incorrect since guardian and review subagents can be a subagent and NOT fork the main thread's history.The solution here is to explicitly store a new
parent_thread_idonSessionMeta, alongsideforked_from_idwhich already exists. While we're at it, also expose it in the app-server protocol on theThreadobject.A thread->subagent relationship and a fork of thread history are orthogonal concepts.
What Changed
parent_thread_idpersistence onSessionMetaand runtime/session plumbing throughSessionConfiguredEvent,CodexSpawnArgs,SessionConfiguration,ThreadConfigSnapshot,TurnContext, andModelClient.SessionSourceorforked_from_thread_id.InitialHistory.Thread.parentThreadId.parentThreadIdresponse field.