Skip to content

[AI] Match ai chat composer to figma#18874

Open
ehconitin wants to merge 18 commits intomainfrom
ai-fast-follows-1
Open

[AI] Match ai chat composer to figma#18874
ehconitin wants to merge 18 commits intomainfrom
ai-fast-follows-1

Conversation

@ehconitin
Copy link
Contributor

@ehconitin ehconitin requested a review from FelixMalfait March 23, 2026 21:05
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx">

<violation number="1" location="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx:122">
P1: Persisted model selection is global and can leak across workspaces, leading to invalid `modelId` being sent in agent chat requests.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts">

<violation number="1" location="packages/twenty-front/src/modules/ai/hooks/useAgentChatModelId.ts:17">
P2: `DEFAULT_SMART_MODEL` user selections are incorrectly treated as unavailable because availability is checked only against `enabledModels` (which excludes virtual models). Use `isModelEnabled` for availability checks so virtual models are accepted.</violation>
</file>

<file name="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx">

<violation number="1" location="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx:172">
P2: Using `resolvedModelId` as the Select value breaks the virtual Auto model selection display. Selecting Auto is immediately normalized to the workspace smart model, so the dropdown does not preserve/show the user’s Auto choice.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@FelixMalfait
Copy link
Member

Screenshot 2026-03-24 at 09 35 42 This should use the model family icon first, only fallback on the provider icon when the model family icon isn't available

"label": "OpenAI",
"apiKey": "{{OPENAI_API_KEY}}",
"models": [
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is auto generated so if you fix this you need to fix the script that generates it too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted

@ehconitin ehconitin requested a review from FelixMalfait March 24, 2026 11:56
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-server/src/engine/metadata-modules/ai/ai-models/ai-providers.json">

<violation number="1">
P1: Lowercasing `modelFamily` in the provider JSON breaks enum-based model-family checks at runtime and causes incorrect billing logic (e.g. Anthropic token accounting no longer matches `ModelFamily.CLAUDE`).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

import { type ClientAiModelConfig } from '~/generated-metadata/graphql';

const VIRTUAL_MODEL_IDS: Set<string> = new Set([
const DEFAULT_MODEL_SENTINEL_IDS: Set<string> = new Set([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model sentinel is also a strange name, what are we trying to say here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used “sentinel” here because we already use that term on the server (isDefaultModelSentinel) for the same default IDs, but yea it looks off -- I renamed it to DEFAULT_MODEL_IDS / isDefaultModelId for clarity (no behavior change)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes apparently I introduced that and I don't even remember, that's bad 🤦‍♂️

GROK = 'grok',
GPT = 'GPT',
CLAUDE = 'CLAUDE',
GEMINI = 'GEMINI',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I had made a comment on the fact that this was synced with model family in providers.json so you need to update the script but I don't see it anymore, maybe I didn't hit send?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you did send it 🙂
i just verified locally by running the sync script (ai-sync-models-dev.ts) and it already picks modelFamily from inferModelFamily / ModelFamily -- so no script change needed -- it would have synced automatically
i’ll include the regenerated file in this PR so it stays in sync

@FelixMalfait
Copy link
Member

Screenshot 2026-03-25 at 16 24 05 Can be fixed in followup PR (better default icon + default and best together does not make sense)

@FelixMalfait
Copy link
Member

Visual Regression Report — twenty-ui

No visual changes detected across 0 stories.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 28 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx">

<violation number="1" location="packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx:132">
P2: Filter out the default model by `modelId`, not by `label`, to avoid dropping distinct models with the same label.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

: t`Default`;

const modelsWithoutDefault = enabledModels.filter(
(model) => model.label !== workspaceSmartModel?.label,
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Filter out the default model by modelId, not by label, to avoid dropping distinct models with the same label.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/ai/components/AIChatEditorSection.tsx, line 132:

<comment>Filter out the default model by `modelId`, not by `label`, to avoid dropping distinct models with the same label.</comment>

<file context>
@@ -125,9 +125,13 @@ export const AIChatEditorSection = () => {
     : t`Default`;
 
+  const modelsWithoutDefault = enabledModels.filter(
+    (model) => model.label !== workspaceSmartModel?.label,
+  );
+
</file context>
Suggested change
(model) => model.label !== workspaceSmartModel?.label,
(model) => model.modelId !== workspaceSmartModel?.modelId,
Fix with Cubic

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