Skip to content

Fix ci-server ci#18180

Merged
Weiko merged 7 commits intomainfrom
fix-ci-server
Feb 24, 2026
Merged

Fix ci-server ci#18180
Weiko merged 7 commits intomainfrom
fix-ci-server

Conversation

@prastoin
Copy link
Copy Markdown
Contributor

No description provided.

@prastoin prastoin self-assigned this Feb 24, 2026
@prastoin prastoin marked this pull request as ready for review February 24, 2026 11:45
@prastoin prastoin requested a review from Weiko February 24, 2026 11:51
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 24, 2026

Greptile Summary

This PR is a CI stabilization effort that fixes multiple failing tests and addresses a few real bugs introduced by the recent AI model availability filtering feature (#18170).

  • Bugfix in agent.resolver.ts: Replaced isDefined with isNonEmptyString for modelId validation, preventing empty strings from reaching validateModelAvailability and causing lookup failures
  • Test mock update in client-config.service.spec.ts: Updated the mocked method from getAvailableModels to getAdminFilteredModels to match the renamed method in AiModelRegistryService
  • Test dependency fix in workspace.service.spec.ts: Added missing AiModelRegistryService mock provider after WorkspaceService gained this new dependency
  • Agent test model ID updates: Changed all agent integration test model IDs from gpt-4o/gpt-4o-mini to gpt-4.1/gpt-5.2 to match the updated model registry
  • View field group snapshot update: Added viewFieldGroupId: null to view snapshot to reflect the new field
  • Widget test fix: Avoided selecting the label identifier field in upsert widget tests, which was causing failures because that field cannot be reassigned to a group
  • Logger fix in generate-api-key.command.ts: Replaced console.log with this.logger.log for consistency
  • Generated frontend types: Regenerated graphql.ts to include the new setAdminAiModelEnabled mutation type
  • // Trigger comment in main.ts: A leftover CI trigger comment that should be removed before merge

Confidence Score: 4/5

  • This PR is safe to merge — it contains targeted CI fixes and one small runtime bugfix, with no architectural or behavioral risk.
  • The changes are mostly test fixes and one genuine bugfix (isDefined → isNonEmptyString). The only concern is the leftover // Trigger comment in main.ts, which is harmless but should be cleaned up.
  • packages/twenty-server/src/main.ts has a leftover // Trigger comment that should be removed.

Important Files Changed

Filename Overview
packages/twenty-front/src/generated-metadata/graphql.ts Auto-generated file: added setAdminAiModelEnabled mutation type and reordered SetAdminAiModelEnabled/GetAdminAiModels generated hooks. No issues.
packages/twenty-server/src/engine/core-modules/api-key/commands/generate-api-key.command.ts Changed console.log to this.logger.log for API key token output, consistent with logger usage elsewhere in the class. Good fix.
packages/twenty-server/src/engine/core-modules/client-config/services/client-config.service.spec.ts Updated mock from getAvailableModels to getAdminFilteredModels, matching the actual service implementation. Correct fix.
packages/twenty-server/src/engine/core-modules/workspace/services/tests/workspace.service.spec.ts Added AiModelRegistryService mock provider to fix compilation after WorkspaceService gained this dependency. Import is slightly out of alphabetical order.
packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts Changed isDefined to isNonEmptyString for modelId validation—prevents empty strings from reaching validateModelAvailability. Correct bugfix.
packages/twenty-server/src/main.ts Added a // Trigger comment solely to force CI rebuild. This is noise that should be removed before merge.
packages/twenty-server/test/integration/metadata/suites/view-field-group/upsert-fields-widget.integration-spec.ts Fixed test to avoid selecting the label identifier field (which cannot be moved to a group), preventing flaky test failures. Added DB query to fetch labelIdentifierFieldMetadataId.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Agent Resolver: createOneAgent / updateOneAgent] --> B{isNonEmptyString\ninput.modelId?}
    B -->|Yes| C[AiModelRegistryService\n.validateModelAvailability]
    C --> D{isModelAdminAllowed?}
    D -->|No| E[Throw AgentException:\nModel disabled by admin]
    D -->|Yes| F{isModelAllowedByWorkspace?}
    F -->|No| G[Throw AgentException:\nModel not available in workspace]
    F -->|Yes| H[Proceed with agent\ncreation/update]
    B -->|No: undefined or empty| H

    style B fill:#f9f,stroke:#333
    style C fill:#bbf,stroke:#333
    style E fill:#fbb,stroke:#333
    style G fill:#fbb,stroke:#333
    style H fill:#bfb,stroke:#333
Loading

Last reviewed commit: e927e4d

Copy link
Copy Markdown
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.

14 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

import { settings } from './engine/constants/settings';
import { generateFrontConfig } from './utils/generate-front-config';

// Trigger
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.

Leftover CI trigger comment
This // Trigger comment appears to be a leftover from forcing a CI rebuild (similar to the prior commit e3f2892b5 trigger ci). It adds no value to the codebase and should be removed before merging.

Suggested change
// Trigger

Copy link
Copy Markdown
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

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

LGTM

@Weiko Weiko merged commit c6ec764 into main Feb 24, 2026
58 of 77 checks passed
@Weiko Weiko deleted the fix-ci-server branch February 24, 2026 11:51
Copy link
Copy Markdown
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 14 files

Prompt for AI agents (all 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-agent/agent.resolver.ts">

<violation number="1" location="packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts:77">
P2: `isNonEmptyString` skips validation for empty-string model IDs while the update input allows empty strings, so `modelId: ""` bypasses `validateModelAvailability`. Validate whenever the field is provided (including empty strings) or add non-empty validation on the input.</violation>
</file>

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

@AuthWorkspace() workspace: WorkspaceEntity,
): Promise<AgentDTO> {
if (isDefined(input.modelId)) {
if (isNonEmptyString(input.modelId)) {
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 24, 2026

Choose a reason for hiding this comment

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

P2: isNonEmptyString skips validation for empty-string model IDs while the update input allows empty strings, so modelId: "" bypasses validateModelAvailability. Validate whenever the field is provided (including empty strings) or add non-empty validation on the input.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-server/src/engine/metadata-modules/ai/ai-agent/agent.resolver.ts, line 77:

<comment>`isNonEmptyString` skips validation for empty-string model IDs while the update input allows empty strings, so `modelId: ""` bypasses `validateModelAvailability`. Validate whenever the field is provided (including empty strings) or add non-empty validation on the input.</comment>

<file context>
@@ -74,7 +74,7 @@ export class AgentResolver {
     @AuthWorkspace() workspace: WorkspaceEntity,
   ): Promise<AgentDTO> {
-    if (isDefined(input.modelId)) {
+    if (isNonEmptyString(input.modelId)) {
       this.aiModelRegistryService.validateModelAvailability(
         input.modelId,
</file context>
Fix with Cubic

@twenty-eng-sync
Copy link
Copy Markdown

Hey @prastoin! After you've done the QA of your Pull Request, you can mark it as done here. Thank you!

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