Skip to content

fix(embedding): preserve vector shapes after provider failures - #571

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
Yushu-Li:fix/embedding-error-return-shape
Oct 31, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
Yushu-Li:fix/embedding-error-return-shape

Conversation

@Yushu-Li

Copy link
Copy Markdown
Contributor

When an embedding request raises, get_embedding() returns a (vector, cost) tuple even though its callers expect a vector. Two such failures can therefore reach NumPy as ragged two-element sequences and crash database novelty checks instead of following the existing empty-vector fallback.

I return [] for a failed string input and one empty vector per failed batch input. Successful responses, provider requests, and error logging are unchanged. This also keeps batch result cardinality aligned with the input and corrects the return-value docstring.

Validation:

  • Three new regression methods cover single-request failure followed by recovery, empty/single/multiple-input batch failures, and actual ProgramDatabase.add() admission through single and consecutive outages (2D and 3D vectors).
  • The final tests fail against the original method: four failure assertions and two database integration errors; the five existing embedding controls pass.
  • All 20 focused embedding/endpoint/novelty tests passed; the final full local unittest suite passed all 981 tests.
  • Black checks and git diff --check passed.

I directed this focused contribution and used OpenAI Codex assistance for reproduction, implementation, tests, and diff review. SDK responses and errors are local fixtures; no live provider calls were made. Existing malformed embeddings in old checkpoints are not migrated.

@codelion
codelion merged commit 5f4a982 into algorithmicsuperintelligence:main Oct 31, 2026
5 checks passed
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