Skip to content

Conversation

ddl-rliu
Copy link
Contributor

@ddl-rliu ddl-rliu commented Oct 7, 2025

Tracking issue

Closes #6662

Why are the changes needed?

An error happens when running a ContainerTask task with typing.Union inputs with flyte copilot.

{"level":"error","msg":"Failed to persist [spec], err unsupported scalar type [*core.Scalar_Union]",...}
{"level":"info","msg":"Exited downloading inputs from [.../inputs.pb]",...}
{"level":"error","msg":"Downloading failed, err failed to download input variable from remote store: variable [spec] download/store failed: unsupported scalar type [*core.Scalar_Union]",...}

Context: Support for Union types in the Flyte IDL was added in #1349, but there is still a small missing piece in flytecopilot to support downloading Union-type scalars for ContainerTask flyte tasks. This PR adds this small missing piece.

What changes were proposed in this pull request?

Add a logical path to flytecopilot for typing.Union types.

How was this patch tested?

Tested in my flyte deployment, and confirmed that typing.Union inputs now are correctly downloaded by the flytecopilot init container.

Labels

Please add one or more of the following labels to categorize your PR:

  • added: For new features.
  • changed: For changes in existing functionality.
  • deprecated: For soon-to-be-removed features.
  • removed: For features being removed.
  • fixed: For any bug fixed.
  • security: In case of vulnerabilities

This is important to improve the readability of release notes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Summary by Bito

This pull request enhances the handling of `typing.Union` inputs in flytecopilot by implementing logic for Union scalar types, ensuring correct input downloads and resolving task execution errors. New test cases have also been added to validate these improvements.

@ddl-rliu ddl-rliu force-pushed the rliu.support-union-in-copilot branch from 8d7f054 to 2e4a730 Compare October 7, 2025 23:39
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.56%. Comparing base (996504d) to head (f2714d2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6661      +/-   ##
==========================================
+ Coverage   57.88%   58.56%   +0.67%     
==========================================
  Files         770      929     +159     
  Lines       63679    70879    +7200     
==========================================
+ Hits        36858    41507    +4649     
- Misses      23972    26219    +2247     
- Partials     2849     3153     +304     
Flag Coverage Δ
unittests-datacatalog 59.03% <ø> (ø)
unittests-flyteadmin 56.08% <ø> (-0.06%) ⬇️
unittests-flytecopilot 41.36% <100.00%> (+0.48%) ⬆️
unittests-flytectl 64.70% <ø> (?)
unittests-flyteidl 76.12% <ø> (ø)
unittests-flyteplugins 61.00% <ø> (ø)
unittests-flytepropeller 55.06% <ø> (ø)
unittests-flytestdlib 63.03% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

i, err := d.handleGeneric(ctx, b, toFilePath, writeToFile)
return i, scalar, err
case *core.Scalar_Union:
b := scalar.GetUnion()
Copy link
Contributor

Choose a reason for hiding this comment

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

What if it's a non scalar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, fixed to handle both scalar and non-scalar literals! Also added test cases for either case.

@ddl-rliu ddl-rliu force-pushed the rliu.support-union-in-copilot branch from 9dba770 to f2714d2 Compare October 8, 2025 20:54
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.

[BUG] Failure using Union types with flyte copilot

2 participants