Skip to content

chore: grouped prompt-total-token , availability, connected-agent-det…#882

Open
Anushtha-Rathore wants to merge 1 commit intoWalkover-Web-Solution:testingfrom
Anushtha-Rathore:agent-info-updates
Open

chore: grouped prompt-total-token , availability, connected-agent-det…#882
Anushtha-Rathore wants to merge 1 commit intoWalkover-Web-Solution:testingfrom
Anushtha-Rathore:agent-info-updates

Conversation

@Anushtha-Rathore
Copy link
Copy Markdown
Contributor

[chore: grouped prompt-total-token , availability, connected-agent-details and variavle state under agent-info

Copy link
Copy Markdown
Contributor

@windsurf-bot windsurf-bot bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +290 to +293
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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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;
}

Comment on lines +460 to +462
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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant