fix: Telegram persistence queue backpressures the engine and can force stream watchdog timeouts#873
Closed
sam-saffron-jarvis wants to merge 1 commit into
Closed
Conversation
…e stream watchdog timeouts
Owner
|
Implemented in local copy: Telegram callback persistence queue now fails fast/degrades under saturation or cancellation, stops draining buffered callback writes when degraded, reconciles via final ReplaceMessages snapshot, and persists metrics/context estimate at end of run. Verified with go build ./... and targeted tests. |
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.
What changed
ReplaceMessagessnapshot.Why this is high-value
The old code did a blocking channel send from synchronous engine callbacks. Under store contention or tool-heavy turns, once the queue filled, callback execution blocked, stream event consumption stopped, and the Telegram watchdog could cancel healthy runs as if they had gone idle.
This change removes that engine-path backpressure. When the queue cannot accept more work, Telegram now degrades to a bounded, best-effort path: the stream continues, the queue is marked for reconciliation, and the final transcript is repaired with a snapshot instead of stalling the live response.
Validation
telegramStoreOpQueue.enqueuepreviously did a plain blockingq.ops <- storeOpinto a fixed-size channel from synchronous engine callbacks.gofmt -w internal/serve/telegram.go internal/serve/telegram_queue_test.gogo build ./...go test ./...git diff --check