Repository navigation
Description
Finding
PR #1559 (native in-process embeddings backend, step 2 of #1554) recorded a loader-path requirement and made it a precondition for the step-3 flip:
The native bindings this loads (onnxruntime-node's
.node, and sharp's, which transformers loads transitively) need libstdc++ (libstdc++.so.6) and zlib (libz.so.1) on the process loader path. … The packaged server's nix closure must provide libstdc++/libz on the loader path before step 3 flips the registration to native.
Step 3 has now flipped the registration (PR #1690, merged 2026-11-05), but the packaged nix closure still does not provide either library, and no open issue tracks this packaging item (#1689 step 4 covers sidecar retirement / HTTP-path removal / docs only).
Evidence (verified on current main 13ab3dc5c2d51fa35ff0273e18f5ef647eca83db, 2026-11-05)
packages/core/src/embeddings.ts(~line 132):EMBEDDING_MODELS[0]registration isbackend: { kind: "native-onnx", snapshotEnv: "LOCAL_EMBED_SNAPSHOT", … }— the native backend is now the default for the local model.packages/core/src/embeddings-native.tsheader (Packaging note) still states in the present tense: "the packaged server's nix closure must provide them" (libstdc++ / libz).nix/opencode.nix:99: the packaged binary's wrapper sets--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ wayland ]}on Linux — wayland only; nostdenv.cc.cc.lib(libstdc++), nozlib.flake.nix(~line 87):stdenv.cc.cc.libappears only in the devShellLD_LIBRARY_PATH(for @parcel/watcher) — that does not reach the packaged server. No nix file undernix/mentions libstdc++, zlib, or onnx.- PR feat(core): flip embeddings registration to native-onnx backend (#1554 step 3) #1690's verification was a laptop dev-shell run ("
LD_LIBRARY_PATHper embeddings-native.ts header") with the sidecar stopped — the packaged binary was not exercised. In a bare environment the failure mode per feat(core): native in-process embeddings backend behind the registry (#1554 step 2) #1559 is loud but total for embeddings:Embeddings.UnavailableError: libstdc++.so.6: cannot open shared object file.
Source PRs: #1559 (merge adc454beeb, the finding) and #1690 (the flip). This is a pr-diff-review finding from reviewing #1559's diff/body against current main.
Why it matters
The default embeddings registration now depends on native bindings whose loader requirements the shipped package does not satisfy. Anyone running the packaged opencode (the nix build is the fleet's deployment route) risks embeddings failing on first use — after the :18752 sidecar is retired in step 4 (#1689), there will be no fallback path left.
Acceptance criteria
- The packaged nix build (
nix/opencode.nix) is exercised end-to-end for embeddings: the builtopencodebinary answers an embeddings round-trip (index + query) with the model snapshot present, with no dev-shellLD_LIBRARY_PATHand no :18752 sidecar running — OR the failure is reproduced and recorded here. - If it fails: the wrapper/closure provides libstdc++ (
stdenv.cc.cc.lib) and zlib on the loader path (e.g. added to thewrapProgramLD_LIBRARY_PATHinnix/opencode.nix), and the round-trip above passes with the built binary. - The packaging note in
packages/core/src/embeddings-native.tsis updated to match the resolved state.
agent-note:v1
Agent: pr-diff-review-b
state: filed
Activity
dezren39 commentedon Nov 5, 2026
agent-note:v1
Agent: pr-diff-review-b
state: filed
note: Filed from PR diff review lane B (run 2026-11-05 03:18 CST) reviewing PR #1559 (merge adc454b) against current main 13ab3dc: #1559 made the packaged nix closure providing libstdc++/zlib a precondition for the step-3 flip; PR #1690 flipped EMBEDDING_MODELS[0] to native-onnx, but nix/opencode.nix:99 wraps LD_LIBRARY_PATH with wayland only and no open issue covered the packaging item (#1689 is sidecar retirement only). Enqueued as a repo-task/v1 triage packet in repo-health-opencode-pilot.
dezren39 commentedon Nov 5, 2026
agent-note:v1
Agent: repo-worker-opencode (task 9976, lane opencode-a, direct)
state: picked up
Verified issue open, no held/user-owned/do-not-merge/do-not-auto-edit labels, no competing open PR. Working the nix packaging fix on the laptop in a dedicated worktree; CI-first verification.
dezren39 commentedon Nov 5, 2026
agent-note:v1
Agent: repo-worker-opencode (task 9976, lane opencode-a, direct)
state: parked — PR opened, awaiting Codex review + built-binary verification
PR: #1739 (branch queue/9976-1727-nix-libstdcpp-zlib, commit 32601e9)
Verified: nix eval drvPath OK for x86_64-linux / aarch64-linux / aarch64-darwin; evaluated wrapper path resolves to gcc-16.2.0-lib (libstdc++.so.6 present) and zlib-1.3.2 (libz.so.1 present).
Remaining before merge: disposition any Codex findings on the PR, and the built-binary embeddings round-trip from the acceptance criteria. Issue stays open.
7 remaining items
dezren39 commentedon Nov 5, 2026
Triage (task 9976, lane opencode-a, re-claimed this shift): CONFIRMED and PARTIALLY RESOLVED — closure fix already merged; only the built-binary verification remains.
Re-verified this shift against fresh GitHub state:
nix/opencode.nix(fresh raw read): the Linux wrapper's LD_LIBRARY_PATH now includeswayland,stdenv.cc.cc.lib, andzlib(lines ~101-107,zlibin the inputs at line 13) — the closure precondition from feat(core): native in-process embeddings backend behind the registry (#1554 step 2) #1559 is now satisfied in the packaging, and the PR also updated theembeddings-native.tspackaging note.Remaining acceptance (the only open item): exercise the packaged nix build end-to-end for embeddings — the built
opencodebinary answers an embeddings round-trip (index + query) with the model snapshot present, with no dev-shell LD_LIBRARY_PATH and no :18752 sidecar running. That verification is enqueued as a separate queue task this shift (dedupe keyrepo-health:v1:fix:developing-today/opencode:issue:1727 (task 10747)), to run on the laptop under the fleet build lock / on CI — not on the sandbox. If the round-trip passes, this issue closes with that evidence; if it fails, the failure is recorded here and routed back to a fix.Triaged by: lane opencode-a, task 9976 — closure fix verified merged (PR #1739); round-trip verification enqueued separately
developing-today commentedon Nov 5, 2026
Verification result (queue task 10747, lane opencode-a, 2026-11-05): the packaged-binary embeddings round-trip does NOT pass yet. #1727 stays open; the exact failure chain is recorded here and a fix task is enqueued.
What was run:
queue/10024-1698-solid-bun@ 57db6c3, which includes PR fix(nix): provide libstdc++/zlib for native-onnx embeddings in packaged opencode #1739's closure fix) succeeds:/nix/store/k938cnzzqka9nkf3pkvfg3w10brkm928-opencode-2.0.30+57db6c3.opencode servecame up;POST /v1/embeddingsforlocal-embed/snowflake-arctic-embed-m-v2.0returned 502:libonnxruntime.so.1: cannot open shared object file: No such file or directoryCould not load the "sharp" module using the linux-x64 runtime(the transitive sharp loadembeddings-native.ts's header warns about).Conclusion: PR #1739's libstdc++/zlib closure is necessary but not sufficient — in the bun-compiled packaged binary, onnxruntime's own shared library is not resolvable and sharp's native binding does not load at all. The remaining work is in the CLI build/packaging (how onnxruntime-node's and sharp's native assets are made resolvable in the compiled binary), routed to a dedicated fix task from #1727's queue entry. Dev-shell behaviour is unaffected.
Recorded by: lane opencode-a, task 10747
Merge pull request #1786 from developing-today-forks/queue/10792-1727…
developing-today commentedon Nov 5, 2026
Resolved — PR #1786 merged as f9b94d8, and the packaged-binary round-trip now passes exactly as this issue's acceptance specifies: built binary only, scrubbed environment (no LD_LIBRARY_PATH, no dev shell), snapshot present at the default HF cache dir, :18752 sidecar verified not listening.
POST /v1/embeddingsreturned three 768-dim unit-norm vectors in 1.2s (prompt_tokens 58); cosine(document, related query) 0.7227 vs cosine(document, unrelated text) 0.2112.The three gaps fixed (each was hiding the next): libonnxruntime.so.1 now ships under lib/onnxruntime in the nix package and is on the wrapper's loader path; transformers' static sharp import is rewritten to the Node bundle's throwing stub in the compiled build (image inputs only — text never reaches it); and transformers' runtime createRequire of onnxruntime-node is rewritten to a static require the bundler resolves.
Completed by: lane opencode-a, tasks 10747 (verification) and 10792 (fix)