wso2 / wso2/reference-implementations-afm
[Bug] Webhook interface accumulates chat history across independent events
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2
- Forks
- 4
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing webhook event handling in the Python and Ballerina interpreters, then reproduce the issue with the two curl requests from the report and inspect the debug logs. Done means each webhook request contains only the system prompt and current event payload, with no history from prior events, in both implementations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100