Skip to content

feat: show each turn's attachments in the chat action bar - #31145

Merged
ibetitsmike merged 9 commits into
mainfrom
mike/turn-attachments-pill
Oct 29, 2026
Merged

ibetitsmike merged 9 commits into
mainfrom
mike/turn-attachments-pill

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Files an agent attaches during a turn are easy to lose: they render between the turn's steps or fold into the "Worked for ..." block, and the Summary panel lists every attachment in the chat.

Each turn in which the agent attached files now gets an Attachments pill under its last assistant message, or under its collapsed working block when the turn ended without an answer, and keeps it as newer turns arrive. The pill shows up to three thumbnails and a "+N" count, and opens a popover that lists the turn's agent files (user uploads are left out). The popover uses the Summary panel's MessageAttachmentCard, so its cards view and download files the same way. A file that the timeline knows has expired keeps its name in an expired card, and the popover then explains why files expire. When viewing a stored text file from the popover finds it deleted, the rest of the timeline treats it as expired too. A thumbnail that fails to load shows a file icon instead. The pill uses the composer pills' colors.

Copy now shows at all times instead of on hover, and assistant messages in the middle of a turn that end in text get it too. A prompt's Edit and jump buttons still appear on hover, before Copy. An answer's row ends with the pill, after Copy.

The newest turn's pill appears once the chat stops, because a stop hook or a client tool result can continue a running turn. An answered turn keeps its pill while a compaction streams or after a context clear. A turn without an answer gets its pill only once the chat stops, because chatd can resume that turn after the compaction.

The File attachments section of the Coder Agents docs now describes both lists of the agent's files: the pill at the end of a turn and the Summary tab's Attachments section.

Left out to keep this PR small, as follow-ups: keeping the pill while a run that this client started on an idle chat begins, and holding back the pill of a turn whose prompt is on an unloaded page.

Screenshots

These screenshots predate the switch to the Summary panel's cards, so the card layout in the popover can differ slightly. Storybook has the current states in pages/AgentsPage/ChatConversation/ConversationTimeline/WorkingBlocks, in the stories whose names start with "Turn Attachments Pill".

Two turns, each with its pill, and Copy on every message. The newest turn's popover shows image thumbnails, "View file" for the images and the Markdown file, and a download card for the PDF.

Two turns with Attachments pills and Copy buttons; the newest turn's popover lists two images with thumbnails and View file, findings.md with View file, and spec.pdf with Download file

"View file" on the Markdown card opens its preview over the popover.

The findings.md preview, with its Markdown rendered, open over the popover

Xum, an AI agent, opened this PR for @ibetitsmike and wrote this description.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T22:52:09.642828Z 9640324 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f1a908ec60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c35dfe1f66

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 65d6b668e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

1 similar comment
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 407a6f49d1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 089c448eb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eb0ab923fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a54ba451d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdbdddb782

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 09209efd59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@ibetitsmike ibetitsmike changed the title feat(site/src/pages/AgentsPage/components): add a per-turn attachments pill to the chat action bar feat(site/src/pages/AgentsPage): add a per-turn attachments pill to the chat action bar Oct 22, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: f24bedbca5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: f56082b3e0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 0b5032bf52

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Xum posted this comment on behalf of @ibetitsmike.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d4be6192a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8bdd19acd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

Xum, an AI agent, replied for @ibetitsmike.

@codex review

Please review head 0843774.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 084377451c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was performed by ai-review, an automated review bot.

3 inline findings and 1 below.

whole PR

SCOPE-1: This PR changes 1497 lines in 16 files (limit 1000). Split it into smaller PRs.

Remedy: split

Coverage
Coverage: 16 of 17 files reviewed, 1 unsupported; 13 rules.
Candidates: 39 found, 33 outside changed lines, 0 already discussed, 6 evaluated.
Findings: 4 (6 sites, 3 pre-existing sites), 0 over budget, 0 failed.

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs LGTM

@nickvigilante nickvigilante left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs LGTM, and I'm approving provided you're doing an engineer review on this 👍

@ibetitsmike
ibetitsmike force-pushed the mike/turn-attachments-pill branch from f800dc6 to 9640324 Compare October 27, 2026 22:48
@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review head 9640324, which rebases this PR onto main and adapts the turn attachments pill to the new working block slices from #30656.

Xum, an AI agent, posted this for @ibetitsmike.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 96403248ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@DanielleMaywood DanielleMaywood left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was performed by ai-review, an automated review bot.

4 inline findings.

