Skip to content

Commit 1daa051

Browse files
Server Servicesclaude
andcommitted
Switch bun install to isolated linker to fix TUI spinner crash
The previous --linker=hoisted layout flattened workspace node_modules in a way that produced duplicate copies of @opentui/solid (peer mismatch between solid-js 1.9.10 catalog vs @opentui/solid's peer 1.9.12). The opentui-spinner side-effect import then registered the <spinner/> component on one copy while the TUI render reached a different copy, surfacing as: [Reconciler] Unknown component type: spinner (anomalyco/opencode#7415). Switching to bun's default isolated linker matches upstream's nix/node_modules.nix exactly: each package gets its own node_modules/.bun/<pkg>@<ver>+<hash>/ slot with symlinked dedup, so @opentui/solid is never duplicated. installPhase now uses `cp -aR --parents` to preserve those symlinks (a plain `cp -R` dereferences them and breaks the layout). The earlier app.tsx sed workaround is removed: it cannot help when the issue is package duplication, and survives only as a no-op risk. NODE_EXTRA_CA_CERTS in impureEnvVars is kept for the SSL/MITM proxy fix from the previous commit. hashes.json x86_64-linux recomputed for the new layout; the other platforms still need to be filled in by update.sh / a maintainer with access to those targets. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 931f4a2 commit 1daa051

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

‎package.nix‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,18 @@ let
8181
runHook preBuild
8282
export HOME=$(mktemp -d)
8383
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
84+
# Use bun's default `isolated` linker (matches upstream nix/node_modules.nix).
85+
# `--linker=hoisted` was producing duplicate copies of @opentui/solid that
86+
# broke the opentui-spinner side-effect registration (issue #7415).
8487
bun install \
8588
--cpu="${bunCpu}" \
8689
--os="${bunOs}" \
87-
--linker=hoisted \
88-
--filter './' \
90+
--filter '!./' \
8991
--filter './packages/opencode' \
9092
--filter './packages/desktop' \
9193
--filter './packages/app' \
9294
--filter './packages/shared' \
95+
--frozen-lockfile \
9396
--ignore-scripts \
9497
--no-progress
9598
runHook postBuild
@@ -98,7 +101,10 @@ let
98101
installPhase = ''
99102
runHook preInstall
100103
mkdir -p $out
101-
find . -type d -name node_modules -exec cp -R --parents {} $out \;
104+
# `-a` preserves symlinks; the isolated linker stores actual content
105+
# under node_modules/.bun/ with symlinks elsewhere — copying with `-R`
106+
# alone would dereference them and break the layout.
107+
find . -type d -name node_modules -exec cp -aR --parents {} $out \;
102108
runHook postInstall
103109
'';
104110

@@ -135,17 +141,6 @@ stdenvNoCC.mkDerivation {
135141
buildPhase = ''
136142
runHook preBuild
137143
export HOME=$(mktemp -d)
138-
139-
# Workaround for upstream issue anomalyco/opencode#7415:
140-
# ensure opentui-spinner registers the <spinner/> component with the
141-
# @opentui/solid reconciler before any TUI render. The side-effect
142-
# import in prompt/index.tsx may be evaluated too late depending on
143-
# module ordering. Mirrors the (unmerged) fix in PR #11269.
144-
appTsx=packages/opencode/src/cli/cmd/tui/app.tsx
145-
if [ -f "$appTsx" ] && ! grep -q 'opentui-spinner/solid' "$appTsx"; then
146-
sed -i '1i import "opentui-spinner/solid";' "$appTsx"
147-
fi
148-
149144
pushd packages/opencode
150145
bun --bun ./script/build.ts --single --skip-install --skip-embed-web-ui
151146
bun --bun ./script/schema.ts schema.json

0 commit comments

Comments
 (0)