You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
safe-bash brace expansion: ledger reservation per character ≈ 2 KB heap per source byte — 59 KB {a}{a}… script = fatal OOM on a 128 MB isolate under default limits #665
Where:packages/safe-bash/src/shell/brace-expansion.ts:39-42 — admit() calls allocation.reserve(64, 0) per character/node; each reservation creates a record + closure in ValueScope.reserve (src/shell/value-state.ts ~L120) that is only released when the outer allocation.close() runs at generator end. Each 64-byte charge costs ~600 B of real heap, so the 16 MiB maxExpansionBytes / 262 144 maxParseUnits admit ~150 MB of bookkeeping. Parsing alone is fine (parseShellUnit of the same script: 28 ms, ~0 MB) — the blowup is in expansion admission.
Impact: (d) — ~2 KB of heap per source byte; 60 KB of source crashes the isolate under default limits before any expansion output exists. Introduced with brace expansion (e4b598542, #637).
Fix: charge one aggregated reservation per part (count units in a plain integer and reserve once), instead of a ledger record per character; or cap brace tokens per word (e.g. 4 096) with ShellLimitError.
Validated the current-source bookkeeping amplification, fixed and verified on remote main at 0511e60. Brace scratch admission now grows one scope-owned reservation instead of retaining one record and release closure per increment; all existing byte charges, parse limits and cancellation/cleanup boundaries remain. Literal witnesses retain two records instead of 82/322/1,282. TDD: 11 genuine RED failures, then 16/16 dedicated and 144/144 adjacent passes. Complete shell selection: 3,592/3,592. Normal build and maintained root lint pass. No unmeasured heap/OOM ratio is claimed; release monitoring is separate.
Release verified: @poe-platform/[email protected] was published successfully on September 8, 2026. Scoped release run 34192316139 completed successfully; its source commit 691aafe is a verified descendant of the fix commit. This is separate confirmation from the earlier remote-main delivery.
Activity
kamilio commentedon Sep 8, 2026
Validated the current-source bookkeeping amplification, fixed and verified on remote main at 0511e60. Brace scratch admission now grows one scope-owned reservation instead of retaining one record and release closure per increment; all existing byte charges, parse limits and cancellation/cleanup boundaries remain. Literal witnesses retain two records instead of 82/322/1,282. TDD: 11 genuine RED failures, then 16/16 dedicated and 144/144 adjacent passes. Complete shell selection: 3,592/3,592. Normal build and maintained root lint pass. No unmeasured heap/OOM ratio is claimed; release monitoring is separate.
kamilio commentedon Sep 8, 2026
Release verified: @poe-platform/[email protected] was published successfully on September 8, 2026. Scoped release run 34192316139 completed successfully; its source commit 691aafe is a verified descendant of the fix commit. This is separate confirmation from the earlier remote-main delivery.