Skip to content

Download the files posted in a Ping or Campfire - #1070

Open
thehale wants to merge 1 commit into
mainfrom
ping-download
Open

thehale wants to merge 1 commit into
mainfrom
ping-download

Conversation

@thehale

@thehale thehale commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Written by @thehalebot

What

attachments list and attachments download now return the files posted in a Ping or a Campfire. A chat upload line (Chat::Lines::Upload) lists its files in an attachments array beside its content, each with a download_url, and the commands read that array as well as the <bc-attachment> tags in rich text. A Ping line URL (/circles/<ping>@<line>) and a Campfire line URL (/buckets/<p>/chats/<c>@<line>) both work.

Why

The CLI couldn't download a file someone posted in a Ping or a Campfire. An agent sent a screenshot or a screen recording in chat therefore couldn't pass it on, for example by attaching it to a bug card. With CLI 0.27.0, attachments download on such a line said "No downloadable attachments found", although the line lists the file with its download URL.

Card: https://app.basecamp.com/2914079/buckets/48521764/card_tables/cards/10563076254

Testing

  • A Ping line's file downloads. TestAttachmentsDownloadSavesPingLineFiles fails on main with the card's error and passes here.
  • A Campfire line's file downloads. TestAttachmentsDownloadSavesCampfireLineFiles does the same.
  • Other recording types are unchanged: only an upload line's attachments array is read, so a text line that carries one gains no attachments. TestAttachmentsListLeavesOutTextLineMetadata covers this.
  • Against a real Ping, both URL forms downloaded the posted PNG intact.
  • bin/ci passes

@thehale
thehale requested review from robzolkos and an adaptive review from Copilot December 1, 2026 18:21
@github-actions github-actions Bot added commands CLI command implementations tests Tests (unit and e2e) labels Dec 1, 2026
Copilot AI previously approved these changes Dec 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approved

No active review issues are reported for the Ping and Campfire attachment changes.

No open issues 🎉

What changed in this PR

Adds support for listing and downloading files posted in Pings and Campfires through the existing attachment commands, alongside rich-text attachments.

Changes:

  • Reads the attachment array on chat upload lines, using each file’s download URL.
  • Updates command help to describe Ping and Campfire support.
  • Adds download regression tests for both URL forms and verifies that text-line metadata is excluded.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
internal/​commands/​attachments.go Shares attachment extraction between list and download; updates help.
internal/​commands/​attachments_test.go Tests Ping and Campfire downloads and text-line exclusion.
internal/​commands/​attachments_lines.go Converts chat upload files into the existing attachment representation.

Review effort: Balanced (adaptive)

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files

Reply to a comment to ask cubic a question or push back. It learns from your replies.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread internal/commands/attachments_test.go Resolved
An agent sent a screenshot in a Ping can now save it, and pass it on by
attaching it to a card. The attachments commands read the files a chat
upload line lists beside its content.
Copilot AI adaptive review requested due to automatic review settings December 1, 2026 18:28
Copilot AI dismissed their stale review, a newer Copilot review was requested December 1, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approved

There are no active review issues blocking approval of the chat-attachment support changes.

No open issues 🎉

Review effort: Balanced (adaptive)

@thehale
thehale marked this pull request as ready for review December 1, 2026 18:35
@thehale
thehale requested a review from a team as a code owner December 1, 2026 18:35

@robzolkos robzolkos 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.

The approach is right. In bc3, app/views/api/chats/lines/_upload.json.jbuilder is the only chat line view that outputs attachments, so reading that array only for Chat::Lines::Upload matches the API exactly. Security looks fine too: the SDK sends the authenticated hop to the configured API host whatever host download_url names, and filenames are reduced to their base name and checked against the output directory. A few changes before this merges:

1. Reuse the SDK's type instead of lineFile. lineFile duplicates basecamp.CampfireLineAttachment. The item is decoded with UseNumber, so it re-marshals with an integer byte_size and unmarshals straight into the SDK struct (Filesize via strconv.FormatInt). Most of attachments_lines.go goes away.

2. The test fixture's byte_size is a string; the API sends an integer. The fixture has "byte_size": "9", but bc3 emits json.byte_size attachment.byte_size, an integer, as do the SDK's own fixtures. Please use 9. The json.Number field exists only to accept a shape the API never sends.

3. The unmarshal error is discarded, which can silently drop files. One malformed entry stops decoding partway through the array: the entries after it are lost and a zero-value entry is appended. For example, [ok, {"byte_size": ""}, ok] comes back as [ok, <empty>]. That's unlikely with the real API, but a file the person asked for shouldn't vanish without an error. Return the error, or decode each element separately and skip only the bad one.

4. Nit: attachments_test.go has no blank line before func TestAttachmentsDownloadSavesPingLineFiles.

5. Agents still can't find out how to download these files. The card's goal is an agent passing on a screenshot or recording someone posted in chat. Today basecamp chat output shows 📎 screenshot.png for an upload line, but nothing points to basecamp attachments download <line>. The skill's guidance in skills/basecamp/SKILL.md ("When a result reports content or description attachments, download and inspect them") doesn't cover these files either, since they're in neither field. Suggest:

  • a breadcrumb on upload lines in the chat line output that points to basecamp attachments download <line>, and
  • widening that skill line to cover files posted in Ping and Campfire lines (the skill drift check will hold the command reference to the real command).

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

commands CLI command implementations tests Tests (unit and e2e)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants