Repository navigation
fix(webhooks): forward caller context to the scheduled run (#4369) - #4370
Merged
Merged
Conversation
…#4369) POST /api/webhooks/{token} accepts an optional `context`, documented as appended to the schedule message. The backend framed it into a `message` variable that was never used, and called the scheduler with only {"triggered_by": "webhook"}. The agent always got the bare schedule message; the only trace of the context was `has_context` in the audit log. The backend now forwards the stripped, capped context in the trigger body. The scheduler reads it on webhook triggers only and applies the existing data-not-instructions frame (now `service.frame_webhook_context`) to both the execution row's message and the message dispatched to the agent. Manual and cron triggers are unchanged. Tests: tests/unit/test_4369_webhook_context_forwarded.py covers the backend forwarding, the recorded message, the cap, non-webhook triggers and the dispatched message. The Abilityai#1968 handler stub now accepts `context`. Closes Abilityai#4369 Co-Authored-By: Claude Opus 5.5 <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
POST /api/webhooks/{token}accepts an optionalcontext, documented as appended to the schedule message. The backend built that message and never sent it: the scheduler only got{"triggered_by": "webhook"}, so the agent always saw the bare schedule message.Fix
routers/webhooks.py): forwards the stripped, capped context in the trigger body. The unused framing code is removed.main.py,service.py):contexton webhook triggers only.frame_webhook_context, to the execution row's message and to the message dispatched to the agent.docs/memory/feature-flows/webhook-triggers.mdis updated to match.Tests
tests/unit/test_4369_webhook_context_forwarded.py. 4 of its 6 tests failed before the fix; all pass after.Closes #4369
🤖 Generated with Claude Code