Skip to content

fix(admin): handle xgrammar parser load failures#1012

Open
stamsam wants to merge 1 commit into
jundot:mainfrom
stamsam:codex/handle-xgrammar-load-failure
Open

fix(admin): handle xgrammar parser load failures#1012
stamsam wants to merge 1 commit into
jundot:mainfrom
stamsam:codex/handle-xgrammar-load-failure

Conversation

@stamsam
Copy link
Copy Markdown

@stamsam stamsam commented Apr 30, 2026

Summary

  • prevent /admin/api/grammar/parsers from returning 500 when xgrammar imports but its native binding cannot be loaded
  • log the discovery failure and return an empty parser list, matching the existing optional-dependency behavior when xgrammar is absent
  • add a regression test for the native binding load failure reported in Cannot find library: libxgrammar_bindings.dylib, libxgrammar_bindings.so #1005

Fixes #1005

Testing

  • .venv/bin/python -m pytest tests/test_grammar.py::TestListGrammarParsers
  • python3 -m py_compile omlx/admin/routes.py tests/test_grammar.py
  • git diff --check

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.

Cannot find library: libxgrammar_bindings.dylib, libxgrammar_bindings.so

1 participant