Identify agent (#17221)

# Introduction
Related to https://github.com/twentyhq/core-team-issues/issues/1989

1/ Migration, applicationId and universalIdentifier are required on
entity ( save point migration + upgrade command fallback pattern )
2/ Backfill using previous standard ids

## Test
tested prod extract
This commit is contained in:
Paul Rastoin
2026-01-18 17:31:25 +01:00
committed by GitHub
parent fae6d0e262
commit 6070dbf16a
8 changed files with 344 additions and 3 deletions
@@ -14,7 +14,7 @@ import {
DEFAULT_SMART_MODEL,
ModelId,
} from 'src/engine/metadata-modules/ai/ai-models/constants/ai-models.const';
import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-entity.interface';
import { SyncableEntityRequired } from 'src/engine/workspace-manager/types/syncable-entity-required.interface';
@Entity('agent')
@Index('IDX_AGENT_ID_DELETED_AT', ['id', 'deletedAt'])
@@ -23,7 +23,7 @@ import { SyncableEntity } from 'src/engine/workspace-manager/types/syncable-enti
where: '"deletedAt" IS NULL',
})
export class AgentEntity
extends SyncableEntity
extends SyncableEntityRequired
implements Required<AgentEntity>
{
@PrimaryGeneratedColumn('uuid')
@@ -19,7 +19,8 @@ export const transformAgentEntityToFlatAgent = (
responseFormat: agentEntity.responseFormat,
workspaceId: agentEntity.workspaceId,
isCustom: agentEntity.isCustom,
universalIdentifier: agentEntity.standardId || agentEntity.id,
// TODO remove once MakeAgentUniversalIdentifierAndApplicationIdNotNullableMigrationCommand has been run once
universalIdentifier: agentEntity.universalIdentifier ?? agentEntity.id,
applicationId: agentEntity.applicationId,
modelConfiguration: agentEntity.modelConfiguration,
evaluationInputs: agentEntity.evaluationInputs,