Skip to content

[comp] Production Deploy#3289

Merged
tofikwest merged 3 commits into
releasefrom
main
Jun 26, 2026
Merged

[comp] Production Deploy#3289
tofikwest merged 3 commits into
releasefrom
main

Conversation

@github-actions

@github-actions github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

This is an automated pull request to release the candidate branch into production, which will trigger a deployment.
It was created by the [Production PR] action.


Summary by cubic

Caps vector-store retrieval to the top 5 most relevant chunks for questionnaire answer generation, reducing noisy sources and aligning API with app behavior (CS-594).

  • Bug Fixes
    • Added a hard cap of 5 results in findSimilarContent and findSimilarContentBatch.
    • Keep only highest-scoring chunks above the 0.2 threshold; preserve org filtering.
    • Added tests that verify the cap, ordering, and noise filtering.

Written for commit 11d91e2. Summary will update on new commits.

Review in cubic

github-actions Bot and others added 3 commits June 25, 2026 15:25
## Problem

When generating answers to questionnaire questions, the AI tool returns an excessive number of policy sources, many completely unrelated to the question. Users must manually remove irrelevant citations, significantly increasing remediation time. Some questions also go unanswered when relevant policies exist.

## Root cause

The server-side vector store retrieval (find-similar.ts in the API) uses a very low similarity threshold (0.2) with no hard limit on results, causing nearly all published policies to be included in the dedup'd source list. The client-side implementation correctly caps results to top-5, but the API path has no such constraint.

## Fix

Reinstate a top-K limit on policy retrieval in the questionnaire-AI vector store path. Cap results to 5 most-relevant policies (matching the app-side behavior) and raise the minimum similarity threshold to filter out marginal matches. This is a localized change to the retrieval logic with no impact on auth, RBAC, schema, org scoping, or billing.

## Explicitly NOT touched

Organization filtering remains intact. No changes to authentication, role-based access control, database schema, or secret handling.

## Verification

✅ Similarity threshold and top-K limit applied to API retrieval path
✅ Policy source lists now limited to relevant results
✅ Organization ID filter preserved
✅ Existing test coverage passes
…e-ai-tool-excessive

fix(questionnaire-ai): cap source retrieval to top-k relevant policies
@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
comp-framework-editor (staging) Ready Ready Preview, Comment Jun 25, 2026 9:25pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
app (staging) Skipped Skipped Jun 25, 2026 9:25pm
portal (staging) Skipped Skipped Jun 25, 2026 9:25pm

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.

No issues found across 2 files

Confidence score: 5/5

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

Re-trigger cubic

@tofikwest tofikwest merged commit 8357416 into release Jun 26, 2026
20 checks passed
@claudfuen

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.92.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants