Skip to content

feat(bots): download and send sandbox files as attachments - #604

Merged
nixuuu merged 1 commit into
feat/bot-sandbox-workspacefrom
feat/bot-download-attachments
Nov 13, 2026
Merged

nixuuu merged 1 commit into
feat/bot-sandbox-workspacefrom
feat/bot-download-attachments

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Bots can download public HTTP(S) files into their conversation workspace and send generated/downloaded files as ordinary Canopy attachments. download_file and send_attachment are gated by current Files permission, owner, worker, active turn and gateway approval policy. A new bot_outgoing_files_v1 capability prevents dispatch to older workers; protobuf extensions are additive and no migration is needed.

Downloads block private/loopback/link-local/metadata/reserved addresses after DNS and on every redirect, pin the checked literal IP and preserve HTTPS hostname verification. Limits: 50 MiB, five redirects, 60 seconds total, 10 seconds idle; Content-Length and streamed bytes are checked separately. No credentials, cookies, inherited proxy, execution or unpacking. Files is the download permission, independent of native Web access.

Outgoing transfers use bounded chunks and an immutable worker snapshot with SHA-256. Existing gateway attachment validation/storage, message, audit and durable tool result commit in the fenced/idempotent action. Replayed call IDs return the stored result; revoked Files and stopped/foreign turns cannot publish. Existing web/desktop/mobile APIs and attachment renderers provide download and supported previews. This repository has MCP connector accounts, but no automatic Telegram/Slack chat delivery adapters; external delivery needs its separately granted connector tool.

Fourth draft layer of stack #598. Do not merge separately.

Validation: authorized review-host checks passed: gen:check, typecheck, lint, format:check and web build. All download security tests passed (3 tests): SSRF private/reserved ranges, redirects, DNS pinning/rebinding, declared/streamed size, DNS/body timeouts and MIME. All gateway↔worker outgoing-file tests passed (6 tests): every provider, attachment retrieval, replay without duplicate delivery/audit, owner refusal through core/storage, completed turns, approval refusal, Files revocation and restarts. Local HTTP/inference fixtures only. The final UI layer was reviewed in one Chromium session at desktop/phone widths, light/dark, including actual Markdown/image previews and downloads.

Copy audit §8: errors name public-URL, size, timeout or permission failures with a recovery action. Tool descriptions distinguish downloading from sending and Canopy delivery from connector delivery. Prompt states files/web boundaries, retention and limits. No new UI controls in this layer; final-layer visual verification passed.

Related: #469, #581

@nixuuu
nixuuu added this pull request to stack #598 November 12, 2026 23:31
@nixuuu
nixuuu force-pushed the feat/bot-download-attachments branch 3 times, most recently from 84beb21 to e4d0ef7 Compare November 12, 2026 23:40
@nixuuu
nixuuu force-pushed the feat/bot-download-attachments branch from e4d0ef7 to c74ac57 Compare November 12, 2026 23:49
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 00:13
@nixuuu
nixuuu merged commit 18e7c9d into dev Nov 13, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/bot-download-attachments branch November 13, 2026 00:15
nixuuu added a commit that referenced this pull request Nov 18, 2026
nixuuu added a commit that referenced this pull request Nov 18, 2026
## Changes

- Send a fixed Canopy-Bot User-Agent on public bot downloads, including
redirects. GitHub REST accepts the same anonymous Releases request that
previously returned HTTP 403.
- Let private bot turns and routines with Web access verify the earliest
indexed publication of up to 50 Canopy PRs across Nightly, Beta, and
Stable. The gateway reuses the public changelog index and returns only
matching versions, dates, and source links. This keeps large release
bodies outside conversation files and requires no GitHub credential.

## Verification

- Focused worker download tests and gateway typecheck.
- Real anonymous GitHub Releases download and read through the worker
file implementation. Live index lookup for a PR published to all three
channels.
- Tests for duplicate PRs, missing matches, and publication ordering.
The standalone gateway policy test hits an import-cycle failure on both
the branch and clean dev. Required CI covers the combined test suite and
builds.

Fixes: #604
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.

1 participant