Skip to content

fix(frontend): deduplicate initial prompt in chat export#1321

Merged
jeremyeder merged 1 commit intomainfrom
ambient/fix-export-chat-duplicate-prompt-1320
Apr 16, 2026
Merged

fix(frontend): deduplicate initial prompt in chat export#1321
jeremyeder merged 1 commit intomainfrom
ambient/fix-export-chat-duplicate-prompt-1320

Conversation

@ambient-code
Copy link
Copy Markdown
Contributor

@ambient-code ambient-code bot commented Apr 15, 2026

Summary

  • Fixes the initial user prompt appearing 3x in exported chats ([Amber] initial user prompt repeated 3x #1320). The prompt was included twice from the MESSAGES_SNAPSHOT (once from input_data.messages, once from the echoed run message) and then unconditionally prepended by the export utility.
  • Replaces the blind blocks.unshift() with deduplication logic that ensures the initial prompt appears exactly once — prepending only if absent, and removing duplicates if the snapshot contains multiples.
  • Adds two new test cases covering the single-copy and multi-copy deduplication scenarios.

Test plan

  • All 61 existing export-chat tests pass
  • New test: snapshot already contains initial prompt once → no duplicate added
  • New test: snapshot contains initial prompt twice → deduplicated to one
  • Manual: export a completed session chat and verify the initial prompt appears only once

🤖 Ambient Session

The export chat feature repeated the initial user prompt 3 times because
it was included from input_data.messages in the MESSAGES_SNAPSHOT, echoed
again in run_messages, and then unconditionally prepended by the export
utility. Replace the blind unshift with deduplication logic that ensures
the initial prompt appears exactly once.

Closes #1320

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ambient-code ambient-code bot added the ambient-code:managed PR managed by AI automation label Apr 15, 2026
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 15, 2026

Deploy Preview for cheerful-kitten-f556a0 canceled.

Name Link
🔨 Latest commit 3462a2e
🔍 Latest deploy log https://app.netlify.com/projects/cheerful-kitten-f556a0/deploys/69dffd8214ee6300085e09ee

@jeremyeder jeremyeder merged commit 134a9f1 into main Apr 16, 2026
60 checks passed
@jeremyeder jeremyeder deleted the ambient/fix-export-chat-duplicate-prompt-1320 branch April 16, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ambient-code:managed PR managed by AI automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant