kimi-code/packages
Kai c434b4c3e6
fix(agent-core): cap foreground shell output to prevent OOM crash (#1285)
* 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).
2026-07-02 13:42:39 +08:00
..
acp-adapter ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
agent-core fix(agent-core): cap foreground shell output to prevent OOM crash (#1285) 2026-07-02 13:42:39 +08:00
kaos ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00
kimi-migration-legacy feat(web): introduce Kimi web app and daemon gateway (#625) 2026-06-17 20:53:46 +08:00
kosong ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
migration-legacy ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
node-sdk ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
oauth feat: add model alias overrides (#1262) 2026-07-01 19:57:13 +08:00
pi-tui ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
protocol ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
server ci: release packages (#1268) 2026-07-02 11:12:20 +08:00
server-e2e fix(web): stop auto-dismissing pending questions and approvals on a timeout (#1070) 2026-06-24 19:15:06 +08:00
telemetry ci: run unit tests on windows (#1037) 2026-06-26 11:56:41 +08:00