Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • add backwards compat for agent messages array

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Nov 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Nov 20, 2025 7:15pm

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 20, 2025

Greptile Overview

Greptile Summary

Added backwards compatibility for agent blocks to preserve legacy fields (systemPrompt, userPrompt, memories) during serialization. This ensures old workflows exported before the messages array migration (introduced in #2023) can still be imported and executed correctly.

Changes:

  • Added isAgentBlock flag to identify agent blocks in extractParams method
  • Introduced isLegacyAgentField check that includes legacy fields even if they're not in the current block config
  • Modified the field inclusion logic to handle both current config-based fields and legacy fields

How it works:
The serializer now checks if a field is a legacy agent field (systemPrompt, userPrompt, or memories) and includes it in the params even if it's not present in the current block configuration. The existing migrateAgentParamsToMessages function (line 46-96) then converts these legacy fields into the new messages array format during deserialization.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a focused, well-implemented backwards compatibility fix that only affects agent blocks during serialization. The logic is clear, correctly scoped to the specific use case, and aligns with the existing migration pattern already present in the codebase (migrateAgentParamsToMessages function). The implementation is non-breaking and defensive.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/serializer/index.ts 5/5 Added backwards compatibility logic to preserve legacy agent block fields (systemPrompt, userPrompt, memories) during serialization, ensuring old workflows exported before the messages array migration can still function correctly

Sequence Diagram

sequenceDiagram
    participant WF as Workflow (Old Format)
    participant S as Serializer.extractParams
    participant BC as Backwards Compat Logic
    participant E as Executor

    Note over WF: Legacy agent block with<br/>systemPrompt, userPrompt, memories

    WF->>S: Serialize agent block
    S->>S: Identify isAgentBlock = true
    S->>S: Loop through subBlocks
    
    alt Legacy field (systemPrompt/userPrompt/memories)
        S->>BC: Check isLegacyAgentField
        BC-->>S: True (even if not in config)
        S->>S: Include field in params
    else Current field
        S->>BC: Check subBlockConfig exists
        BC-->>S: True
        S->>S: Include field in params
    end
    
    S-->>E: Serialized params with legacy fields
    
    Note over E: migrateAgentParamsToMessages<br/>converts old format to messages array
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit f208ff9 into staging Nov 20, 2025
4 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/sdk branch November 20, 2025 19:16
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.

2 participants