Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/runtime-core/src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ export class StdioSidecarProcess {
private constructor(child: ChildProcessWithoutNullStreams, control: Duplex) {
this.child = child;
this.control = control;
// Buffering sidecar stderr and only replaying it on exit means a LIVE
// sidecar's warnings/errors are invisible to the host — a guest-triggered
// failure that the sidecar survives leaves no host-visible trace at all.
// AGENTOS_SIDECAR_STDERR=1 forwards it to host stderr as it arrives.
const forwardStderr = process.env.AGENTOS_SIDECAR_STDERR === "1";
this.child.stderr.on("data", (chunk: Buffer | string) => {
this.stderrChunks.push(
typeof chunk === "string" ? Buffer.from(chunk) : Buffer.from(chunk),
);
const buffer =
typeof chunk === "string" ? Buffer.from(chunk) : Buffer.from(chunk);
this.stderrChunks.push(buffer);
if (forwardStderr) process.stderr.write(buffer);
});
this.child.on("exit", (code, signal) => {
const error = new SidecarProcessExited({
Expand Down