Coverage
Coverage: 16 of 17 files reviewed, 1 unsupported; 22 rules.
Candidates: 237 found, 190 outside changed lines, 0 already discussed, 47 evaluated.
Findings: 5 (17 sites, 2 pre-existing sites), 0 over budget, 0 failed.
Model: deepseek/deepseek-v4.1-flash; 44 questions, 42 answered, 2 abstained (truncated 2), 40 cached; 0 uncalibrated findings held back; 4335 input and 1704 output tokens.

@mafredri

Copy link
Copy Markdown
Member

FYI: on main, the transcript can show a file the agent just stored as expired. When a queued message lands right after the agent's turn, deriveEvictedFileIds compares against a chat.files snapshot fetched before the agent stored the file. TurnAttachments reads hasExpired from the same FileProbeProvider, so this PR's pill would mark that turn's files expired until the chat refetches. This PR doesn't cause it; it's tracked in CODAGT-1489.

🤖 This review was automatically generated with Coder Agents.

@ibetitsmike

Copy link
Copy Markdown
Collaborator Author

@mafredri Thanks, confirmed. The pill's thumbnails, cards, and expired note all read hasExpired from the timeline's FileProbeProvider, which deriveEvictedFileIds feeds, so they share this false positive. A fix in deriveEvictedFileIds or in how chat.files refreshes will cover the pill too. I'm leaving it to CODAGT-1489, since the bug is on main.

Xum, an AI agent, replied for @ibetitsmike.

…e message action flags and flatten block pill lookup

- Gate the edit and jump buttons on canEditUserMessage and
  canJumpBetweenUserMessages instead of re-deriving them in JSX.
- Split getBlockTurnAttachments' condition into an early continue.
- Type children explicitly instead of React.PropsWithChildren.
- Name the running-chat test options mockRunningChat.
Comment on lines +143 to +146
The agent can also attach files to its messages (for example, with the `attach_file` tool).
After a turn ends, an **Attachments** button at the end of the turn opens a list of the files the agent attached during it.
The **Attachments** section of the chat's **Summary** tab lists the files the agent attached across the chat.
In either list, you can download the files, and open PNG, JPEG, GIF, and WebP images and plain text, Markdown, CSV, and JSON files in the chat.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep it. The docs guidelines ask for a user-facing feature's docs in the same PR ("Documentation lands with the change" in docs/.style/content-guidelines.md), and the File attachments section only covered uploads, so nothing described the pill. nickvigilante approved the wording. If you'd rather it say less, I can cut it down to the pill alone.

Xum, an AI agent, replied for @ibetitsmike.

…t message actions by role and simplify turn pill logic

- Move the action bar into UserMessageActions and AssistantMessageActions;
  the assistant bar renders the spacer when it has no buttons.
- Restore hasExpired to take a string; new callers check file_id first, as
  AttachmentBlocks does.
- Write getMessageFileAttachments with an if instead of a ternary.
- Rewrite getTurnAttachmentsByRow as plain per-turn steps and name the slice
  check in getBlockTurnAttachments.
- Test that a hook notice after the answer leaves the pill on the answer.
… a restating comment and spell out canHostPill

- Delete the UserMessageActions JSDoc, which restated its classes.
- Say what keepsSpacing renders when there are no buttons.
- Give each canHostPill exclusion its own early return.
… message actions next to the action bar

- Move UserMessageActions and AssistantMessageActions into
  MessageActionBar.tsx, which keeps ConversationTimeline.tsx shorter than
  on main, and make MessageActionButton private to that file.
- Spell out onEditUserMessage's signature, as the other props types do.
- Give AssistantMessageActions one branch for a message without buttons.
- Drop the splitIntoTurns and canHostPill comments, which restated the
  code, and stop claiming in hasNewestTurnEnded that chatd never resumes
  an answered turn: a post_compact hook can.
…ing block in the block pill comment

The block shows the pill below itself whether it is collapsed or expanded.
… the message actions module for its components

- Rename MessageActionBar.tsx to MessageActions.tsx, since it now holds
  the user and assistant message actions too.
- Say in the components' docs what their names do not: which buttons show
  on hover, and when AssistantMessageActions renders a spacer.
- Say working blocks, not collapsed ones, in the MessageActionBar doc.
…y the spacer rule in the AssistantMessageActions doc
@ibetitsmike
ibetitsmike merged commit 94b3c41 into main Oct 29, 2026
31 checks passed
@ibetitsmike
ibetitsmike deleted the mike/turn-attachments-pill branch October 29, 2026 16:12
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants