Skip to content

fix(webhooks): forward caller context to the scheduled run (#4369) - #4370

Merged
vybe merged 1 commit into
Abilityai:devfrom
francisjervis:fix/4369-webhook-context
Nov 11, 2026
Merged

vybe merged 1 commit into
Abilityai:devfrom
francisjervis:fix/4369-webhook-context

Conversation

@francisjervis

Copy link
Copy Markdown
Contributor

Summary

POST /api/webhooks/{token} accepts an optional context, 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

  • Backend (routers/webhooks.py): forwards the stripped, capped context in the trigger body. The unused framing code is removed.
  • Scheduler (main.py, service.py):
    • Reads context on webhook triggers only.
    • Applies the existing data-not-instructions frame, now frame_webhook_context, to the execution row's message and to the message dispatched to the agent.
  • Manual and cron triggers are unchanged.
  • docs/memory/feature-flows/webhook-triggers.md is updated to match.

Tests

  • New tests/unit/test_4369_webhook_context_forwarded.py. 4 of its 6 tests failed before the fix; all pass after.
  • The scheduler and webhook unit tests (38 files) pass on Python 3.13: 871 passed, 1 skipped.

Closes #4369

🤖 Generated with Claude Code

…#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>

@vybe vybe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

merge-train: batch validated on train/20261110-2234 (#4454, all checks green)

@vybe
vybe merged commit 544ca25 into Abilityai:dev Nov 11, 2026
25 checks passed
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.

2 participants