Skip to content

fix(safe-outputs): add file staging to upload-workitem-attachment #381

@jamesadevine

Description

@jamesadevine

Problem

upload-workitem-attachment does not stage files during Stage 1 (MCP). The executor reads directly from source_directory at Stage 3, but the sandbox workspace may no longer be accessible by then. This is inconsistent with the staging pattern used by upload-build-artifact and create-pull-request.

Proposed Fix

  1. Add file staging in the MCP handler: copy the file to output_directory with a generated filename (matching the pattern in upload-build-artifact)
  2. Add staged_file, file_size, and staged_sha256 fields to UploadWorkitemAttachmentResult
  3. Update the executor to read from ctx.working_directory.join(staged_file) instead of ctx.source_directory.join(file_path)
  4. Add SHA-256 cross-stage integrity verification (matching upload-build-artifact)
  5. Add a Stage 1 size cap using the default max file size

See PR #380 for the staging pattern reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions