Skip to content

improvement(subblock-defaults): custom defaults for subblocks if needed#1298

Merged
icecrasher321 merged 1 commit intostagingfrom
improvement/subblock-default-vals
Sep 10, 2025
Merged

improvement(subblock-defaults): custom defaults for subblocks if needed#1298
icecrasher321 merged 1 commit intostagingfrom
improvement/subblock-default-vals

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Right now, we always set subblock values to null which isn't always appropriate. We need to be able to custom defaults for subblocks. Added this as a field into subblock configs.

Type of Change

  • Bug fix

Testing

Manually. Used for temperature and tools in the Agent block right now.

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 Sep 10, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Sep 10, 2025 0:10am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Sep 10, 2025 0:10am

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.

Greptile Summary

This PR introduces support for custom default values in sub-blocks instead of always initializing them to null. The change adds a defaultValue field to the SubBlockConfig interface in the type definitions, allowing block configurations to specify appropriate initial values for their sub-blocks.

The implementation modifies the collaborative workflow hook to use these custom defaults via the nullish coalescing operator (subBlock.defaultValue ?? null), maintaining backward compatibility while enabling blocks to define sensible starting values. The Agent block configuration has been updated to demonstrate this functionality with temperature sliders defaulting to 0.5 and 1.0 respectively, and the tools array defaulting to an empty array.

This change addresses a user experience issue where certain field types like sliders and arrays were poorly served by null defaults. Temperature sliders need numeric values for proper rendering, and tool arrays function better with empty arrays than null values. The enhancement fits well within the existing block-driven architecture, allowing configurations to be more self-contained and user-friendly by reducing manual setup requirements.

Confidence score: 4/5

  • This PR is generally safe to merge with only minor considerations needed around comprehensive testing
  • Score reflects solid implementation with good backward compatibility, but lacks automated tests for the new functionality
  • Pay close attention to the collaborative workflow hook to ensure the defaultValue logic works correctly across all block types

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

mode?: 'basic' | 'advanced' | 'both' // Default is 'both' if not specified
canonicalParamId?: string
required?: boolean
defaultValue?: string | number | boolean | Record<string, unknown> | Array<unknown>
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Missing implementation: This field is defined but not used during block initialization. In addBlock() method of WorkflowStore, subblocks are still initialized with value: null regardless of defaultValue

@icecrasher321 icecrasher321 merged commit c48039f into staging Sep 10, 2025
5 checks passed
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
@waleedlatif1 waleedlatif1 deleted the improvement/subblock-default-vals branch October 13, 2025 17:39
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