mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-08-21 06:35:50 +00:00
* fix(agent-core): cap foreground shell output to prevent OOM crash A foreground command that streams a very large or unbounded amount of output (e.g. `b3sum --length 18446744073709551615`) grew the live-output buffer until Node aborted with a JavaScript heap out-of-memory error (exit 134). The per-command output is now capped at 16 MiB: on breach the command is gracefully terminated (SIGTERM -> grace -> SIGKILL) and the result carries a message pointing at redirecting large output to a file. The per-task output ring buffer is also made O(1) per chunk (was O(n^2)), which previously starved the event loop and the foreground timeout. Background/detached tasks are exempt. * fix(agent-core): stop buffering output after the foreground cap trips After the 16 MiB foreground ceiling tripped, appendOutput still enqueued every subsequent chunk into the per-task disk write chain during the SIGTERM grace window. A producer that ignores SIGTERM could keep that chain — and the chunk strings each pending write retains — growing until SIGKILL, re-introducing the same out-of-memory risk the cap prevents. Once the cap has tripped, keep only the bounded in-memory ring buffer and stop feeding the disk write chain. Interrupt/timeout capture behaviour is unchanged (they do not set outputLimitTripped). |
||
|---|---|---|
| .. | ||
| agent-timeout.test.ts | ||
| foreground-persistence.test.ts | ||
| heartbeat-stale.test.ts | ||
| helpers.ts | ||
| ids.test.ts | ||
| manager.test.ts | ||
| output-access.test.ts | ||
| output-limit.test.ts | ||
| persist.test.ts | ||
| persistence-compat.test.ts | ||
| reconcile.test.ts | ||
| rpc-events.test.ts | ||