Human-in-the-Loop Approval
& Webhook Routing
Route high-impact agent PRs to Slack/Teams channels with explicit interactive reviewer approval hooks before merge execution
On Day 12, you establish an interactive Human-in-the-Loop (HITL) gate that notifies engineering channels (Slack/Teams) when automated repairs or PRs require sign-off. You will run a local mock webhook server to inspect incoming Block Kit payloads and configure CI approval environments.
HITL Decision Matrix & Webhook Payload Architecture
Define the data points required for human engineers to make high-confidence review decisions.
- Header: Pipeline Run ID & Commit SHA.
- Agent Summary: AI model ID, prompt token spend ($USD), and repair summary.
- Interactive Actions: Approve, Inspect, Reject buttons.
Webhook Dispatcher Prompt & Sample Response
Instruct your AI assistant to generate the webhook dispatch script and local mock server.
@workspace Create a Human-in-the-Loop (HITL) approval routing module for our CI workflow.
Requirements:
1. Create a script scripts/qe-part2/notify-hitl-approval.js that constructs a webhook payload for Slack / Microsoft Teams.
2. The notification must include:
- PR Title, Pipeline Run ID & Author
- Agent Self-Healing Status & Diff Summary
- Interactive button links: "Approve & Auto-Merge", "Inspect Diff", "Reject"
3. Provide instructions for testing with a local mock webhook server.I have created: 1. `scripts/qe-part2/notify-hitl-approval.js`: Constructs Block Kit JSON and POSTs to webhook URL. 2. `scripts/qe-part2/mock-webhook-server.js`: Zero-dependency local receiver listening on port 3333. β To test locally on your machine: Terminal 1: node scripts/qe-part2/mock-webhook-server.js Terminal 2: node scripts/qe-part2/notify-hitl-approval.js
Local Dual-Terminal Mock Testing
Simulate webhook notifications locally without requiring an active external Slack or Teams account.
node scripts/qe-part2/mock-webhook-server.js
# Output: π Local Mock Webhook Listener listening at http://localhost:3333/webhooknode scripts/qe-part2/notify-hitl-approval.js- name: Dispatch HITL Sign-off Notification
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: node scripts/qe-part2/notify-hitl-approval.js
- name: Await Production Reviewer Approval
uses: trstringer/manual-approval@v1
with:
secret: ${{ secrets.GITHUB_TOKEN }}
approvers: qe-lead, security-architectVerification Loop, Troubleshooting & Done Checklist
Verify your webhook routing and approval barriers before enabling autonomous merge permissions.
- β Webhook dispatcher formats valid Slack / Teams JSON payloads.
- β Local mock server receives and renders the notification block.
- β Production webhook secrets are protected in repository settings.
β’ Unprotected Webhooks: Webhook URLs allow unauthenticated HTTP POST messages into team channels. Always store them in CI secrets (SLACK_WEBHOOK_URL).
β’ Non-Blocking Fallbacks: In staging pipelines where no webhook is set, ensure the dispatcher logs a terminal notice and exits cleanly without failing the build.