chore: grouped prompt-total-token , availability, connected-agent-det…#882
chore: grouped prompt-total-token , availability, connected-agent-det…#882Anushtha-Rathore wants to merge 1 commit intoWalkover-Web-Solution:testingfrom
Conversation
…ails and variavle state under agent-info
There was a problem hiding this comment.
Other comments (4)
-
src/db_services/agentVersion.service.js (533-533)
The code now looks for `connected_agent_details` under `agent_info`, but there's no fallback to check the old location. For backward compatibility, consider using a pattern like:
const connectedAgentDetails = doc.agent_info?.connected_agent_details || doc.connected_agent_details || {}; - src/db_services/agentVersion.service.js (400-400) This PR moves several fields under a new `agent_info` structure, but I don't see any migration strategy for existing documents. Without migration, fields like `prompt_total_tokens`, `variables_state`, and `connected_agent_details` might be inaccessible in existing documents. Consider adding a migration script or ensuring backward compatibility by checking both locations when reading these fields.
-
src/db_services/configuration.service.js (1157-1160)
This PR moves several fields under the `agent_info` object, but there's no migration strategy for existing documents. Without a migration, queries using the new field paths will fail to find data in existing documents.
Consider adding a migration script or implementing fallback logic in queries that checks both the new and old field paths during a transition period.
- src/db_services/configuration.service.js (1157-1160) This PR makes a significant structural change to the document schema by grouping several fields under `agent_info`, but there's no documentation update explaining this change. Consider adding comments or updating relevant documentation to explain the new structure and the rationale behind it.
💡 To request another review, post a new comment with "/windsurf-review".
| "gpt_memory_context", | ||
| "doc_ids", | ||
| "variables_state", | ||
| "IsstarterQuestionEnable", |
There was a problem hiding this comment.
While moving variables_state under agent_info, you've removed it from simple_fields but there's no migration path for code that might still be using body.variables_state directly. Consider adding a backward compatibility check that moves body.variables_state into agent_info.variables_state if it exists.
| update_fields.agent_info = {}; | ||
|
|
||
| if (body.agent_info.prompt_total_tokens !== undefined) { | ||
| update_fields.agent_info.prompt_total_tokens = body.agent_info.prompt_total_tokens; |
There was a problem hiding this comment.
The current implementation creates a new empty agent_info object without preserving any existing fields that might already be in the agent's agent_info. Consider merging with existing data:
| update_fields.agent_info = {}; | |
| if (body.agent_info.prompt_total_tokens !== undefined) { | |
| update_fields.agent_info.prompt_total_tokens = body.agent_info.prompt_total_tokens; | |
| if (body.agent_info) { | |
| update_fields.agent_info = agent.agent_info || {}; | |
| if (body.agent_info.prompt_total_tokens !== undefined) { | |
| update_fields.agent_info.prompt_total_tokens = body.agent_info.prompt_total_tokens; | |
| } |
| if (child_details.agent_info?.connected_agent_details && Object.keys(child_details.agent_info.connected_agent_details).length > 0) { | ||
| child_updates.agent_info = child_updates.agent_info || {}; | ||
| child_updates.agent_info.connected_agent_details = child_details.agent_info.connected_agent_details; |
There was a problem hiding this comment.
This PR moves several fields under the new agent_info structure, but there's no handling for backward compatibility with existing templates that might still have the old structure. Consider adding fallback logic to check both locations (e.g., child_details.agent_info?.connected_agent_details || child_details.connected_agent_details) to ensure older templates continue to work.
[chore: grouped prompt-total-token , availability, connected-agent-details and variavle state under agent-info