Repository navigation
fix(funcs): forward embedding callback context consistently - #899
Merged
dosco merged 1 commit intoNov 16, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix for
AxEmbeddingAdaptertool callbacks.What is the current behavior?
A callback such as
async (embedding, options = {}) => search(embedding, options.sessionId)never receives the caller's options. The adapter forwards them only whenfunc.length === 2; JavaScript's function length excludes default and rest parameters. A normal callback with a default options argument has length 1, while a rest callback has length 0. Both lose the session ID and abort signal supplied to the exported tool.What is the new behavior (if this is a feature change)?
Invoke the callback with the embedding and optional context according to its existing typed signature. Callbacks that only consume the embedding continue working; omitted context still activates the callback's default options.
AxIR portable behavior check:
This touches handwritten
src/ax/funcs/embed.tsand its newembed.test.ts, outside the paths requiring AxIR backlog enrollment.npm run axir:backlog:check -- --base origin/main --head HEADpasses without a new entry. No generated source, public signature, configuration or documentation is changed.Other information:
On main
007ab8366e5bfa98d871feb1af188cc029295c58, the publicAxEmbeddingAdapter.toFunction().funcregression gives 3 failures / 3 controls. After the fix all 6 pass. It covers default/rest/destructured parameters, ordinary two-parameter callbacks, one-parameter callbacks and omitted context.npm run test:unit --workspace=@ax-llm/ax -- --maxWorkers=2).git diff --checkpass.The public adapter/tool code is real.
AxMockAIServicesupplies deterministic embedding vectors in place of a provider; no external model or embedding request was made.AI assistance (Codex) was used for investigation, implementation, review and validation. No human code review is claimed.