Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web,mobile): show Copy and Fork actions on kept final_answer replies #42089

Openzs-andy(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/42089/headopened View on GitHub

Fixes #42052

Problem

When a run keeps an earlier assistant reply visible alongside a later reply in the same run (for example a final_answer reply before a steer or wake), only the run's last assistant message gets showAssistantMeta. The kept earlier reply renders with no Copy/Fork/Reply/timestamp row even on hover, so clicking Copy under the turn copies only the final steer reply.

Change

  • Web (apps/web/src/components/chat/MessagesTimeline.logic.ts):
    • Enable showAssistantMeta (and showAssistantCopyButton) for kept replies in retainedAssistantReplyIds in addition to terminalAssistantMessageIds, once the run is no longer active and the message is not streaming.
    • Keep attachTrailingToolGroupsToAssistant scoped to terminalAssistantMessageIds so intervening work rows in an expanded run do not detach an earlier kept reply's meta row.
    • Guard attachCreatedThreadSummaries with index === terminalIndexes.get(row.message.runId) so a run's summary:* resource cards attach once after the terminal reply instead of duplicating after earlier kept replies.
  • Mobile (apps/mobile/src/lib/threadActivity.ts, apps/mobile/src/features/threads/ThreadFeed.tsx):
    • Extract deriveAssistantMetaMessageIds(feed) combining each run's terminal assistant message with finalAnswerIds(feed), and use it for both showAssistantMeta and LegendList getItemType.

Verification

  • Added failing assertions first (verified failing on main) in MessagesTimeline.logic.test.ts and apps/mobile/src/lib/threadActivity.test.ts, then verified all 187 unit tests pass:
    • vp test run apps/web/src/components/chat/MessagesTimeline.logic.test.ts apps/web/src/components/chat/MessagesTimeline.active-tools.test.ts apps/mobile/src/lib/threadActivity.test.ts
  • vp fmt --check and vp lint --report-unused-disable-directives on all changed files (0 warnings, 0 errors).
  • vp run --filter @t3tools/web --filter @t3tools/mobile typecheck (2/2 passed).
  • knip --workspace apps/web --exports (0 issues).
    1. Pushed3f21e14

    2. Pushed45e8e39

    3. Pushede860896

    4. Pushed09c608c

Sign in to join this conversation.