Skip to content

Fix unchecked Result in get_llm_metadata()#18749

Merged
meta-codesync[bot] merged 1 commit intomainfrom
export-D99707695
Apr 7, 2026
Merged

Fix unchecked Result in get_llm_metadata()#18749
meta-codesync[bot] merged 1 commit intomainfrom
export-D99707695

Conversation

@kirklandsign
Copy link
Copy Markdown
Contributor

Summary:
In get_llm_metadata(), module->get() returns a Result but the old code called
.get() without checking if the result is ok. If the method exists in the model
(checked via method_names.count()) but module->get() still fails, this indicates
a serious issue with the .pte file.

Use ET_UNWRAP to propagate the error instead of silently falling back to
defaults, which could mask .pte corruption.

Differential Revision: D99707695

Summary:
In get_llm_metadata(), module->get() returns a Result but the old code called
.get() without checking if the result is ok. If the method exists in the model
(checked via method_names.count()) but module->get() still fails, this indicates
a serious issue with the .pte file.

Use ET_UNWRAP to propagate the error instead of silently falling back to
defaults, which could mask .pte corruption.

Differential Revision: D99707695
Copilot AI review requested due to automatic review settings April 7, 2026 21:00
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented Apr 7, 2026

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/18749

Note: Links to docs will display an error until the docs builds have been completed.

❌ 1 New Failure, 9 Pending

As of commit 36b53a4 with merge base a3a08c1 (image):

NEW FAILURE - The following job has failed:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 7, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Apr 7, 2026

@kirklandsign has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99707695.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates get_llm_metadata() in the LLM runner helpers to correctly handle failures when retrieving metadata values from a Module, avoiding unchecked Result access and surfacing model/.pte issues as errors.

Changes:

  • Replace unchecked Result::get() usage on module->get(method_name) with ET_UNWRAP(...) to propagate errors.
  • Prevent silently continuing with default metadata when the model claims a metadata method exists but retrieval fails.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@larryliu0820 larryliu0820 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot merged commit cd63ef0 into main Apr 7, 2026
171 of 179 checks passed
@meta-codesync meta-codesync Bot deleted the export-D99707695 branch April 7, 2026 22:47
jpiat pushed a commit to jpiat/executorch that referenced this pull request Apr 14, 2026
Differential Revision: D99707695

Pull Request resolved: pytorch#18749
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants