Skip to content

fix(build): disable minify to prevent JSC readonly property errors#26066

Open
stephanschielke wants to merge 1 commit intoanomalyco:devfrom
stephanschielke:fix/disable-minify
Open

fix(build): disable minify to prevent JSC readonly property errors#26066
stephanschielke wants to merge 1 commit intoanomalyco:devfrom
stephanschielke:fix/disable-minify

Conversation

@stephanschielke
Copy link
Copy Markdown

@stephanschielke stephanschielke commented May 6, 2026

Issue for this PR

Closes #25873
Related: #25835

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Disables minify: true in packages/opencode/script/build.ts.

minify: true was added in PR #22362 (2026-04-14, tested on Windows only) to reduce binary size. Combined with effect@4.0.0-beta.58+ (introduced in v1.14.34 via PR #25524), Bun's JSC freezes mutable fold accumulator objects between iterations in compiled+minified binaries, causing Attempted to assign to readonly property on tool calls.

v1.14.33 (minify + beta.57) worked because beta.57's fold patterns create new objects each iteration. v1.14.34+ (minify + beta.59) crashes because the mutable accumulators return the same object, which JSC freezes.

Effect maintainer @mikearnaldi confirms: "This is 100% a bug in Bun's minification implementation."

Trade-off: binary size increases ~16% without minification (per PR #22362 measurements). This is acceptable until Bun fixes the underlying JSC object freezing.

Known Bun issues: oven-sh/bun#13394, oven-sh/bun#12655

Related PRs (alternative fixes):

  • PR #25867: replace all mutable fold patterns with immutable runForEach
  • PR #26067: revert effect to beta.57

How did you verify your code works?

  1. Confirmed minify: true is the environmental trigger by testing compiled binaries with and without minification
  2. bun build --compile (no minify) does NOT reproduce the error
  3. bun build --compile --minify reproduces reliably on Linux x64
  4. Effect maintainer confirms this is a Bun minifier bug

Screenshots / recordings

N/A (build script change, not a UI change)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Bun --compile --minify causes JSC to freeze mutable fold accumulator objects between iterations, producing "Attempted to assign to readonly property" on Linux x64. Effect maintainer @mikearnaldi confirms this is a Bun minifier bug (Effect-TS/effect-smol#2126). Disabling minify until Bun resolves the underlying JSC object shape optimization issue. Related: anomalyco#25873, oven-sh/bun#13394, oven-sh/bun#12655.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Related PRs Found

PR #25867 - fix: mutable Stream.runFold crash in compiled binaries, revert effect to beta.57
#25867

  • Addresses the same root cause (mutable Stream accumulator issue) with an alternative fix approach (replace patterns with immutable runForEach)
  • Mentioned in the current PR's description as an alternative fix

PR #26067 - fix(deps): revert effect to 4.0.0-beta.57 (pre-regression)
#26067

  • Also addresses the same issue but via dependency revert instead of disabling minify
  • Mentioned in the current PR's description as another alternative fix

These are related but not duplicates - they represent different approaches to fixing the same underlying problem. PR #26066 (current) disables minify in the build script, while #25867 and #26067 take alternative approaches.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bash tool fails with 'Attempted to assign to readonly property' in v1.14.34

1 participant