Skip to content

fix: preserve attachments in imported session history - #571

Merged
nikita-ashihmin merged 2 commits into
mainfrom
nikita.ashikhmin/fix-imported-attachments
Oct 1, 2026
Merged

nikita-ashihmin merged 2 commits into
mainfrom
nikita.ashikhmin/fix-imported-attachments

Conversation

@nikita-ashihmin

@nikita-ashihmin nikita-ashihmin commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

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 main temporarily 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.

@nikita-ashihmin nikita-ashihmin changed the title fix: restore Desktop attachments in imported session history fix: preserve attachments in imported session history Sep 30, 2026
@nikita-ashihmin
nikita-ashihmin requested a balanced review from Copilot October 1, 2026 08:25

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 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
nikita-ashihmin force-pushed the nikita.ashikhmin/fix-imported-attachments branch from e559703 to 685005c Compare October 1, 2026 08:37
@nikita-ashihmin
nikita-ashihmin merged commit b9fc02b into main Oct 1, 2026
6 of 7 checks passed
@nikita-ashihmin
nikita-ashihmin deleted the nikita.ashikhmin/fix-imported-attachments branch October 1, 2026 08:45
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>
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