-
Notifications
You must be signed in to change notification settings - Fork 251
feat(ai): ensure data is stored correctly for gen-ai COMPASS-10314 #7772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates GenAI request metadata so OpenAI “store” is sent as a proper boolean and forwarded correctly, improving consistency of stored/returned items.
Changes:
- Switch
storemetadata from string ('true'|'false') to boolean (true|false) across prompt building and tests. - Forward
storeexplicitly in the OpenAI provider options for query responses. - Add assistant-side logic to disable storage in certain cases and a workaround to avoid
itemId-based message compaction.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/compass-generative-ai/src/utils/gen-ai-response.ts | Forwards store into OpenAI provider options to ensure storage behavior is applied. |
| packages/compass-generative-ai/src/utils/gen-ai-prompt.ts | Changes store type/value to boolean in prompt metadata. |
| packages/compass-generative-ai/src/utils/gen-ai-prompt.spec.ts | Updates expectations for boolean store. |
| packages/compass-generative-ai/src/atlas-ai-service.spec.ts | Adjusts request assertions for store handling and payload shape. |
| packages/compass-e2e-tests/tests/collection-ai-query.test.ts | Updates E2E assertions to validate boolean store at the request root (not metadata). |
| packages/compass-assistant/src/docs-provider-transport.ts | Adds storage-disabling logic + message transformation to avoid itemId compaction issues. |
| packages/compass-assistant/src/components/assistant-chat.tsx | Sets per-message “disable storage” metadata based on CSFLE connection detection. |
| packages/compass-assistant/src/compass-assistant-provider.tsx | Extends Assistant message metadata to carry the “disable storage” flag. |
| const disbleStorage = filteredMessages.some( | ||
| (message) => message.metadata?.disbleStorage | ||
| ); |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This computes the storage flag based on any message in history. The metadata field is documented as applying to “this message”, so a single earlier disableStorage would unintentionally force store: false for subsequent messages. Prefer basing this on the outgoing message only (e.g., lastMessage.metadata?.disableStorage) or otherwise scoping it explicitly to the message(s) you intend to affect.
| const disbleStorage = filteredMessages.some( | |
| (message) => message.metadata?.disbleStorage | |
| ); | |
| const disbleStorage = !!lastMessage.metadata?.disbleStorage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we want to disable storage for the whole conversation if any of the messages has disableStorage set.
| providerOptions: { | ||
| openai: { | ||
| store: process.env.COMPASS_ASSISTANT_STORE === 'true' ? true : false, | ||
| store: !disbleStorage, |
Copilot
AI
Feb 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change removes the previous environment-based gate (COMPASS_ASSISTANT_STORE) and makes storage enabled by default whenever disableStorage is not set. If the env var is still intended as a global kill-switch/config, combine both controls (e.g., env allows storage AND the message doesn’t disable it) rather than dropping the env check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we still need that flag, cc @lerouxb
Description
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes