Skip to content

fix(sessions): dedupe cloud prompt echo when attachments add a summary#3100

Merged
tatoalo merged 2 commits into
mainfrom
fix/code/cloud-task-attachment-prompt-dedupe
Jul 2, 2026
Merged

fix(sessions): dedupe cloud prompt echo when attachments add a summary#3100
tatoalo merged 2 commits into
mainfrom
fix/code/cloud-task-attachment-prompt-dedupe

Conversation

@tatoalo

@tatoalo tatoalo commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Problem

Creating a cloud task with an attachment rendered the user's prompt twice. The pinned optimistic bubble is seeded from the task description, which appends an Attached files: <names> line, while the echoed session/prompt carries attachments as resource_link blocks with no such line — so the text-based dedupe in mergeConversationItems never matched and both bubbles rendered.

Changes

  • Add stripTrailingAttachmentSummary to @posthog/core/editor/cloud-prompt and fold it into the dedupe key in mergeConversationItems, so the description-seeded placeholder matches its echo.
  • Carry the echoed prompt's attachments onto the pinned bubble when upgrading it, so the file chip replaces the literal summary line.
  • Each pinned placeholder now consumes at most one matching echo, so a later follow-up repeating the same text still renders.
  • Unit tests for the attachment, attachment-only, and repeated-text cases; verified end-to-end over CDP (fresh task with pasted image, real resume, cold reload).

@trunk-io

trunk-io Bot commented Jul 2, 2026

Copy link
Copy Markdown

😎 Merged manually by @tatoalo - details.

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 4dd4957.

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(sessions): dedupe cloud prompt echo ..." | Re-trigger Greptile

Comment thread packages/core/src/editor/cloud-prompt.test.ts Outdated
Comment thread packages/core/src/editor/cloud-prompt.ts Outdated
@tatoalo tatoalo self-assigned this Jul 2, 2026
@tatoalo tatoalo added the Stamphog This will request an autostamp by stamphog on small changes label Jul 2, 2026
@tatoalo tatoalo marked this pull request as ready for review July 2, 2026 17:09

@github-actions github-actions Bot 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.

Targeted bug fix for cloud prompt deduplication — extracts a shared constant and stripping function, adjusts the merge logic to handle attachment summaries, and propagates echoed attachments onto the pinned bubble. Import direction is correct, all review comments were addressed, and test coverage follows conventions.

@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "refactor(sessions): share attachment sum..." | Re-trigger Greptile

@tatoalo tatoalo merged commit 68f1ef6 into main Jul 2, 2026
30 of 31 checks passed
@tatoalo tatoalo deleted the fix/code/cloud-task-attachment-prompt-dedupe branch July 2, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Stamphog This will request an autostamp by stamphog on small changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant