Skip to content

[excursion] Deduplicate persisted attachment IDs - #23394

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
codex-x/edge-cases/huge-paste
Oct 21, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
codex-x/edge-cases/huge-paste

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Codex excursion, unverified.

Summary

Persisted chat attachments now collapse duplicate attachment IDs by keeping the latest chip. Previously, duplicate IDs wrote multiple files but retained duplicate list entries pointing at the final file, so reopening a draft duplicated content and orphaned the earlier file.

Validation

  • git diff --check
  • Added ChatDraftAttachmentsTests.duplicateAttachmentIdsKeepOnlyTheLatestChip.
  • Swift tests and macOS app builds were not run locally; use the fleet compile-check.

No capture: persistence-only change.

Agent session: cosmic-gray


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Persisted chat attachments now collapse duplicate attachment IDs by keeping the latest chip. Previously, duplicate IDs wrote multiple files but left duplicate list entries pointing at the final file, so reopening a draft duplicated content and orphaned the earlier file.

The deduplication treats the latest entry as authoritative, matching the composer's current list semantics. Added ChatDraftAttachmentsTests.duplicateAttachmentIdsKeepOnlyTheLatestChip to cover the behavior.

Written for commit 94ca9ad. Summary will update on new commits.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 94ca9ad: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23394 -f ref=codex-x/edge-cases/huge-paste -f platform=macos -f backend_mode=local

Not verified: macOS jobs did not run: compile and app tests were skipped on 94ca9adc7f; ci-status is green without them.

CI passes on 94ca9adc7f (run 39602529249 attempt 1).
macOS jobs did not run: compile and app tests were skipped: Fast static checks skipped (the macos job needs both to succeed). Re-run CI once they pass, before merging.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-9mq8r created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (excursion-verifier subagent, correctness first): SHIP at 94ca9ad

  • moveOut keeps the last chip per id in original order; nonisolated, pure locals; both callers (draft write, relaunch save) only read files/bytes/attachments, no count or index reliance.
  • Test goes keep -> write -> moveOut -> readBack; without the fix kept ids would be ["same","same"], both with chip 2 bytes, so it fails. Helpers and Chip init match; keep is @discardableResult.
  • Note: byte-carrying chips get crypto.randomUUID and wake/kept-read/attach already dedupe by id, so this is defensive. The one live duplicate source is link chips (link:<path>) appended without dedupe in composer/attachmentIntake.tsx:80; worth a source fix. The comment's "first file orphaned" overstates it: both callers sweep unnamed files.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by claude-sr2-1 on cosmic-gray · session

@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@teamleaderleo
teamleaderleo merged commit 0b1a93e into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the codex-x/edge-cases/huge-paste branch October 21, 2026 12:52
teamleaderleo added a commit that referenced this pull request Oct 21, 2026
…chmentsTests) (#23436)

0b1a93e (#23394) passed `Data.init(base64Encoded:)` as a function reference, which
does not resolve (the initializer has a defaulted options parameter), so the CmuxNext test
package does not build on feat-cmux-next. Use the closure the file's other checks use.


Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15cfb-0392-7f93-b611-98366b6dc130&host=cosmic-gray

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant