Skip to content

Conversation

@github-actions
Copy link
Contributor

Problem

The upload_assets.cjs script was not processing asset files uploaded via the safe-outputs MCP server, causing them to be saved to artifacts but never published to the orphaned git branch.

Root Cause

The script filters for both types of upload items:

  • upload_assets (plural - legacy type)
  • upload_asset (singular - modern MCP server type)

It correctly combines them into allUploadItems:

const uploadItems = result.items.filter(item => item.type === "upload_assets");
const uploadAssetItems = result.items.filter(item => item.type === "upload_asset");
const allUploadItems = [...uploadItems, ...uploadAssetItems];

However, the loops at lines 124 and 182 were still iterating over uploadAssetItems instead of allUploadItems:

for (const asset of uploadAssetItems) {  // ❌ Only processes legacy type

This meant that when AI agents used the modern MCP server tool (which creates upload_asset entries), the files would:

  1. ✅ Get uploaded to GitHub Actions artifacts
  2. ❌ Never get published to the orphaned git branch
  3. ❌ Never be accessible via raw.githubusercontent.com URLs

Solution

Changed both loops to iterate over allUploadItems instead of uploadAssetItems:

for (const asset of allUploadItems) {  // ✅ Processes both types

This ensures both legacy and modern upload types are processed correctly.

Testing

The existing test file pkg/workflow/js/upload_assets.test.cjs already uses the modern upload_asset type in its test cases, confirming this is the expected format.

Impact

Before: AI agents using the upload asset tool from safe-outputs MCP would see success messages but images would never be published to the git branch.

After: All uploaded assets are correctly published to the orphaned branch and accessible via raw.githubusercontent.com URLs.

Fixes #7290

AI generated by Q

The upload_assets.cjs script was filtering for both 'upload_assets' and
'upload_asset' types and combining them into allUploadItems, but then
only iterating over uploadAssetItems (the legacy singular type).

This caused files uploaded via the modern MCP server (which uses
'upload_asset' type) to be saved to artifacts but never published to
the orphaned git branch.

Fixed by changing both loops to iterate over allUploadItems instead of
uploadAssetItems, ensuring both legacy and modern upload types are
processed correctly.

Fixes #7290
@pelikhan pelikhan merged commit 4a6e53e into main Dec 22, 2025
4 checks passed
@pelikhan pelikhan deleted the q/fix-upload-assets-mcp-processing-7fe6012443a1ba46 branch December 22, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant