CloudAgentNext - budget ingest frame size and harden wrapper resume#4475
Open
eshurakov wants to merge 2 commits into
Open
CloudAgentNext - budget ingest frame size and harden wrapper resume#4475eshurakov wants to merge 2 commits into
eshurakov wants to merge 2 commits into
Conversation
…sume A wrapper could die after a transport failure: an oversized event closed the /ingest socket with 1009, the global feed threw on backpressure, and an already-expired ping deadline turned the disconnect grace into an immediate wrapper_ping_timeout physical stop. Apply a layered fix: - Ingest frame budgeting (src/shared/ingest-frame.ts): trim, serialize, measure, then compact/reduce/drop so no frame exceeds 1 MiB. Terminal lifecycle events are never silently dropped. - Non-fatal global feed: drop oversized/backpressured events and keep consuming instead of throwing. - Reconnect grace: defer liveness checks while the current connection is inside its disconnect-grace window, and clear stale in-flight pings on reconnect so a fresh ping is scheduled. - Observability: log 1009 closes and emit an internal wrapper_event_truncated signal counted as liveness activity.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryThe latest commit fixes all previously flagged issues (unguarded Files Reviewed (8 files)
Previous Review Summary (commit cb69a52)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit cb69a52)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (13 files)
Reviewed by claude-sonnet-5 · Input: 48 · Output: 9.1K · Cached: 1.7M Review guidance: REVIEW.md from base branch |
…ale liveness Address PR #4475 review comments: - Guard prepareIngestFrame JSON.stringify calls so unserializable events (e.g. circular refs) degrade to the compaction/drop ladder instead of crashing the send path; report unserializable_ingest_event on drop - Extend the stale no-output deadline, not just the ping deadline, when a reconnect is accepted during grace, preventing an immediate wrapper_no_output before buffered output can drain - Fail the global feed attempt after sustained backpressure so the outer loop reconnects on a fresh socket instead of dropping events forever - Reuse exported kiloEventNameOf in connection.ts instead of duplicating the event/type extraction logic
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.
Prevents wrapper death after transport failures with layered defenses.
src/shared/ingest-frame.ts): every wrapper→DO event is trimmed, serialized, measured, and when over 1 MiB compacted → reduced → dropped, so no frame exceeds platform/SQLite-safe limits. Terminal lifecycle events are never silently dropped.wrapper_ping_timeout/pkill.1009closes are logged, and an internalwrapper_event_truncatedsignal is counted as liveness activity.Root cause: an oversized event closed the
/ingestsocket with1009, the global feed threw on backpressure, and an already-expired ping deadline turned the grace window into an immediate physical wrapper stop — leaving the session unrecoverable on revisit.