Repository navigation
Fix webhook timer reset behavior for more predictable delivery - #1192
Merged
Merged
Conversation
Previously, the WebhookSubscriber would reset its flush timer every time a new event was received. This could cause indefinite delays in webhook delivery for conversations with steady but low activity, as the timer would keep getting reset before it could fire. Changes: - Modified WebhookSubscriber.__call__ to only start timer if none exists - Timer is no longer reset when new events arrive - Provides predictable maximum latency equal to flush_delay - Improves responsiveness for real-time monitoring systems Updated tests: - Added comprehensive tests for new timer behavior - Updated existing test that relied on old timer reset behavior - All existing functionality remains intact This addresses user complaints about unpredictable webhook delivery times while maintaining efficient batching when events arrive quickly. Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Coverage Report •
|
|||||||||||||||||||||||||
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
tofarr
marked this pull request as ready for review
November 19, 2025 08:40
StressTestor
pushed a commit
to StressTestor/software-agent-sdk
that referenced
this pull request
Jun 1, 2026
…ands#1192) Co-authored-by: openhands <openhands@all-hands.dev>
5 tasks
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.
Problem
The
WebhookSubscriberhad a significant issue where the flush timer was reset every time a new event was received. This could cause indefinite delays in webhook delivery for conversations with steady but low activity, as the timer would continuously reset before it could fire.Example of problematic behavior:
Solution
Modified the
WebhookSubscriber.__call__method to only start the timer if none exists, preventing constant resets.New behavior:
Changes
Code Changes
WebhookSubscriber.__call__method inconversation_service.py(lines 436-439)self._reset_flush_timer()(always reset timer)if self._flush_timer is None: self._reset_flush_timer()(only start timer if none exists)Testing
test_timer_not_reset_on_subsequent_events: Verifies timer instance remains the sametest_timer_only_started_once_until_flush: Confirms timer is only started once per batchtest_timer_cancelled_when_buffer_full: Ensures proper timer cancellationBenefits
flush_delayseconds of the first event in a batchTesting
This change directly addresses user complaints about unpredictable webhook delivery times while maintaining all existing functionality and improving the overall reliability of the webhook system.
@tofarr can click here to continue refining the PR
Agent Server images for this PR
• GHCR package: https://github.com/OpenHands/agent-sdk/pkgs/container/agent-server
Variants & Base Images
eclipse-temurin:17-jdknikolaik/python-nodejs:python3.12-nodejs22golang:1.21-bookwormPull (multi-arch manifest)
# Each variant is a multi-arch manifest supporting both amd64 and arm64 docker pull ghcr.io/openhands/agent-server:d2f4735-pythonRun
All tags pushed for this build
About Multi-Architecture Support
d2f4735-python) is a multi-arch manifest supporting both amd64 and arm64d2f4735-python-amd64) are also available if needed