Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(engine): emit SystemMemory cgroup notice to stderr, not stdout (#2520)
James Russob179c9536264
diff --git a/packages/engine/src/services/systemMemory.test.ts b/packages/engine/src/services/systemMemory.test.tsindex 0d6911f97a..315f04d142 100644--- a/packages/engine/src/services/systemMemory.test.ts+++ b/packages/engine/src/services/systemMemory.test.ts@@ -252,6 +252,27 @@ describe("getSystemTotalMb", () => {);});+ it("logs the cgroup-limit notice to stderr, not stdout (keeps --json output clean)", async () => {+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {});+ const info = vi.spyOn(console, "info").mockImplementation(() => {});+ const log = vi.spyOn(console, "log").mockImplementation(() => {});+ await withSystemMemoryMocks(+ {+ files: {+ [CGROUP_V2_MEMORY_MAX_PATH]: `${4096 * BYTES_PER_MIB}`,+ },+ },+ ({ getSystemTotalMb }) => {+ expect(getSystemTotalMb()).toBe(4096);+ expect(warn).toHaveBeenCalledTimes(1);+ expect(warn.mock.calls[0]?.[0]).toContain("[SystemMemory] cgroup memory limit detected");+ // stdout must stay clean so `check --json` output is machine-parseable.+ expect(info).not.toHaveBeenCalled();+ expect(log).not.toHaveBeenCalled();+ },+ );+ });+it("stays silent when cgroup files are absent", async () => {const warn = vi.spyOn(console, "warn").mockImplementation(() => {});await withSystemMemoryMocks({}, ({ getSystemTotalMb }) => {diff --git a/packages/engine/src/services/systemMemory.ts b/packages/engine/src/services/systemMemory.tsindex 8ac4d22124..f60c893ae4 100644--- a/packages/engine/src/services/systemMemory.ts+++ b/packages/engine/src/services/systemMemory.ts@@ -93,7 +93,10 @@ function getCgroupLimitMb(): number | null {_cachedCgroupLimitMb = parseCgroupLimitMb(v2Content, v1Content);if (_cachedCgroupLimitMb !== null) {- console.info(+ // stderr, not stdout: this is a diagnostic notice, and commands like `check --json`+ // write their machine-readable payload to stdout. A banner on stdout corrupts that+ // payload for any JSON consumer (it broke the Video Agent's hyperframes check parse).+ console.warn(`[SystemMemory] cgroup memory limit detected: ${_cachedCgroupLimitMb} MiB — ` +`it governs memory-adaptive render behaviour instead of host RAM.`,);