fix(runtime-core): bound retained sidecar stderr and always forward it#1810
Conversation
Two defects in one buffer: - Unbounded growth. stderrChunks was append-only for the sidecar's whole lifetime, and its volume is ultimately driven by guest-triggered sidecar diagnostics. Previously the sidecar died on such errors, which bounded it; now that guest-triggered errors are survivable, a guest can drive it without limit and OOM the host process. Retain a bounded excerpt instead: the first 16 KiB and the most recent 48 KiB. Both ends are kept because the root cause is typically the FIRST error while the fatal one is the LAST. Truncation is reported inline rather than silently shortening the diagnostic. - Client parity. The Rust client spawns with Stdio::inherit() and has always forwarded live stderr, so gating forwarding behind AGENTOS_SIDECAR_STDERR left the two clients behaviorally different for identical code. Forward unconditionally to match, which also stops a surviving sidecar's warnings from being invisible to the host by default.
This was referenced Jul 20, 2026
Member
Author
This was referenced Jul 20, 2026
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.
Two defects in one buffer:
Unbounded growth. stderrChunks was append-only for the sidecar's whole
lifetime, and its volume is ultimately driven by guest-triggered sidecar
diagnostics. Previously the sidecar died on such errors, which bounded it;
now that guest-triggered errors are survivable, a guest can drive it without
limit and OOM the host process. Retain a bounded excerpt instead: the first
16 KiB and the most recent 48 KiB. Both ends are kept because the root cause
is typically the FIRST error while the fatal one is the LAST. Truncation is
reported inline rather than silently shortening the diagnostic.
Client parity. The Rust client spawns with Stdio::inherit() and has always
forwarded live stderr, so gating forwarding behind AGENTOS_SIDECAR_STDERR
left the two clients behaviorally different for identical code. Forward
unconditionally to match, which also stops a surviving sidecar's warnings
from being invisible to the host by default.