Repository navigation
fix(opencode): load compiled FFF from packaged sidecars - #150
Merged
Merged
Conversation
Raise the project build runtime to Bun 1.4.2, whose compiled FFI extraction uses a stable content-addressed file per user and addon. Keep the existing portable target and libc matrix. Add a producer-driven compiled FFF regression that checks the real bundled addon across normal starts and forced exits, confirms the surviving bytes and live native operations, and proves the old runtime goes red. Exercise the core search and picker boundary, then run focused package checks.
Pin standalone builds to Bun 1.4.2, whose embedded FFI loader reuses a content-addressed native file. Add a compiled producer regression for normal and forced exits, plus native search coverage through the core FFF layer.
Provide Bun from packageManager to the Nix OpenCode and desktop binary derivations, and remove the version-check warning rewrites. Keep the fixed-output node_modules preparation on its existing Nixpkgs Bun.
Bun owns compiled type:file extraction and leaves named scratch files across the pre-rename crash window and foreign-owner rename fallback. The pinned fff-bun package only resolves that path and passes it to dlopen. Add an OpenCode-only compile mode that loads a content-addressed target library beside the packages/opencode binary, keeping the package default embedded mode for other builds. Preserve the matching OS, architecture, and libc library through this distribution’s npm packages, release archives and installer, Nix, local release, Homebrew, AUR, Windows signing, and container image. Keep the existing embedded extraction regression and its Bun 1.3.14 red result. Add a bounded compiled sidecar regression that observes all native files in an isolated temp directory across normal and forced exits and exercises live file search. Demonstrate the regression fails when sidecar mode is removed, then run focused native search coverage and packaging checks. Do not run the full suite or publish.
Add a pull-request-only, fork-scoped validation workflow. Build the compiled distribution on native Windows x64 and arm64 runners and run the existing producer-driven FFF test, recording the exact PR head, runner, command, and sidecar digest. On native x86_64 and aarch64 Linux and macOS runners, derive Nix node_modules hashes with the existing updater, compare them with nix/hashes.json without editing it, retain per-system reports, and run a real OpenCode Nix build when hashes match. Keep permissions read-only and avoid publish/release workflows.
brentyates-swx
marked this pull request as ready for review
October 8, 2026 23:48
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix compiled native FFF loading for #97. The root
package.jsonBunpackageManagerpin selects Bun for Nix-built OpenCode and desktop binaries (nix/bun.nix,flake.nix). The compiled build (packages/opencode/script/build.ts,packages/script/src/fff-native.ts) creates target-specific FFF sidecars named from the library content digest; the@ff-labs/fff-bunpatch loads the sidecar beside the executable and disables embedded addon extraction (patches/@ff-labs%2Ffff-bun@0.9.4.patch). The installer, npm postinstall, local-release, Docker, and generated release-package paths carry the sidecar with the binary (install,packages/opencode/script/postinstall.mjs,local-release.sh,packages/opencode/Dockerfile,packages/opencode/script/publish.ts).Packaged Windows builds enable native FFF by default when the target sidecar is configured. If packaged FFF cannot load, search fails loudly with the expected sidecar path and the
OPENCODE_DISABLE_FFF=1ripgrep recovery option (packages/core/src/flag/flag.ts,packages/core/src/filesystem/search.ts).Validation
packages/opencode/test/fff-compiled.test.tschecks sidecar loading and native search across normal and forced exits while measuring temporary addon allocations.packages/opencode/test/fff-distribution.test.tsbuilds and runs the compiled executable, checks sidecar mapping and file search, and exercises missing-sidecar failure and recovery diagnostics.packages/core/test/filesystem/search-fff.test.tscovers native file, directory, glob, and content search..github/workflows/fff-platform-validation.ymlruns compiled distribution tests on native Windows x64 and ARM64 runners and checks Nix node_modules hashes plus OpenCode builds on native Linux and macOS runners; runner evidence is retained.The validation workflow has read-only repository permissions and does not publish a release.