Skip to content

fix(agent-toolkit): write a numeric assetId in finalize_asset_upload - #492

Open
marcin-polak-monday wants to merge 2 commits into
mondaycom:masterfrom
marcin-polak-monday:fix/finalize-asset-upload-numeric-asset-id
Open

marcin-polak-monday wants to merge 2 commits into
mondaycom:masterfrom
marcin-polak-monday:fix/finalize-asset-upload-numeric-asset-id

Conversation

@marcin-polak-monday

Copy link
Copy Markdown
Contributor

Monday.com item

https://monday.monday.com/boards/8297269624/pulses/12889382164

Summary

Guests could not open files uploaded to a file column through finalize_asset_upload, while members and admins could open the same files. The tool wrote the file column value with assetId: String(asset.id). The web uploader writes an integer. When a non-member guest opens a file on a board with permission rules, the monolith (AssetService.find_files_column_value_by_asset) scans the item's file column values with file["assetId"] == asset.id. Ruby does not coerce across types, so "3241543667" == 3241543667 is false, the asset is treated as not present in any visible column, and assets_by_ids returns an empty result. The UI then shows "File not found or deleted". Members and admins never reach that comparison because board.member? short-circuits first.

complete_upload.id is a GraphQL ID, which the API serializes as a string even though the underlying id is numeric. The tool now coerces it with Number() before writing assetId, and returns asset_id as a number as well. isImage is now sent too, matching the shape the web uploader writes, so image uploads render a thumbnail in the cell.

Reproduced end to end on a production scratch board: an upload through this tool stored "assetId":"3241543667" while every UI upload on the same board stored an integer. Full investigation is on the linked item.

Changes

  • finalize-asset-upload-tool.ts: assetId: Number(asset.id), asset_id: Number(asset.id), isImage derived from content_type, CompleteUploadMutation.id typed as string.
  • finalize-asset-upload-tool.test.ts: mock asset id is now a string so the coercion is exercised, plus tests for the numeric assetId and for isImage on image uploads.
  • CHANGELOG.md and package.json: 5.70.3.

Not changed

  • column_id is still not passed to complete_upload. Passing it makes assets-core attach the file itself when assets-core-asset-created-event-instead-of-frontend is on for the account, which would duplicate the entry this tool writes. Left for a follow-up once the tool can skip its own change_column_value in that case.
  • Files already uploaded with the string assetId are not repaired by this change. They need re-uploading, or a monolith-side tolerant comparison.

Testing

  • yarn jest finalize-asset-upload-tool: 6 passed.
  • eslint and prettier --check clean on both files.

🤖 Generated with Claude Code

marcin-polak-monday and others added 2 commits September 16, 2026 16:39
`finalize_asset_upload` wrote `assetId` into the file column as a string.
The monolith compares that value against the asset's numeric id when it
decides whether a file column grants a guest access to a file, and a
string never matches, so guests on boards with permission rules saw
"File not found or deleted" for every file uploaded through this tool.
Members and admins skip that check and were unaffected.

`complete_upload.id` is a GraphQL `ID`, serialized as a string, so coerce
it with `Number()` before writing `assetId` and when returning `asset_id`.
Send `isImage` as well so image uploads get a thumbnail in the cell, the
same shape the web uploader writes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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