Conversation
3f24205 to
8dfe4b6
Compare
Greptile SummaryThis 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 (
Confidence Score: 4/5
Important Files Changed
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
Last reviewed commit: e927e4d |
| import { settings } from './engine/constants/settings'; | ||
| import { generateFrontConfig } from './utils/generate-front-config'; | ||
|
|
||
| // Trigger |
There was a problem hiding this comment.
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.
| // Trigger |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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>
No description provided.