Skip to content

fix(app): fix trace copy to include user input + add session-level Export trace - #282

Merged
jeonghun-jj-lee merged 3 commits into
local/amicodefrom
fix-trace-copy
Sep 2, 2026
Merged

fix(app): fix trace copy to include user input + add session-level Export trace#282
jeonghun-jj-lee merged 3 commits into
local/amicodefrom
fix-trace-copy

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Summary

Fixes the per-turn "Copy trace" button to include the user's input (prefixed with You: ) and adds a session-level "Export trace" menu item to the three-dot menu.

Changes

Core: buildTrace + buildSessionTrace

  • Extended buildTrace to accept an optional userText parameter — when provided and non-empty, prepends You: <text> before the assistant trace
  • Added buildSessionTrace that walks all session messages in order, grouping user→assistant turns with You: prefixes
  • Backward compatible: callers that pass no userText produce identical output

Per-turn copy fix

  • V2 timeline (message-timeline.tsx): copyTraceForTurn now extracts user text from the user message's parts and passes it to buildTrace
  • session-ui (message-part.tsx): Threaded userText prop through AssistantPartsTurnFooterhandleCopyTrace

Session-level Export trace (WIP)

  • "Export trace" menu item in both DropdownMenu and MenuV2 layouts — coming next

Tests

  • 13 new tests in build-trace.test.ts covering userText prepend, empty/whitespace handling, backward compat, buildSessionTrace with multiple turns, edge cases (no messages, no assistant response, no text part, synthetic parts, multiple assistant messages per turn)

Closes #278

- Add optional userText parameter to buildTrace, prepended as 'You: ...'
- Add buildSessionTrace for full-session trace export
- Fix copyTraceForTurn in message-timeline.tsx to include user input
- Thread userText prop through AssistantParts → TurnFooter in session-ui
- Add 13 new tests covering userText and buildSessionTrace

Closes #278
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: ff8e148d-9927-42fd-a39a-a365d50960ff


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

- Add 'Export trace' item to both DropdownMenu and MenuV2 layouts,
  positioned after Share and before Archive
- Desktop: saveFilePickerDialog with content write-through via
  extended save-file-picker IPC handler (no new bridge channel)
- Web/webview: <a download> fallback with Blob URL
- Default filename: trace-<session-title-slug>-<date>.md
- Add session.exportTrace i18n key
- Extend SaveFilePickerOptions with optional content field
@jeonghun-jj-lee
jeonghun-jj-lee marked this pull request as ready for review September 2, 2026 18:33
The flat slice(start+1).filter(assistant) collected assistant messages
from ALL subsequent turns, not just the current one. Use parentID to
match only assistant messages belonging to the clicked turn, consistent
with session-turn.tsx's assistantMessages memo.
@jeonghun-jj-lee
jeonghun-jj-lee merged commit d5123f6 into local/amicode Sep 2, 2026
3 checks passed
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.

fix(app): fix trace copy to include user input + add session-level Export trace

1 participant