🥞 refactor: Duplicate Agent Versions as Informational Instead of Errors (#8881)

* Fix error when updating an agent with no changes

* Add tests

* Revert translation file changes
This commit is contained in:
Sebastien Bruel 2025-08-07 15:12:05 +09:00 committed by GitHub
parent 1092392ed8
commit 0b071c06f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 474 additions and 120 deletions

View file

@ -316,17 +316,10 @@ const updateAgent = async (searchParameter, updateData, options = {}) => {
if (shouldCreateVersion) {
const duplicateVersion = isDuplicateVersion(updateData, versionData, versions, actionsHash);
if (duplicateVersion && !forceVersion) {
const error = new Error(
'Duplicate version: This would create a version identical to an existing one',
);
error.statusCode = 409;
error.details = {
duplicateVersion,
versionIndex: versions.findIndex(
(v) => JSON.stringify(duplicateVersion) === JSON.stringify(v),
),
};
throw error;
// No changes detected, return the current agent without creating a new version
const agentObj = currentAgent.toObject();
agentObj.version = versions.length;
return agentObj;
}
}