mirror of https://github.com/garrytan/gstack.git
Codex review pass 3 flagged a [P2]: the unbounded eager-drain buffer defeats the consumer's existing readCapped at the call site. A runaway child that prints hundreds of MB before timing out now balloons server memory regardless of the consumer's documented 1 MB cap. Cap the per-pipe drain at 16 MB by default (GSTACK_SPAWN_MAX_BUFFER overrides), generous for every real use case (DPAPI ~32B, tasklist <1KB, codex review ~100KB) and small enough to bound worst-case memory. Past the cap, the pipe keeps flowing so the child never blocks in write(), but further bytes are discarded. Consumers reading the replay stream see exactly MAX_BUFFER bytes; the existing readCapped at browser-skill- commands then applies its own 1 MB cap on top with no surprises. Regression test sets GSTACK_SPAWN_MAX_BUFFER=1024, has the child write 10 KB, asserts captured stdout is exactly 1024 bytes and exit resolves cleanly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||