discord_response: add oversized-output file attachment with allowlist, size cap, and bot upload path (delta from #234) #273

Closed
opened 2026-08-12 10:28:15 +00:00 by Mark · 0 comments
Owner

Phase-4 attachment handling landed partially in 5a1d111 (runtime/discord_response.py: DiscordFileAttachment dataclass, ResponsePart.files, sources.md/article.md attachments). Delta from #234 — acceptance for kanban t_92cebcc4 (file attachment handling for long outputs) not met:

  1. No oversized-output detection: formatter never decides "long output -> file instead of inline text". A 2000-line chat log produces 43 chunked text parts, zero attachments. Need configurable threshold (logs > N chars) + extension allowlist (logs/reports/csv/json/code).
  2. Bot layer never uploads files: docker/discord_bot.py has no reference to the formatter or ResponsePart.files; send() accepts text+embed only. DiscordFileAttachment objects are produced but never attached to a channel.
  3. No size cap: a 20MB article attaches as one 20MB file. Need configurable cap (default 8 MB per Discord limit) with fallback to multiple attachments or paste service for larger.
  4. No summary message referencing the attachment (card requires short summary + attachment reference).
  5. No tests for acceptance: oversized-log-triggers-file, cap-enforced, allowlist, summary-message, short-text-stays-inline.
    Existing: 13 tests pass, ruff clean. Verify with pytest tests/unit/test_discord_response.py + ruff check on runtime/discord_response.py.
Phase-4 attachment handling landed partially in 5a1d111 (runtime/discord_response.py: DiscordFileAttachment dataclass, ResponsePart.files, sources.md/article.md attachments). Delta from #234 — acceptance for kanban t_92cebcc4 (file attachment handling for long outputs) not met: 1. No oversized-output detection: formatter never decides "long output -> file instead of inline text". A 2000-line chat log produces 43 chunked text parts, zero attachments. Need configurable threshold (logs > N chars) + extension allowlist (logs/reports/csv/json/code). 2. Bot layer never uploads files: docker/discord_bot.py has no reference to the formatter or ResponsePart.files; send() accepts text+embed only. DiscordFileAttachment objects are produced but never attached to a channel. 3. No size cap: a 20MB article attaches as one 20MB file. Need configurable cap (default 8 MB per Discord limit) with fallback to multiple attachments or paste service for larger. 4. No summary message referencing the attachment (card requires short summary + attachment reference). 5. No tests for acceptance: oversized-log-triggers-file, cap-enforced, allowlist, summary-message, short-text-stays-inline. Existing: 13 tests pass, ruff clean. Verify with pytest tests/unit/test_discord_response.py + ruff check on runtime/discord_response.py.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#273
No description provided.