Skip to content

Persist session IDs across thread resume#29327

Merged
jif-oai merged 4 commits into
mainfrom
jif/persist-subagent-session-id
Jun 22, 2026
Merged

Persist session IDs across thread resume#29327
jif-oai merged 4 commits into
mainfrom
jif/persist-subagent-session-id

Conversation

@jif-oai

@jif-oai jif-oai commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

A cold-resumed subagent kept its durable thread ID but could receive a new session ID, splitting one agent tree across multiple sessions after a restart.

Persist the root session ID in every rollout SessionMeta, carry it through thread creation, and restore it before initializing the resumed Session and AgentControl.

Behavior

For a nested agent tree:

root session R
  parent thread P
    child thread C

The child rollout stores:

session_id:       R
parent_thread_id: P
id:               C

After a cold resume, the child still belongs to root session R while its immediate parent remains P. The integration coverage uses distinct values for all three IDs so it catches restoring the session from parent_thread_id.

Legacy rollouts

Previous rollouts have id but no session_id. SessionMetaLine deserialization treats a missing session_id as id, keeping those files readable, listable, and resumable. When a legacy subagent is resumed through its root, that synthesized child ID no longer overrides the inherited root-scoped AgentControl. New rollouts always persist the explicit root session ID.

@jif-oai jif-oai requested a review from a team as a code owner June 21, 2026 11:21
@jif-oai

jif-oai commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa64660c0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/protocol/src/protocol.rs
Comment thread codex-rs/protocol/src/protocol.rs
Comment thread codex-rs/app-server/tests/common/rollout.rs Outdated
@jif-oai

jif-oai commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9fe64fe5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/protocol/src/protocol.rs
Comment thread codex-rs/rollout/src/recorder_tests.rs
Comment thread codex-rs/core/src/session/session.rs
@jif-oai jif-oai merged commit 6d15bb3 into main Jun 22, 2026
31 checks passed
@jif-oai jif-oai deleted the jif/persist-subagent-session-id branch June 22, 2026 07:36
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant