Skip to content

feat: support in-place session rewind - #508

Open
nikita-ashihmin wants to merge 1 commit into
agentclientprotocol:mainfrom
nikita-ashihmin:nikita.ashikhmin/ijai-2003-session-rewind
Open

feat: support in-place session rewind#508
nikita-ashihmin wants to merge 1 commit into
agentclientprotocol:mainfrom
nikita-ashihmin:nikita.ashikhmin/ijai-2003-session-rewind

Conversation

@nikita-ashihmin

Copy link
Copy Markdown
Collaborator

Summary

  • Implement the AIR _session/rewind extension.
  • Map rewind to Codex thread/revert while retaining the same thread ID.
  • Advertise the sessionRewind capability.
  • Add protocol documentation and regression tests for message-ID and fingerprint resolution.

Verification

  • npm run typecheck — passed.
  • npm run build — passed.
  • Session rewind and initialize tests — 9 passed.
  • git diff --check origin/main...HEAD — passed.

https://youtrack.jetbrains.com/issue/IJAI-2003

Map the AIR session rewind extension to Codex thread/revert. Keep the same thread ID and avoid a provider fork.

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.

🟡 Changes recommended

Legacy sessions cannot be rewound, and fingerprint fallback fails for multimodal and skill messages.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds AIR session rewind support by mapping _session/rewind to Codex thread history operations.

Changes:

  • Adds rewind protocol handling, capability negotiation, and Codex integration.
  • Resolves rewind points using message IDs or fingerprints.
  • Adds documentation and regression tests.
File summaries
File Description
src/SessionRewind.ts Implements rewind-point resolution and execution.
src/index.ts Validates and registers rewind requests.
src/CodexAppServerClient.ts Adds thread/revert RPC support.
src/CodexAcpServer.ts Advertises and dispatches the extension.
src/CodexAcpClient.ts Exposes rewind to the ACP server.
src/AirExtension.ts Defines the capability key.
src/AcpExtensions.ts Adds rewind extension types and routing.
src/__tests__/SessionRewind.test.ts Tests ID and fingerprint resolution.
src/__tests__/CodexACPAgent/initialize.test.ts Verifies capability advertisement.
README.md Lists session rewind support.
docs/session-rewind-extension.md Documents the extension protocol.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/SessionRewind.ts
`Rewind message ${request.beforeMessage.messageId} was not found in session ${request.sessionId}`,
);
}
await client.threadRevert({threadId: request.sessionId, beforeTurnId: turn.id});
Comment thread src/SessionRewind.ts
Comment on lines +46 to +47
function userMessageText(content: Array<{type: string; text?: string}>): string {
return content.filter(item => item.type === "text").map(item => item.text ?? "").join("");
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