🔄 fix: Handle Legacy Agent Version Creation (#7718)

* Simplify version creation logic in updateAgent function

* Add comprehensive tests for agent functionality including version history, action metadata generation, and loading agents

- Introduced tests for generating consistent hashes for action metadata.
- Implemented tests for loading agents with various scenarios including null and non-existent IDs.
- Added edge case tests for agent creation, updates, and error handling.
- Ensured proper handling of ephemeral agents and their associated functionalities.

* Enhance tests for Agent model functionality

- Updated test structure for Agent resource file operations, improving organization and readability.
- Added comprehensive tests for handling concurrent file additions and removals, ensuring data integrity.
- Implemented edge case tests for agent creation and resource file management, including scenarios with non-existent agents.
- Enhanced error handling in tests to cover various failure scenarios, ensuring robustness in agent operations.

* optimize tests
This commit is contained in:
matt burnett 2025-06-03 22:04:13 -04:00 committed by GitHub
parent 1806b70418
commit 32bab33499
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2259 additions and 907 deletions

View file

@ -301,10 +301,7 @@ const updateAgent = async (searchParameter, updateData, options = {}) => {
}
const shouldCreateVersion =
forceVersion ||
(versions &&
versions.length > 0 &&
(Object.keys(directUpdates).length > 0 || $push || $pull || $addToSet));
forceVersion || Object.keys(directUpdates).length > 0 || $push || $pull || $addToSet;
if (shouldCreateVersion) {
const duplicateVersion = isDuplicateVersion(updateData, versionData, versions, actionsHash);