feat(webhook): support all HITL template response formats#213
Merged
feat(webhook): support all HITL template response formats#213
Conversation
…ause workflows The webhook approval handler previously only extracted the "decision" field from template responses, causing templates that use "action" (confirm-action, rich-text-editor) or have no explicit decision field (signature-capture) to fail silently. Changes: - Extract decision from "action" field as fallback when "decision" is absent - Default completed webhooks with no decision/action to "approved" - Add normalizeDecision() to map template-specific values (approve, confirm, reject, deny, abort, cancel) to canonical set (approved/rejected) - Clear approval request fields on "approved" (not just "request_changes") to support multi-pause workflows where agents issue sequential approvals - Add localhost:8001 to CORS allowed origins for demo UIs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…-pause The previous commit cleared ApprovalRequestID on both "approved" and "request_changes" decisions. This broke: - Idempotent webhook retries (lookup by request ID returned 404) - Approval-status queries (same lookup failure) - Callback notifications (in-memory store shared pointer was mutated) Fix: - Only clear ApprovalRequestID on "request_changes" (as before) - On "approved", clear URL fields but preserve the request ID - Save callback URL before the update closure to avoid shared-pointer aliasing in stores that mutate objects in-place - Make request-approval handler multi-pause aware: check ApprovalStatus is "pending" (not just ApprovalRequestID existence) so agents can re-request approval after a resolved round Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
decisionandactionresponse fields, covering all 14 HITL template types (text-approval, confirm-action, signature-capture, rich-text-editor, etc.)normalizeDecision()maps template-specific values (approve,confirm,reject,deny,abort,cancel) to the canonical set (approved/rejected/request_changes/expired)approved(not justrequest_changes) so agents can issue sequential approval requests within the same executionapprovedwhen the webhook type iscompletedlocalhost:8001for demo UIsContext
Previously only templates using the
decisionfield in their response worked with the webhook approval handler. Templates usingaction(confirm-action, rich-text-editor) or no explicit field (signature-capture) would fail to extract a decision, causing 400 errors. This blocked the finance-compliance and supply-chain demos from completing HITL workflows with certain template types.Test plan
decision) still worksaction) now resolves correctlycompletedtype) defaults to approvedrequest_changesstill clears approval fields as before🤖 Generated with Claude Code