Skip to content

fix(runtime-core): bound retained sidecar stderr and always forward it#1810

Open
NathanFlurry wants to merge 1 commit into
stack/fix-native-sidecar-always-answer-sync-rpc-waiters-on-handler-failure-wynsztxpfrom
stack/fix-runtime-core-bound-retained-sidecar-stderr-and-always-forward-it-sunnqwnx
Open

fix(runtime-core): bound retained sidecar stderr and always forward it#1810
NathanFlurry wants to merge 1 commit into
stack/fix-native-sidecar-always-answer-sync-rpc-waiters-on-handler-failure-wynsztxpfrom
stack/fix-runtime-core-bound-retained-sidecar-stderr-and-always-forward-it-sunnqwnx

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant