Skip to content

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

Open
zs-andy wants to merge 3 commits into
pingdotgg:mainfrom
zs-andy:fix/retained-final-answer-meta-row
Open

zs-andy wants to merge 3 commits into
pingdotgg:mainfrom
zs-andy:fix/retained-final-answer-meta-row

Conversation

@zs-andy

@zs-andy zs-andy commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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).

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 24, 2026
@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The mobile feed now derives assistant metadata IDs from final-answer messages and each run’s last assistant message. The web timeline shows metadata for qualifying retained replies and limits trailing tool-group attachment and created-thread summaries to terminal assistant rows.

Changes: Assistant reply metadata

Layer / File(s) Summary
Derive and render mobile assistant metadata
apps/mobile/src/lib/threadActivity.ts, apps/mobile/src/lib/threadActivity.test.ts, apps/mobile/src/features/threads/ThreadFeed.tsx
A new helper identifies final-answer messages and each run’s last assistant message. The mobile feed uses the resulting IDs for assistant metadata and progress-row decisions. Tests check the helper’s results for the covered phases.
Render metadata for retained web replies
apps/web/src/components/chat/MessagesTimeline.logic.ts, apps/web/src/components/chat/MessagesTimeline.logic.test.ts
The timeline shows metadata for terminal messages or retained assistant replies, except while a response is active or streaming. Trailing tool-group attachment and created-thread summaries are limited to terminal assistant rows. Tests cover superseded replies and retained final answers.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: juliusmarminge, shivamhwp

Merge Risk: Minimal · up to 3f21e

Kept earlier replies now get their own Copy and Fork actions on web and mobile, as the linked issue requested. No concrete defect remains after review, and the change is a low-risk UI change that is easy to revert.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two areas (web and mobile) and the main change, which is showing Copy and Fork actions on kept final_answer replies. It is a conventional commit title in plain language and matches…
Description check Passed The description follows the template. It has Problem, Change, Scope (links issue #42052 via 'Fixes #42052'), and Verification sections. The problem and change are clear and specific, covering web and …
Linked Issues check Passed Direct issue #42052 requires that a kept final_answer reply has its own Copy/Fork row, not only the run's last assistant message. The PR summary and raw change summary at the reviewed head state that …
Out of Scope Changes check Passed All described changes map to the linked objective. The web changes in MessagesTimeline.logic.ts and its tests enable the Copy/Fork row for kept replies. The scoping of attachTrailingToolGroupsToAssist…
Full details: Title check

Explanation

The title names the two areas (web and mobile) and the main change, which is showing Copy and Fork actions on kept final_answer replies. It is a conventional commit title in plain language and matches the changeset (MessagesTimeline.logic.ts and deriveAssistantMetaMessageIds in threadActivity.ts/ThreadFeed.tsx), which enables assistant meta for retained final_answer replies. The title is 72 characters, within normal length guidance.

Full details: Description check

Explanation

The description follows the template. It has Problem, Change, Scope (links issue #42052 via 'Fixes #42052'), and Verification sections. The problem and change are clear and specific, covering web and mobile. Verification lists focused test commands, results, typecheck, lint, and knip output. The template asks for before/after screenshots for UI changes. The description has none, and it does not state what could not be checked. The Scope section also does not explain beyond the issue link. Also, the template asks for the model and harness if an agent was used, and the description does not say whether one was used. These gaps are minor, so the check passes.

Resolution

Consider adding before/after screenshots or a short recording of the Copy/Fork row on a kept reply, since the template asks for them for UI changes. Also state whether an agent produced the change and, if so, name the model and harness.

Full details: Linked Issues check

Explanation

Direct issue #42052 requires that a kept final_answer reply has its own Copy/Fork row, not only the run's last assistant message. The PR summary and raw change summary at the reviewed head state that MessagesTimeline.logic.ts now enables showAssistantMeta and showAssistantCopyButton for retainedAssistantReplyIds, in addition to terminalAssistantMessageIds, once the run is inactive and the message is not streaming. This covers the steer-during-answer case in the issue. The mobile change adds deriveAssistantMetaMessageIds(feed) in apps/mobile/src/lib/threadActivity.ts, combining each run's terminal assistant message with finalAnswerIds(feed). ThreadFeed.tsx uses that set for showAssistantMeta and for LegendList getItemType, which covers the mobile gate named in the issue. Tests were added in MessagesTimeline.logic.test.ts and threadActivity.test.ts for these cases. Limit: all repository diff reads failed because changed blobs are missing from the checkout, and a file read of MessagesTimeline.logic.ts at head was truncated before the changed lines. The verdict therefore relies on the PR description and change summary, which are consistent with each other and with the issue. The test results were not re-run.

Full details: Out of Scope Changes check

Explanation

All described changes map to the linked objective. The web changes in MessagesTimeline.logic.ts and its tests enable the Copy/Fork row for kept replies. The scoping of attachTrailingToolGroupsToAssistant to terminalAssistantMessageIds and the index guard on attachCreatedThreadSummaries prevent work rows from detaching the kept reply's meta row and prevent summary:* cards from duplicating. These are direct side effects of the same feature. The mobile changes in threadActivity.ts, threadActivity.test.ts, and ThreadFeed.tsx apply the same metadata gate on mobile. The change summary describes no unrelated feature, refactor, or documentation change. Limit: the diff could not be read directly, so this verdict relies on the PR description and change summary.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c839b26 and 3f21e14.

Files selected for processing: 5

  • apps/mobile/src/features/threads/ThreadFeed.tsx
  • apps/mobile/src/lib/threadActivity.test.ts
  • apps/mobile/src/lib/threadActivity.ts
  • apps/web/src/components/chat/MessagesTimeline.logic.test.ts
  • apps/web/src/components/chat/MessagesTimeline.logic.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 24, 2026
…swer-meta-row

# Conflicts:
#	apps/mobile/src/features/threads/ThreadFeed.tsx

This branch has not been deployed

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

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: A kept final_answer reply has no Copy/Fork row; only the run's last message does

2 participants