Skip to content

Conversation

@Pbonmars-20031006
Copy link
Contributor

@Pbonmars-20031006 Pbonmars-20031006 commented Dec 19, 2025

Summary

Add a check for human in the loop , to directly resolve the url

Type of Change

  • Bug fix

Testing

Manually tested

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 Dec 19, 2025

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

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 19, 2025 2:38am

@Sg312 Sg312 changed the title Improvement(human_in_the_loop): human in the loop url resolution Improvement(hitl): human in the loop url resolution Dec 19, 2025
@Sg312 Sg312 changed the title Improvement(hitl): human in the loop url resolution improvement(hitl): expose url output variable within hitl block for notification Dec 19, 2025
@Pbonmars-20031006 Pbonmars-20031006 changed the title improvement(hitl): expose url output variable within hitl block for notification Improvement(human_in_the_loop): human in the loop url resolution Dec 19, 2025
@Sg312 Sg312 requested review from Sg312 and removed request for Sg312 December 19, 2025 02:22
@Sg312 Sg312 changed the title Improvement(human_in_the_loop): human in the loop url resolution improvement(hitl): show resume url in tag dropdown within hitl block Dec 19, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 19, 2025

Greptile Summary

Extended the self-reference handling for human_in_the_loop blocks to allow them to reference their own url output in the tag dropdown (similar to approval blocks). This enables workflows to access the resume URL during pause operations.

Changes:

  • tag-dropdown.tsx: Added human_in_the_loop to the self-reference exception (lines 848-852) and the self-reference filtering logic (lines 967-969)
  • block-outputs.ts: Extended the special output handling for pause/resume blocks to include human_in_the_loop

Issue Found:

  • There's a parallel code path at line 649 (within the activeSourceBlockId block) that handles the same self-reference filtering for approval blocks but wasn't updated to include human_in_the_loop

Confidence Score: 3/5

  • PR is mostly correct but has an incomplete fix - one code path was missed that could cause inconsistent behavior for users
  • The changes correctly extend human_in_the_loop support in two locations, but a third location (line 649 in the activeSourceBlockId code path) was missed. This creates an inconsistency where the self-reference filtering only applies in some scenarios.
  • tag-dropdown.tsx line 649 needs the same update as lines 967-969

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx Extended self-reference handling for human_in_the_loop blocks. The non-activeSourceBlockId code path was correctly updated, but a similar change is needed in the activeSourceBlockId code path at line 649.
apps/sim/lib/workflows/blocks/block-outputs.ts Correctly extended the approval block's output handling to include human_in_the_loop blocks.

Sequence Diagram

sequenceDiagram
    participant User
    participant TagDropdown
    participant getBlockOutputPaths
    participant BlockOutputs

    User->>TagDropdown: Type < to reference block outputs
    
    alt activeSourceBlockId is set
        TagDropdown->>TagDropdown: Check sourceBlock.type
        alt approval OR human_in_the_loop (line 649)
            TagDropdown->>getBlockOutputPaths: Get dynamic outputs
            TagDropdown->>TagDropdown: Check isSelfReference
            alt Self-reference
                TagDropdown->>TagDropdown: Filter to .url only
            end
        else Other block types
            TagDropdown->>getBlockOutputPaths: Get all outputs
        end
    else activeSourceBlockId is null
        TagDropdown->>TagDropdown: Loop accessible blocks
        TagDropdown->>TagDropdown: Skip self-ref except approval/human_in_the_loop (line 848)
        alt approval OR human_in_the_loop (line 967)
            TagDropdown->>getBlockOutputPaths: Get dynamic outputs
            TagDropdown->>TagDropdown: Check isSelfReference
            alt Self-reference
                TagDropdown->>TagDropdown: Filter to .url only
            end
        end
    end
    
    TagDropdown->>User: Display filtered tags
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.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +848 to +853
if (
accessibleBlockId === blockId &&
accessibleBlock.type !== 'approval' &&
accessibleBlock.type !== 'human_in_the_loop'
)
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Self-reference exception added for human_in_the_loop, but unlike approval blocks (lines 967-979), there's no corresponding filter to restrict self-references to only the url output. The approval block uses blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags to prevent circular references.

For human_in_the_loop, when self-referencing, inputFormat fields will also be exposed even though they aren't available at pause time - only url is populated when the block pauses. Consider adding similar handling:

} else if (accessibleBlock.type === 'approval' || accessibleBlock.type === 'human_in_the_loop') {

at line 967, so both block types share the same self-reference filtering logic.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx
Line: 848:853

Comment:
**logic:** Self-reference exception added for `human_in_the_loop`, but unlike `approval` blocks (lines 967-979), there's no corresponding filter to restrict self-references to only the `url` output. The `approval` block uses `blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags` to prevent circular references.

For `human_in_the_loop`, when self-referencing, inputFormat fields will also be exposed even though they aren't available at pause time - only `url` is populated when the block pauses. Consider adding similar handling:

```
} else if (accessibleBlock.type === 'approval' || accessibleBlock.type === 'human_in_the_loop') {
```

at line 967, so both block types share the same self-reference filtering logic.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should reuse the same utility that the approval block uses to filter to only allow url in tag dropdown

Copy link
Contributor

Choose a reason for hiding this comment

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

You're absolutely right! The human_in_the_loop block should use the same filtering logic as the approval block to restrict self-references to only the url output. Looking at the code, I can see that the approval block has proper filtering logic starting at line 967, but the human_in_the_loop block doesn't have this same protection.

Here's the fix to add the same filtering logic for human_in_the_loop blocks:

Suggested change
if (
accessibleBlockId === blockId &&
accessibleBlock.type !== 'approval' &&
accessibleBlock.type !== 'human_in_the_loop'
)
continue
} else if (accessibleBlock.type === 'approval' || accessibleBlock.type === 'human_in_the_loop') {
const dynamicOutputs = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks)
const isSelfReference = accessibleBlockId === blockId
if (dynamicOutputs.length > 0) {
const allTags = dynamicOutputs.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
} else {
const outputPaths = getBlockOutputPaths(accessibleBlock.type, mergedSubBlocks)
const allTags = outputPaths.map((path) => `${normalizedBlockName}.${path}`)
blockTags = isSelfReference ? allTags.filter((tag) => tag.endsWith('.url')) : allTags
}

This change combines both block types into a single condition and applies the same self-reference filtering logic - when a human_in_the_loop block references itself, only tags ending with .url will be available, preventing circular references while still allowing access to the resume URL during pause time.

@Sg312
Copy link
Contributor

Sg312 commented Dec 19, 2025

@greptile

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.

Additional Comments (1)

  1. apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tag-dropdown/tag-dropdown.tsx, line 649 (link)

    logic: This condition also needs to include human_in_the_loop to apply the same self-reference filtering (restricting to .url output only) in the activeSourceBlockId code path. Without this, when a user explicitly selects a human_in_the_loop block to reference, the inputFormat fields will be shown even for self-references.

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@Pbonmars-20031006 Pbonmars-20031006 merged commit 474762d into staging Dec 19, 2025
10 checks passed
@waleedlatif1 waleedlatif1 deleted the imporovement/human-in-loop-url-resolution branch December 19, 2025 09:28
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.

3 participants