Skip to content

feat(api): add public run attachment upload - #252

Open
jojotaro1994 wants to merge 1 commit into
OpenBMB:mainfrom
jojotaro1994:codex/generic-run-attachments
Open

feat(api): add public run attachment upload#252
jojotaro1994 wants to merge 1 commit into
OpenBMB:mainfrom
jojotaro1994:codex/generic-run-attachments

Conversation

@jojotaro1994

Copy link
Copy Markdown

Summary

Adds a thin Public API wrapper around StaffDeck’s existing chat attachment staging and TaskFrame materialization flow.

  • Adds POST /agents/{agent_id}/attachments for multipart/form-data with repeated files[] fields.
  • Reuses the existing runs:create scope and returns ChatAttachmentRead[].
  • Keeps AgentRunCreate.attachments; new and streaming Runs share staged-attachment validation.
  • Verifies tenant, actor user, metadata, SHA-256, sandbox path, file count, and configured size before creating a job.
  • Reuses materialize_task_attachments() so each TaskFrame receives an isolated workspace copy.
  • Documents that follow-up Runs must resend the saved attachment descriptors; attachments are not automatically inherited by Session.

Configuration

CHAT_ATTACHMENT_MAX_BYTES controls the UI upload, Public API upload, and Run validation limit. The default is 12 MiB (12582912 bytes). This remains a finite limit because the current upload path reads the request into memory. Harness file tools and individual Skills may impose lower limits.

Scope

This PR intentionally does not add a database table or migration, new Attachment scope, remote URL fetch, query/delete endpoints, TTL cleanup, Session inheritance, or Plane/Bella-specific logic. Staging remains isolated by tenant, actor user, and attachment ID; formal staging lifecycle management is a known limitation.

Validation

  • Focused attachment, Public API, staging, chat attachment, and Harness tests: 131 passed.
  • Full backend suite: 2006 passed, 10 failed; the failures are existing environment/service issues: five General Skill runtime dependency tests fail because the generated macOS runtime is missing libpython3.11.dylib, and five tool-auth-matrix service tests fail against the local SQLite/service-auth fixture (human_handoff_requests table errors). No attachment-focused test failed.
  • git diff --check: passed.
  • Ruff on changed attachment implementation/tests (E,F,I): passed.
  • Full ruff check backend remains blocked by the upstream baseline (1987 existing findings).

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