Conversation
brandonkachen
added a commit
that referenced
this pull request
Apr 4, 2025
brandonkachen
added a commit
that referenced
this pull request
Apr 30, 2025
jahooma
added a commit
that referenced
this pull request
May 4, 2026
Three previous approaches all failed on Windows in subtly different ways:
1. Single 274KB base64 string literal: bun's Windows minifier dropped
or transformed it (build verified the prefix wasn't in the binary
even though the embed step wrote the file).
2. `with { type: 'file' }` from a node_modules subpath: bytes ended up
in the binary but the import variable was bound to undefined at
runtime — bun on Windows mishandles the JS-level binding for that
attribute.
3. `with { type: 'file' }` from a relative path (wasm copied into
pre-init/): same as #2 — confirms it's not subpath-vs-relative,
it's a bun/Windows bug with the import-attribute binding.
Round 4: write the base64 as ~268 small chunks (1024 chars each) in an
exported array, joined and decoded at runtime in the pre-init. Each
chunk is referenced unconditionally at runtime via .join(''), so DCE
can't eliminate it; each is small enough that no minifier heuristic
would treat it as a special "huge string literal" worth dropping.
- cli/scripts/build-binary.ts: embedTreeSitterWasmAsChunks() writes the
full array, returns sample chunks (start/middle/end) for the post-
build verification scan to look for in the compiled binary. Restores
the empty stub eagerly + via process.on('exit').
- cli/src/pre-init/tree-sitter-wasm-bytes.ts: re-introduced as a stub
exporting an empty readonly string[]. Dev-mode and unit tests see
the empty stub; production builds get the real chunks written in by
build-binary.ts.
- cli/src/pre-init/tree-sitter-wasm.ts: import the chunks, .join(''),
Buffer.from(_, 'base64'), publish on globalThis. The if() guard
remains because dev mode legitimately has zero chunks.
Verified locally: build embeds 268 chunks, post-build verifies 3 sample
chunks at distinct offsets in the compiled binary, --smoke-tree-sitter
exits 0 with "tree-sitter smoke ok (wasmBinary, 205488 bytes)", full
smoke passes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
khiwniti
added a commit
to khiwniti/codebuff
that referenced
this pull request
May 8, 2026
…errors-in-nvidia-nim-api Block only undeclared tools (not hard-coded names) and make tokenizer init resilient
EstarinAzx
added a commit
to EstarinAzx/codebuff-modded
that referenced
this pull request
May 19, 2026
…ks (shim CodebuffAI#2) The codebuff.com backend skip logic in database.ts was ~30 lines of fork-only code in-place edited into the upstream module (shouldSkipBackend helper, SYNTHETIC_USER constant, pickSyntheticUserFields generic), plus five in-place call-site guards (one per backend-touching function). Moved the helpers to sdk/src/impl/fork-impls/backend-skip.ts. The upstream database.ts now has: - One line per call site: if (getForkHooks().skipBackend?.()) return ... - One line in getUserInfoFromApiKey: const synth = getForkHooks().synthUserInfo?.(fields); if (synth) ... - One import of getForkHooks - Zero fork-only helpers, types, or constants backend-skip is side-effect-imported from byok-resolver so any path that loads BYOK (CLI boot, sdk/src/index.ts, model-provider re-exports) also registers skipBackend + synthUserInfo. Bare SDK consumers that never touch BYOK see the hooks as undefined and fall through to the upstream backend path — same external behavior. synthUserInfo guards on shouldSkipBackend internally: it returns null when BYOK isn't active so non-BYOK callers correctly hit the real backend instead of silently getting the synthetic user. Env-architecture allowlist updated — database.ts no longer reads process.env directly; backend-skip.ts is the new authority for the CODEBUFF_USE_BACKEND escape hatch. Verified: bun run typecheck clean, all 19 affected tests green (database-byok-skip + model-provider-byok + database.test). Reduces upstream merge conflict on database.ts from ~30 lines of helpers + five multi-line guards to single-line hook dispatches.
EstarinAzx
added a commit
to EstarinAzx/codebuff-modded
that referenced
this pull request
May 19, 2026
…led binary Shim CodebuffAI#5-7 (commit 6448174) replaced inline BYOK_AT_BOOT IIFEs in use-connection-status / use-gravity-ad / use-agent-validation with a getForkHooks().shouldSkipReactHook?.() lookup. The skip-react-hook impl self-registered via a side-effect import threaded through index.tsx, then a tree-shaking allowlist tweak, then a pre-init move. None of it survived bun --compile. Symptoms in the produced binary: "connecting..." stuck on, no agent dispatch on first prompt — same 0.1.10 lockout the original BYOK_AT_BOOT IIFEs were added to prevent. Root cause not fully isolated; bun-compile's bundler interaction with side-effect imports under workspace package.json sideEffects flags is the suspect, but rather than keep guessing under the user's time pressure, restore the working inline IIFEs. Net effect: the 3 hook files are now byte-identical to modded tip (zero diff). 9-line shim per file gone. Merge friction for these three hooks rebuilds back to the 0.1.10 level — accepted trade-off for a working binary. skip-react-hook.ts deleted. scripts/check-env-architecture.ts allowlist re-includes the 3 hook files (they read process.env again). SDK-side shims (CodebuffAI#1, CodebuffAI#2, CodebuffAI#3) stay — they pass tests and aren't on the broken code path.
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.
No description provided.