Skip to content

fix: error early when an .mltbx license dialog cannot be shown - #78

Merged
ehennestad merged 1 commit into
mainfrom
fix-headless-mltbx-license
Oct 21, 2026
Merged

ehennestad merged 1 commit into
mainfrom
fix-headless-mltbx-license

Conversation

@ehennestad

@ehennestad ehennestad commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Before R2026b, matlab.addons.install shows the license agreement of an .mltbx add-on in a dialog unless agreeToLicense is true. installFexPackage passes false when AgreeToLicense is omitted, which is what installRequirements does by default.

Without a display, as on a CI runner, that dialog cannot be shown. R2023a to R2024b throw java.awt.HeadlessException. On R2025a to R2026a the test step did not return: it ran for more than 15 minutes, against about a minute on R2026b, until the run was cancelled. R2026b installs without a dialog. This stopped the v0.12.0 release in run 39647754181.

The bug is not new. The test requirement fex://160058-recursively-list-files-and-folders exposed it when its latest version, 1.0.4, started being served as .mltbx. Versions 1.0.0 to 1.0.3 resolve to metadata.xml and a zip, which installs as a folder without a license dialog, so the v0.11.0 release run never reached this path.

Change

  • installFexPackage raises MatBox:Setup:LicenseDialogUnavailable before downloading an .mltbx add-on when the release is older than R2026b, the license is not accepted, and Java is headless. The message says to pass AgreeToLicense=true, or AgreeToLicenses=true in installRequirements.
  • SetupTest installs its requirements with AgreeToLicenses=true.
  • testOmittedAgreeToLicenseWithoutDisplayErrors checks the error on releases older than R2026b when Java is headless.

A probe in github-actions-sandbox observed, on R2024b, R2025a, R2025b, R2026a and R2026b runners: java.awt.GraphicsEnvironment.isHeadless() is true on every release, and matlab.addons.install(file, true) installs this add-on in under 10 seconds on every release, with no dialog.

The PR workflow tests only the latest release, where the new test is skipped. The release workflow's matrix runs it on the older releases.

🤖 Generated with Claude Code

Before R2026b, matlab.addons.install shows the license agreement of
an .mltbx add-on in a dialog unless agreeToLicense is true. With no
display, as on a CI runner, R2023a to R2024b throw
java.awt.HeadlessException, and on R2025a to R2026a the install did
not return. installFexPackage passes false when AgreeToLicense is
omitted, so installRequirements failed or stalled for any File
Exchange requirement served as .mltbx.

installFexPackage now raises MatBox:Setup:LicenseDialogUnavailable
before downloading such an add-on when the license is not accepted
and Java is headless, and says to pass AgreeToLicense=true. SetupTest
installs its requirements with AgreeToLicenses=true, and a new test
checks the error where no display is available.

The test requirement fex://160058-recursively-list-files-and-folders
exposed this when version 1.0.4 started being served as .mltbx; 1.0.0
to 1.0.3 resolve to a zip and install as a folder.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the fix-headless-mltbx-license branch from e3f25ef to a80c72e Compare October 21, 2026 18:15
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

108 tests  +1   107 ✅ +5   38s ⏱️ +7s
  7 suites ±0     1 💤  - 1 
  1 files   ±0     0 ❌  - 3 

Results for commit a80c72e. ± Comparison against base commit 9917487.

♻️ This comment has been updated with latest results.

@ehennestad
ehennestad enabled auto-merge (squash) October 21, 2026 18:19
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.94%. Comparing base (9917487) to head (a80c72e).

Files with missing lines Patch % Lines
code/+matbox/+setup/+internal/installFexPackage.m 22.22% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #78      +/-   ##
==========================================
- Coverage   57.08%   56.94%   -0.15%     
==========================================
  Files          68       68              
  Lines        1820     1828       +8     
==========================================
+ Hits         1039     1041       +2     
- Misses        781      787       +6     

☔ View full report in Codecov by Harness.
📢 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.

@ehennestad
ehennestad disabled auto-merge October 21, 2026 18:19
@ehennestad
ehennestad merged commit 5c5ec2c into main Oct 21, 2026
8 checks passed
@ehennestad
ehennestad deleted the fix-headless-mltbx-license branch October 21, 2026 18:19
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