Skip to content

feat(app-server): move v2 sessionId onto Thread#21336

Merged
jif-oai merged 4 commits into
mainfrom
jif/session-id-in-thread
May 6, 2026
Merged

feat(app-server): move v2 sessionId onto Thread#21336
jif-oai merged 4 commits into
mainfrom
jif/session-id-in-thread

Conversation

@jif-oai
Copy link
Copy Markdown
Collaborator

@jif-oai jif-oai commented May 6, 2026

Why

session_id and thread_id are separate identities after #20437, but app-server only surfaced sessionId on the thread/start, thread/resume, and thread/fork response envelopes. Other thread-bearing surfaces such as thread/list, thread/read, thread/started, thread/rollback, thread/metadata/update, and thread/unarchive either lacked the grouping key or forced clients to special-case those three responses.

Making sessionId part of the reusable Thread payload gives every v2 API surface one place to expose session-tree identity.

Mental model

  1. thread.sessionId lives on Thread
  2. It is a view/runtime identity for the current live session tree, not durable stored lineage metadata
  3. When app-server has a live loaded thread, it copies the real value from core’s session_configured.session_id
  4. When it only has stored/unloaded data, it falls back to thread.sessionId = thread.id

What changed

  • Added sessionId to the v2 Thread.
  • Removed the duplicate top-level sessionId fields from thread/start, thread/resume, and thread/fork; clients should now read response.thread.sessionId.
  • Populated thread.sessionId when building live thread responses, replaying loaded threads, and returning stored-thread summaries so the field is present across start, resume, fork, list, read, rollback, metadata-update, unarchive, and thread/started paths. See load_thread_from_resume_source_or_send_internal and thread_from_stored_thread.
  • Preserved the stored-thread fallback: if a thread has not been loaded into a live session tree yet, thread.sessionId falls back to thread.id; once the thread is live again, the field reports the active session tree root.
  • Regenerated the JSON/TypeScript schemas and updated the app-server README examples to show thread.sessionId on the thread object.
@jif-oai jif-oai changed the title chore: shift session ID instead Thread object feat: expose sessionId on Thread May 6, 2026
@jif-oai jif-oai changed the title feat: expose sessionId on Thread feat(app-server): move v2 sessionId onto Thread May 6, 2026
@jif-oai
Copy link
Copy Markdown
Collaborator Author

jif-oai commented May 6, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. Another round soon, please!

ℹ️ 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".

@jif-oai jif-oai merged commit 5ecff05 into main May 6, 2026
26 checks passed
@jif-oai jif-oai deleted the jif/session-id-in-thread branch May 6, 2026 13:23
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants