Skip to content

Run the gates on bun 1.4.2, whose bun:ffi keeps OpenTUI alive on Windows - #31

Merged
uael merged 2 commits into
mainfrom
ci/bun-1.4
Sep 24, 2026
Merged

uael merged 2 commits into
mainfrom
ci/bun-1.4

Conversation

@uael

@uael uael commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

Main is red on Windows. Bun 1.3.14 crashes at random in tui/test/app.test.ts, with panic(main thread): Segmentation fault at address 0x...AA2 (for example main run 35958719955, job 107502670392). The stack is opentui.dll: editBufferSetTextFromMem, then the emit of eb_content-changed, then a call through the event callback of the edit buffer into no module. #29 took OpenTUI out of the engine worker, and the crash stayed.

The fault address is the entry of a bun:ffi callback. On Bun 1.3, every JSCallback and dlopen wrapper is code that TinyCC builds on a page boundary, so a callback entry has a fixed page offset. On Windows, OpenTUI's event callback is at ...aa2, the suffix of every crash. Bun 1.3.14 takes that code memory from the heap of the process on Windows (the defect that oven-sh/bun#32013 describes, closed unmerged). A probe (run 35959839788, job 107505859740) ran the app tests 6 times on 1.3.14 and read the page of each OpenTUI callback with VirtualQuery. The page starts as PAGE_EXECUTE_READWRITE. In a run that crashed, it became PAGE_READWRITE during the second test, as part of a larger read-write region, and the process then crashed on a callback entry. 3 of the 6 runs crashed. The probe does not show which call resets the protection. It shows that a live callback loses the right to run.

Bun 1.4 builds dlopen, JSCallback and linkSymbols in the engine and uses TinyCC only for cc() (oven-sh/bun#35246). This PR runs the gates on Bun 1.4.2, the latest release. The lockfile does not change under 1.4.2, and OpenTUI 0.5.11 and the napi addon pass every gate on it. On a probe branch of this PR (run 35962664973), the same 6-time loop of the app tests passed 6 of 6 in each of three Windows attempts (jobs 107514389389, 107519591645, 107524083112). The Windows job of this PR passed three times in a row (run 35962657648, jobs 107514362978, 107518493962, 107523705553).

Bun 1.4.2 on Windows fails a write to a directory at the write, with EISDIR: illegal operation on a directory, write and no path. Two tests that expect the error of a failed save to name the file went red. saveFile in @furb/engine is now the one save: it writes <file>.tmp, gives it the name of the file, and throws an error that names the file, with the error of the system as its cause. The World, the view of a session, the preferences and the workspace list save through it, and each has a test.

One test timed out once on Windows under 1.4.2: "Alt+Enter queues a message, and leaves Python input and a program under edit in the composer", at the 5 s default, in job 107508754737. It passed in every later Windows run, in about 0.9 s. The engine of the package keeps "bun": ">=1.3.0", since the binding does not use bun:ffi.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy

uael and others added 2 commits September 24, 2026 07:37
On Windows, bun 1.3.14 crashed at random in the tests of the app. The
fault address was the entry of a native callback of bun:ffi: the event
callback that opentui.dll calls when the text of an edit buffer
changes. Bun 1.3 builds each callback with TinyCC in memory of the
heap of Windows. A probe read the page of that callback during the
tests: it started as PAGE_EXECUTE_READWRITE, and in a run that crashed
it became PAGE_READWRITE before the call. Bun 1.4 builds its callbacks
in the engine and no longer uses TinyCC for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy
The World and the TUI save four files whole: they write <file>.tmp and
give it the name of the file. The error of a failed save was the error
of the runtime. On Windows, bun 1.4.2 fails a write to a directory at
the write, with "EISDIR: illegal operation on a directory, write" and
no path, so the error no longer named the file.

saveFile in @furb/engine is now the one save. Its error names the file
and the file it writes first, and carries the error of the system as
its cause. The World, the view of a session, the preferences and the
workspace list save through it, and a test holds the law for each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy
@uael
uael marked this pull request as ready for review September 24, 2026 07:04
@uael
uael merged commit be7b9dc into main Sep 24, 2026
21 checks passed
@uael
uael deleted the ci/bun-1.4 branch September 24, 2026 07:05
uael added a commit that referenced this pull request Sep 24, 2026
…mage (#34)

* Declare that the TUI needs bun 1.4.2 or later

The bun:ffi of bun 1.3 builds its callbacks with TinyCC. On Windows, their
pages lose the right to run code, and a call into OpenTUI then crashes the
TUI (#31). The package of the TUI now declares bun 1.4.2 as its floor in
engines. The README of the TUI and the root README say it too.

The binding keeps bun 1.3.0 as its floor, since no file of it uses bun:ffi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy

* Name the bun versions on which rejects hangs in the app test

The test catches the rejection of an unknown model by hand, since the
rejects of bun hangs on a rejection that a message of the worker brings.
The comment named bun 1.3 alone. The plain rejects assertion also timed
out after 30 seconds on bun 1.4.2, the version the gates run (#31), while
the caught form passes there. So the catch stays, and the comment names
1.3.14 and 1.4.2, the two versions on which the hang was seen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy

* Give the checkout of a python task the poetry of its image

The steps of textual-kitty-key-phases and tomlkit-toml-table-converters
call poetry, which this host does not hold. So the step failed, and the
checkout had no pytest and none of the dependencies of the task. The
verifier of tomlkit then ran no test, and its reference solution scored 0.

The rig already reads what the python of the image holds from the layers
of the image. Each of the four images whose Dockerfile names poetry holds
poetry 1.8.2. So a seed now installs pip and poetry in the interpreter of
the checkout, at the versions the image holds, under constraints.txt. This
is done per task and not by the tools verb, since the version comes from
the image of each task. With virtualenvs.create false, that poetry
installs into the interpreter, as in the image. The config of poetry
stands in the workroot, so a step does not change the config of the host.

A seed of each of the two tasks now installs its dependencies, and the
reference solution of each scores 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WTTfvMcezhhJksW53iz2Vy

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant