Skip to content

Conversation

@icecrasher321
Copy link
Collaborator

Summary

  • Consolidate code
  • Agent block response format handling
  • Start block input format handling
  • Response Format -- initial value seeding
  • Resolving root level correctly with pass through

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 Jan 21, 2026

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Jan 21, 2026 10:44pm

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR consolidates code and improves handling of agent response formats, start block input formats, and root-level reference resolution.

Key Changes:

  • Agent blocks now dynamically extract output schema from responseFormat subblock, enabling proper type checking and field resolution
  • Start blocks properly handle input format configuration with initial value seeding for response-format type
  • Tag resolution refactored to use centralized navigatePath function instead of custom getNestedValue
  • parseObjectStrings utility consolidated from multiple handlers into shared @/executor/utils/json
  • normalizeName imports moved from local utils to @/executor/constants for better centralization
  • Extensive comment cleanup throughout route.ts for improved readability

Technical improvements:

  • Better code reuse through extraction of common utilities
  • More consistent path navigation using navigatePath across resolvers
  • Proper error handling for missing workflow variables with helpful error messages
  • Response format and input format now both get proper initial value structure

Confidence Score: 4/5

  • Safe to merge with minimal risk - primarily refactoring and consolidation
  • This is well-structured refactoring with good consolidation of duplicate code. The changes improve maintainability by centralizing utilities like parseObjectStrings and normalizeName. The agent response format handling is a new feature addition that follows existing patterns. Minor risk from the tag resolution refactoring, but the logic appears sound and maintains backward compatibility.
  • Pay close attention to apps/sim/app/api/function/execute/route.ts (tag resolution changes) and apps/sim/executor/variables/resolvers/block.ts (new agent output schema logic)

Important Files Changed

Filename Overview
apps/sim/executor/variables/resolvers/block.ts Added agent block response format support by extracting output schema from responseFormat subblock using getBlockOutputs. Removed unused tryParseJSON method. Overall changes improve consistency.
apps/sim/lib/workflows/blocks/block-outputs.ts Added agent block output schema extraction from responseFormat using parseResponseFormatSafely and extractFieldsFromSchema. Creates dynamic outputs based on response format fields.
apps/sim/executor/utils/json.ts Extracted parseObjectStrings to shared utility function for code reuse. Proper recursive JSON parsing with type safety.
apps/sim/stores/workflows/utils.ts Added response-format type to initial value seeding logic (line 140), ensuring response format fields get proper default structure like input-format.
apps/sim/app/api/function/execute/route.ts Refactored tag resolution to use navigatePath, removed getNestedValue and simplified logic. Removed params parameter from resolveTagVariables. Comment cleanup throughout. Improved variable resolution error handling.

Sequence Diagram

sequenceDiagram
    participant User
    participant WorkflowStore
    participant BlockResolver
    participant BlockOutputs
    participant FunctionExecute
    participant ResponseHandler
    
    Note over WorkflowStore: Initial Block Setup
    User->>WorkflowStore: Create Agent/Start Block
    WorkflowStore->>WorkflowStore: prepareBlockState()
    WorkflowStore->>WorkflowStore: Check subBlock.type === 'response-format'
    WorkflowStore->>WorkflowStore: Initialize with default field structure
    
    Note over BlockResolver,BlockOutputs: Runtime Resolution
    User->>BlockResolver: Resolve block reference
    BlockResolver->>BlockResolver: Get block output schema
    BlockResolver->>BlockOutputs: getBlockOutputs(blockType, subBlocks)
    
    alt blockType === 'agent'
        BlockOutputs->>BlockOutputs: Extract responseFormat subblock value
        BlockOutputs->>BlockOutputs: parseResponseFormatSafely()
        BlockOutputs->>BlockOutputs: extractFieldsFromSchema()
        BlockOutputs->>BlockResolver: Return dynamic output schema
    else blockType === 'start'
        BlockOutputs->>BlockOutputs: Extract inputFormat subblock value
        BlockOutputs->>BlockOutputs: normalizeInputFormatValue()
        BlockOutputs->>BlockResolver: Return formatted outputs
    end
    
    BlockResolver->>BlockResolver: navigatePath(output, pathParts)
    BlockResolver->>User: Return resolved value
    
    Note over FunctionExecute: Variable Resolution
    User->>FunctionExecute: Execute function block
    FunctionExecute->>FunctionExecute: resolveCodeVariables()
    FunctionExecute->>FunctionExecute: resolveWorkflowVariables()
    FunctionExecute->>FunctionExecute: resolveEnvironmentVariables()
    FunctionExecute->>FunctionExecute: resolveTagVariables()
    FunctionExecute->>FunctionExecute: navigatePath(blockOutput, pathParts)
    FunctionExecute->>User: Execute with resolved code
    
    Note over ResponseHandler: Data Parsing
    User->>ResponseHandler: Process response block
    ResponseHandler->>ResponseHandler: getResponseData()
    ResponseHandler->>ResponseHandler: parseObjectStrings() from utils
    ResponseHandler->>User: Return parsed data
Loading

cursor[bot]

This comment was marked as outdated.

@icecrasher321
Copy link
Collaborator Author

@cursor review

@icecrasher321 icecrasher321 changed the title fix(resolvers): agent response format, input formats, root level fix(resolver): agent response format, input formats, root level Jan 21, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@icecrasher321 icecrasher321 merged commit 5157f0b into staging Jan 21, 2026
11 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/resolver-bugs branch January 22, 2026 01:20
waleedlatif1 added a commit that referenced this pull request Jan 22, 2026
* fix(zustand): updated to useShallow from deprecated createWithEqualityFn (#2919)

* fix(logger): use direct env access for webpack inlining (#2920)

* fix(notifications): text overflow with line-clamp (#2921)

* chore(helm): add env vars for Vertex AI, orgs, and telemetry (#2922)

* fix(auth): improve reset password flow and consolidate brand detection (#2924)

* fix(auth): improve reset password flow and consolidate brand detection

* fix(auth): set errorHandled for EMAIL_NOT_VERIFIED to prevent duplicate error

* fix(auth): clear success message on login errors

* chore(auth): fix import order per lint

* fix(action-bar): duplicate subflows with children (#2923)

* fix(action-bar): duplicate subflows with children

* fix(action-bar): add validateTriggerPaste for subflow duplicate

* fix(resolver): agent response format, input formats, root level (#2925)

* fix(resolvers): agent response format, input formats, root level

* fix response block initial seeding

* fix tests

* fix(messages-input): fix cursor alignment and auto-resize with overlay (#2926)

* fix(messages-input): fix cursor alignment and auto-resize with overlay

* fixed remaining zustand warnings

* fix(stores): remove dead code causing log spam on startup (#2927)

* fix(stores): remove dead code causing log spam on startup

* fix(stores): replace custom tools zustand store with react query cache

* improvement(ui): use BrandedButton and BrandedLink components (#2930)

- Refactor auth forms to use BrandedButton component
- Add BrandedLink component for changelog page
- Reduce code duplication in login, signup, reset-password forms
- Update star count default value

* fix(custom-tools): remove unsafe title fallback in getCustomTool (#2929)

* fix(custom-tools): remove unsafe title fallback in getCustomTool

* fix(custom-tools): restore title fallback in getCustomTool lookup

Custom tools are referenced by title (custom_${title}), not database ID.
The title fallback is required for client-side tool resolution to work.

* fix(null-bodies): empty bodies handling (#2931)

* fix(null-statuses): empty bodies handling

* address bugbot comment

* fix(token-refresh): microsoft, notion, x, linear (#2933)

* fix(microsoft): proactive refresh needed

* fix(x): missing token refresh flag

* notion and linear missing flag too

* address bugbot comment

* fix(auth): handle EMAIL_NOT_VERIFIED in onError callback (#2932)

* fix(auth): handle EMAIL_NOT_VERIFIED in onError callback

* refactor(auth): extract redirectToVerify helper to reduce duplication

* fix(workflow-selector): use dedicated selector for workflow dropdown (#2934)

* feat(workflow-block): preview (#2935)

* improvement(copilot): tool configs to show nested props (#2936)

* fix(auth): add genericOAuth providers to trustedProviders (#2937)

---------

Co-authored-by: Vikhyath Mondreti <vikhyathvikku@gmail.com>
Co-authored-by: Emir Karabeg <78010029+emir-karabeg@users.noreply.github.com>
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