fix: preserve attachments in imported session history - #571
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation and coverage consistently satisfy the stated replay behavior.
Review effort: Balanced
Findings: None
What changed in this PR
Restores Codex Desktop attachments as structured ACP history content while preserving requests and avoiding duplicate links.
Changes:
- Parses known Desktop attachment envelopes into resource links and text.
- Replays all native attachment variants with URI normalization and deduplication.
- Adds comprehensive legacy, paginated, and ACP v2 replay tests.
| File | Description |
|---|---|
src/DesktopAttachmentHistory.ts |
Parses envelopes and normalizes file URIs. |
src/CodexAcpServer.ts |
Maps and deduplicates replayed attachments. |
src/__tests__/DesktopAttachmentHistory.test.ts |
Tests parsing and path handling. |
src/__tests__/CodexACPAgent/v2-resume-replay.test.ts |
Tests ACP v2 replay modes. |
src/__tests__/CodexACPAgent/load-session.test.ts |
Tests native inputs and session loading. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
nikita-ashihmin
force-pushed
the
nikita.ashikhmin/fix-imported-attachments
branch
from
October 1, 2026 08:37
e559703 to
685005c
Compare
EugeneTheDev
pushed a commit
that referenced
this pull request
Oct 1, 2026
🤖 I have created a release *beep* *boop* --- ## [2.1.1](v2.1.0...v2.1.1) (2026-10-01) ### Bug Fixes * preserve attachments in imported session history ([#571](#571)) ([b9fc02b](b9fc02b)) * send the legacy custom answer key to AIR ([#577](#577)) ([56cc428](56cc428)) * show readable service error messages ([#572](#572)) ([4578615](4578615)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: acp-release-bot[bot] <246668977+acp-release-bot[bot]@users.noreply.github.com>
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.
Imported Codex Desktop messages contain a text envelope with attachment paths and the user request. History replay sends that envelope as one text block.
Restore known Desktop envelopes as ACP resource links and a separate request text block. Replay native local images, audio files, and file mentions as resource links. Preserve remote audio and other mentions as text links. Keep unknown envelopes and image file ID markers unchanged. Avoid duplicate file links when an envelope already contains the same file.
Tests cover every native input variant, multiple files, escaped titles, encoded paths, Windows paths, empty requests, malformed envelopes, and session loading.
The real Codex app server returned the reported session item through a read-only history call. Replaying that item produced one file resource link and one request text block. The original session was not resumed or changed.
Air maps replay resource links into its existing transcript attachment model. That client change is separate from this PR.
ACP v2 coverage is excluded because
maintemporarily reverted ACP v2 support.Validation after the rebase: 69 test files and 1040 tests pass. Six files and 33 tests are skipped. Type checking, the build, and all six executable bundles pass.
Tracking: IJAI-2943.