Skip to content

feat: add read-only session history replay via _session/read - #815

Open
yaobii-lab wants to merge 1 commit into
agentclientprotocol:mainfrom
yaobii-lab:feat/session-read
Open

yaobii-lab wants to merge 1 commit into
agentclientprotocol:mainfrom
yaobii-lab:feat/session-read

Conversation

@yaobii-lab

Copy link
Copy Markdown

What

session/load and session/resume attach to a thread through thread/resume, which acquires Codex's exclusive rollout writer lock and starts configured MCP servers. When another client (such as the Codex desktop app, CLI, or another IDE) holds the session open, thread/resume fails with thread_active_writer, leaving multi-client workspaces unable to preview the conversation history over ACP.

This adds _session/read, a pre-standard extension advertised on both ACP v1 and v2 as _meta.sessionRead: { "supported": true } in the initialize response:

  • Reads thread metadata and items through the read-only Codex App Server API (thread/read and threadItemEntryPages, or threadReadWithHistory for legacy threads) without calling thread/resume, acquiring the writer lock, starting MCP servers, or installing an open SessionState.
  • Reuses streamThreadHistory so user messages, assistant messages, file citations, reasoning, tool calls, plans, compactions, session title, cursors (fork only), and recorded subagent histories match session/load and session/resume (including replay_complete framing on ACP v2).
  • Rejects requests when the session is already open on the same ACP connection (-32600, data.reason: "session_already_open") to prevent interleaved updates, and clears transient delivery state on completion so a subsequent session/load or session/resume starts cleanly.

Wire contract: docs/session-read.md.

Validation

  • npm run typecheck
  • npm test (2,818 passed, including session-read.test.ts across ACP v1/v2, active-writer threads, post-read session/load, parameter/not-found errors, cancellation, and scenario baseline checks)
  • npm run build and smoke-tested _session/read against a live local Codex App Server thread

Copilot AI balanced review requested due to automatic review settings November 28, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

This branch has not been deployed

No deployments
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.

2 participants