Skip to content

fix: model discovery install - #60

Closed
PDT42 wants to merge 6 commits into
AISQLiteServicefrom
fix/model-discovery-install
Closed

fix: model discovery install#60
PDT42 wants to merge 6 commits into
AISQLiteServicefrom
fix/model-discovery-install

Conversation

@PDT42

@PDT42 PDT42 commented Aug 27, 2026

Copy link
Copy Markdown

Fix: Model Discovery Module Filtering and Config Ordering

This PR fixes two issues in the model discovery logic for vector embeddings.

Changes

lib/vector_embedding/model-discovery.js

  • Fix module filtering logic: The Sentence Transformers module validation previously rejected models containing unsupported/unknown module types (e.g., custom or future modules). It now filters the modules list to only consider supported types before validating the pipeline, allowing models with additional unknown modules to be processed correctly.

    • All references to modules (raw list) in the semantics logic are replaced with supported (filtered list) for length checks, index access, and normalization detection.
  • Fix fetchImpl extraction order: Reorders the fetchImpl and createContext initialization in discoverModel to correctly extract fetchImpl before using it to create the context. Previously, createContext was called before fetchImpl was defined, which would cause a runtime error.

  • Minor code quality: Adds several TODO comments for future cleanup and improves whitespace/formatting throughout the file.

Category

🐛 Bug Fix

Have you...

  • Added relevant entry to the change log?

@PDT42
PDT42 marked this pull request as ready for review August 27, 2026 19:26
@PDT42
PDT42 requested review from a team as code owners August 27, 2026 19:26
@hyperspace-pr-bot

Copy link
Copy Markdown
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Fix: Model Discovery Module Filtering and fetchImpl Initialization Order

This PR addresses two bugs in the vector embedding model discovery logic (lib/vector_embedding/model-discovery.js) and fixes a configuration ordering issue in package.json.

Changes

lib/vector_embedding/model-discovery.js

  • Fix module filtering logic: The Sentence Transformers validation previously rejected any model containing unknown/unsupported module types. It now filters the modules list to only consider supported types (supported), allowing models with additional custom or future modules to be processed correctly. All pipeline validation, length checks, and normalization detection now use supported instead of the raw modules array.

  • Fix fetchImpl extraction order: fetchImpl is now correctly initialized before being passed to createContext. Previously, createContext was called before fetchImpl was defined, causing a runtime error.

  • Minor code quality: Adds TODO comments for future cleanup and improves whitespace/formatting throughout the file.

package.json

  • Fix CDS config ordering: Moves the AICore default binding and environment-specific overrides ([production], [hybrid]) to after the kinds definitions block, correcting the configuration structure.

Category

🐛 Bug Fix

Have you...

  • Added relevant entry to the change log?

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.29.54

  • File Content Strategy: Full file content
  • Event Trigger: pull_request.ready_for_review
  • Output Template: Repository PR Template
  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: 41742bf0-a24d-11f1-800d-4e78073e98ce
  • Summary Prompt: Default Prompt

@hyperspace-pr-bot hyperspace-pr-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The PR contains a genuine correctness concern in the module filtering logic (unknown modules interleaved between supported ones are silently accepted), a missing semicolon, several TODO comments that don't belong in a bug-fix PR, and the package.json reordering lacks any stated justification. The core bug fix for fetchImpl extraction order appears correct, but the semantics change in readSentenceTransformerSemantics needs careful scrutiny before merging.

PR Bot Information

Version: 1.29.54

  • File Content Strategy: Full file content
  • LLM: anthropic--claude-4.6-sonnet
  • Correlation ID: 41742bf0-a24d-11f1-800d-4e78073e98ce
  • Event Trigger: pull_request.ready_for_review

Comment thread lib/vector_embedding/model-discovery.js
Comment thread lib/vector_embedding/model-discovery.js Outdated
Comment thread lib/vector_embedding/model-discovery.js Outdated
Comment thread package.json
@PDT42
PDT42 requested a review from sjvans August 27, 2026 19:29
@sjvans

sjvans commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

I compared this PR with #61 in detail.

Both branches start from the same merge base and overlap primarily in lib/vector_embedding/model-discovery.js. They are alternatives rather than dependent changes.

Most of this PR is superseded by #61:

  • The advertised fetchImpl initialization fix is already present in the common base, so it is not a remaining functional difference.
  • feat: discover compatible Hugging Face embedding models #61 replaces the handwritten Hugging Face HTTP access with @huggingface/hub and adds layout-aware artifact discovery, configuration aliases, task validation, authentication, staged model validation, check-model, tests, and documentation.
  • The package.json change here is effectively ordering only.

The meaningful semantic difference is the handling of Sentence Transformers modules. This PR filters unknown modules out and validates the remaining Transformer → Pooling → optional Normalize sequence. #61 intentionally rejects unknown modules.

Silently filtering them is unsafe because modules.json describes an ordered executable pipeline. A Dense, Router, or custom module can change the vector values or dimensions; accepting the repository while not executing that stage can therefore produce incorrect embeddings. This is not something ONNX graph inspection can generally prove irrelevant. For example, #61 rejects lightonai/mLateOn because of its PyLate Dense module.

Recommendation: merge #61 and close this PR as superseded. If a concrete model rejected because of an additional module should be supported, that module should be implemented explicitly—with position/contract validation and tests—rather than removed through a generic filter.

Merging this first would also require manually resolving the conflicting model-discovery implementation when rebasing or merging #61, without providing a useful prerequisite for it.

@PDT42

PDT42 commented Aug 28, 2026

Copy link
Copy Markdown
Author

Closed in favor of #61

@PDT42 PDT42 closed this Aug 28, 2026
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.

2 participants