Description
Webhook events are usually independent, fire-and-forget notifications, but the current implementation (both Python and Ballerina interpreters) accumulates LLM chat history across all webhook invocations.
Steps to Reproduce
- Write a simple webhook AFM agent and run it with debug logs.
- Send two webhook events:
# Event 1: provide some information
curl -X POST http://localhost:8085/webhook \
-H "Content-Type: application/json" \
-d '{"message": "The project codename is Apollo and the deadline is March 15."}'
# Event 2: ask about that information
curl -X POST http://localhost:8085/webhook \
-H "Content-Type: application/json" \
-d '{"message": "What is the project codename and when is the deadline?"}'
- Debug logs show the second LLM request includes the full history from the first:
{"messages": [
{"role": "system", "content": "..."},
{"role": "user", "content": "The project codename is Apollo and the deadline is March 15."},
{"role": "assistant", "content": "Got it! The project codename is Apollo with a March 15 deadline. How can I help?"},
{"role": "user", "content": "What is the project codename and when is the deadline?"}
]}
Impact
- Context from unrelated events leaks into subsequent agent runs
- Token usage grows unbounded over the process lifetime
- Agent behavior drifts as history accumulates
Expected behavior
Each webhook event should be processed with a clean context — system prompt + current event payload only, with no history from prior events.
Description
Webhook events are usually independent, fire-and-forget notifications, but the current implementation (both Python and Ballerina interpreters) accumulates LLM chat history across all webhook invocations.
Steps to Reproduce
{"messages": [ {"role": "system", "content": "..."}, {"role": "user", "content": "The project codename is Apollo and the deadline is March 15."}, {"role": "assistant", "content": "Got it! The project codename is Apollo with a March 15 deadline. How can I help?"}, {"role": "user", "content": "What is the project codename and when is the deadline?"} ]}Impact
Expected behavior
Each webhook event should be processed with a clean context — system prompt + current event payload only, with no history from prior events.