Skip to content

fix(core): accept a directory in ORT_LIB_PATH when the library is inside - #1460

Merged
ajianaz merged 1 commit into
developfrom
fix/ort-lib-path-accepts-directory
Oct 15, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/ort-lib-path-accepts-directory

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

resolve_ort_lib() (crates/uteke-core/src/embed/ort_init.rs) now handles an ORT_LIB_PATH that is a directory. The explicit-path check moved into a pure function, resolve_explicit_ort_path:

ORT_LIB_PATH Result
an existing file used as is (unchanged)
a directory containing libonnxruntime.so / .dylib / onnxruntime.dll that file, with a warn! telling the user to set the file
a directory without the library an error: ORT_LIB_PATH '<dir>' is a directory with no <name> inside; set it to the library file
a missing path the same error text as before

Also adds a CHANGELOG ### Fixed entry under [Unreleased].

Closes #1459.

Why

Every Homebrew install of uteke since v0.19.0 stores memories without embeddings, silently. The tap's shims export ORT_LIB_PATH=<libexec> (a directory). uteke dlopens exactly that path and dlopen fails on a directory, so memories are stored FTS5-only (embedding_written: false) and uteke verify reports a MISMATCH with 0 vectors. The docs say ORT_LIB_PATH is the library file.

The tap fix is codecoradev/homebrew-tap#10. That fixes users after brew reinstall, without a uteke release. This PR makes uteke tolerant of the same misconfiguration, so it cannot fail silently again.

Docker and the release tarballs are not affected.

Testing

  • New unit tests, with no process-environment mutation. They use temp dirs against the pure function and assert exact values and messages:

    • explicit_path_to_a_file_is_used_as_is
    • explicit_path_to_a_directory_finds_the_library_inside
    • explicit_path_to_a_directory_without_the_library_is_an_error
    • explicit_path_that_does_not_exist_is_an_error
  • The existing resolve_ort_lib_env_var_override test is unchanged and still passes.

  • cargo test --workspace: all green (uteke-core 739 passed, 33 ignored ONNX-only). cargo fmt --all -- --check and cargo clippy --workspace --all-targets -- -D warnings: clean.

  • End to end on macOS arm64 with the v0.21.0 release tarball and a real EmbeddingGemma model, uteke remember then uteke verify:

    Binary ORT_LIB_PATH Result
    released v0.21.0 libexec (directory) no embedding, 0 vectors
    this branch libexec (directory) embedding_written: true, 1 vector
    this branch libexec/libonnxruntime.dylib (file) embedding_written: true, 1 vector (unchanged)
  • Found while testing, not changed here: CLI tracing output goes to stdout, so any WARN (including this PR's new one) is printed before the JSON and breaks --json parsing. Tracked separately in cli: tracing output goes to stdout and corrupts --json output #1461.

…ide (#1459)

The Homebrew shims exported the libexec directory as ORT_LIB_PATH. dlopen
fails on a directory, so every Homebrew install since v0.19.0 stored
memories without embeddings. Resolve a directory to the platform library
inside it, with a warning, and fail with a clear message when the library is
not there.
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit b023e15 into develop Oct 15, 2026
18 checks passed
@ajianaz
ajianaz deleted the fix/ort-lib-path-accepts-directory branch October 15, 2026 03:32
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.

Homebrew installs run without embeddings: ORT_LIB_PATH points at a directory (tap shim) and uteke accepts it

1 participant