sim icon indicating copy to clipboard operation
sim copied to clipboard

improvement(hitl): add webhook notification and resume, add webhook block

Open Sg312 opened this issue 11 months ago • 2 comments

Summary

Adds webhook block and webhook resume functionality to hitl block

Type of Change

  • [x] New feature

Testing

Manual

Checklist

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

Sg312 avatar Jan 03 '26 22:01 Sg312

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

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

vercel[bot] avatar Jan 03 '26 22:01 vercel[bot]

Greptile Summary

  • Adds a new webhook request block and tool to send HTTP requests with HMAC-SHA256 signing and standard webhook headers
  • Enhances the human-in-the-loop block to expose resumeEndpoint API URLs alongside existing UI URLs for programmatic workflow resumption
  • Updates the resume page client with modernized styling using CSS variables and improved block identification using optional blockId fields

Important Files Changed

Filename Overview
tools/http/webhook_request.ts New webhook tool with HMAC signature generation and webhook-specific headers; requires review for security implementation
blocks/blocks/webhook_request.ts New webhook request block configuration with AI-powered payload generation and comprehensive webhook functionality
app/api/resume/[workflowId]/[executionId]/[contextId]/route.ts Modified resume API endpoint to allow dashboard access without deployment validation; check authentication logic
executor/handlers/human-in-the-loop/human-in-the-loop-handler.ts Exposes resume API endpoints in HITL block outputs for webhook-based resumption; verify proper endpoint exposure

Confidence score: 4/5

  • This PR introduces significant new webhook functionality with proper integration across the codebase but requires careful security review
  • Score reflects well-structured implementation following established patterns, but deducted one point due to authentication bypass logic in resume endpoints and HMAC security implementation that needs verification
  • Pay close attention to the webhook tool's HMAC signature generation and the resume API's authentication bypass logic for dashboard access

Sequence Diagram

sequenceDiagram
    participant User
    participant HumanInTheLoopBlock
    participant NotificationTools
    participant WebhookRequest
    participant Database
    participant ResumeAPI
    participant PauseResumeManager

    User->>HumanInTheLoopBlock: Execute workflow with HITL block
    HumanInTheLoopBlock->>Database: Generate pause context and persist execution
    HumanInTheLoopBlock->>HumanInTheLoopBlock: Generate resume URLs (UI and API)
    HumanInTheLoopBlock->>NotificationTools: Execute notification tools with resume links
    NotificationTools->>WebhookRequest: Send webhook with resume endpoint
    WebhookRequest->>External Service: POST webhook payload with signature
    External Service-->>WebhookRequest: Acknowledge webhook
    HumanInTheLoopBlock-->>User: Return pause response with resume URLs

    User->>ResumeAPI: POST resume with input data
    ResumeAPI->>Database: Validate workflow access and pause context
    ResumeAPI->>PauseResumeManager: Enqueue or start resume execution
    PauseResumeManager->>Database: Update pause status to resuming
    PauseResumeManager->>PauseResumeManager: Execute workflow from pause point
    PauseResumeManager->>Database: Update execution status to completed
    PauseResumeManager-->>ResumeAPI: Return execution result
    ResumeAPI-->>User: Return resume confirmation

greptile-apps avatar Jan 03 '26 22:01 greptile-apps