Skip to content

Preserve mapped createdByAgent during WorkBench upload#7931

Open
foozleface wants to merge 1 commit intospecify:mainfrom
calacademy-research:fix-7840
Open

Preserve mapped createdByAgent during WorkBench upload#7931
foozleface wants to merge 1 commit intospecify:mainfrom
calacademy-research:fix-7840

Conversation

@foozleface
Copy link
Copy Markdown
Collaborator

Fixes #7840
Contributed by @foozleface

When users explicitly map the createdByAgent field in WorkBench, the uploader overwrites it with the uploading user's agent instead of respecting the mapped value.

Implementation

  • Add a check in upload_table.py that only auto-sets createdbyagent_id to the uploading user's agent when createdbyagent has not already been mapped as a to-one relationship in the upload plan
  • The one-line change adds and "createdbyagent" not in to_one_ids to the existing conditional, so explicitly mapped values take precedence

Testing instructions

  • Create a WorkBench dataset that includes a createdByAgent column mapped to a valid agent
  • Upload the dataset and verify the records are created with the mapped agent as createdByAgent, not the uploading user's agent
  • Verify that datasets without createdByAgent mapped still default to the uploading user's agent as before

Copy link
Copy Markdown
Member

@grantfitzsimmons grantfitzsimmons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing instructions

  • Create a WorkBench dataset that includes a createdByAgent column mapped to a valid agent
  • Upload the dataset and verify the records are created with the mapped agent as createdByAgent, not the uploading user's agent
  • Verify that datasets without createdByAgent mapped still default to the uploading user's agent as before
Image Image Image

Left (fix-7840), Right (v7.12.0-prerelease)
Image

Works as expected!

@grantfitzsimmons grantfitzsimmons requested review from a team April 10, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋Back Log

Development

Successfully merging this pull request may close these issues.

WorkBench Overrides CreatedByAgent with Current User

2 participants