Skip to content

fix(knowledge): name embedding quota, key, and deadline failures in knowledge search - #8405

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/kb-vector-search-resilience
Sep 29, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/kb-vector-search-resilience

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Knowledge search now names the failures a caller can act on instead of collapsing them into a generic 500 "Failed to perform vector search":
    • workspace (BYOK) embedding key out of quota → 503, points at Settings > Provider API keys
    • platform embedding key out of quota → 503, does not blame the workspace's key
    • workspace embedding key rejected → 502
    • retrieval deadline → 504 with the existing deadline message
  • A quota error raised while a key's quota pause is already open (or on admission refusal) now keeps the BYOK flag. Before, only the first request after exhaustion was attributed to the workspace key; every request during the 5-minute pause looked like a platform failure
  • The knowledge tool path still logs projected 5xx errors, so moving these off the unhandled branch doesn't lose server-side visibility
  • Every status stays 5xx, so retry and alerting behavior keyed on server errors is unchanged; platform-key rejections and unknown errors still fall through to the existing generic 500

Type of Change

  • Bug fix

Testing

  • New regression tests, each confirmed red by reverting its guard: quota-pause BYOK attribution (lib/embeddings/client.test.ts), search error policy mapping + quota-check ordering (lib/knowledge/api/route-policies.test.ts)
  • vitest over lib/embeddings, lib/internal/knowledge, lib/knowledge/{api,application,documents,search}, app/api/knowledge, tools/knowledge: 127 files, 1,152 tests passing
  • bun run type-check, bun run lint, bun run check:audits (52 audits), docs-manifest:check, block-registry check

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 29, 2026 5:48am UTC

Request Review

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/embeddings/client.ts
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Improves error naming in knowledge search embedding failures.

The PR appears safe to merge; no outstanding or new actionable findings remain.

Summary

The PR gives knowledge-search callers specific responses for embedding quota, rejected workspace-key, and retrieval-deadline failures. It also preserves workspace-key attribution while a quota pause is open and retains logging for projected 5xx tool errors.

Reviews (3) · Last reviewed commit: "test(embeddings): prove the quota pause ..."

Comment thread apps/sim/lib/knowledge/api/route-policies.ts
Comment thread apps/sim/lib/internal/knowledge/execute-tool.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

Comment thread apps/sim/lib/embeddings/client.test.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 6 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit e715c5b into staging Sep 29, 2026
23 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/kb-vector-search-resilience branch September 29, 2026 05:53

This branch was previously deployed

1 inactive deployment
Preview — fb693c2e Deployed Sep 29, 2026 by vercel[bot]
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.

1 participant