Repository navigation
fix(bench): only set CODEGRAPH_ENGINE for actual engine-comparison forks - #2341
Merged
carlos-alm merged 2 commits intoAug 8, 2026
Merged
Conversation
…rks (#2140) forkWorker() unconditionally set CODEGRAPH_ENGINE to workerName — correct when workerName is 'wasm'/'native' (forkEngines()'s own two calls), but embedding-benchmark.ts reuses forkWorker() directly with workerName set to a model name ('minilm', 'jina-small', ...), an invalid engine value that tripped a warning on every embed call inside that worker. Gate on envKey === WORKER_ENV_KEY instead, since that's true only for an actual engine-comparison fork and never true for a caller using its own distinct env key — no call-site changes needed anywhere. docs check acknowledged. Impact: 1 functions changed, 5 affected
Contributor
Greptile SummaryThe PR prevents model benchmark workers from overwriting
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (3): Last reviewed commit: "fix(test): make #2140 regression test ro..." | Re-trigger Greptile |
| fs.writeFileSync(scriptPath, CHILD_SCRIPT); | ||
|
|
||
| const result = await forkWorker(scriptPath, '__BENCH_MODEL__', 'minilm', []); | ||
| expect(result).toEqual({ codegraphEngine: null }); |
Contributor
There was a problem hiding this comment.
Ambient engine breaks regression test
If the test process has CODEGRAPH_ENGINE set, forkWorker() passes that inherited value to the child, but this assertion expects null, causing an environment-dependent test failure even though the worker name was correctly not assigned.
Suggested change
| expect(result).toEqual({ codegraphEngine: null }); | |
| expect(result).toEqual({ codegraphEngine: process.env.CODEGRAPH_ENGINE ?? null }); |
Contributor
Codegraph Impact Analysis1 functions changed → 5 callers affected across 5 files
|
…ENGINE (review) The "different envKey" assertion hardcoded null, which fails in any shell/CI environment that already has CODEGRAPH_ENGINE set — forkWorker() still inherits the parent env in that branch, it just doesn't override it. Compare against the test process's own value instead. docs check acknowledged.
Contributor
Author
carlos-alm
deleted the
fix/issue-2140-embedding-benchmark-engine-warning
branch
August 8, 2026 04:41
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Closes #2140
forkWorker()(scripts/lib/fork-engine.ts) unconditionally setCODEGRAPH_ENGINEto whateverworkerNameit was given. That's correct forforkEngines()'s own two calls (workerNameis'wasm'/'native', a valid engine value), butembedding-benchmark.tsreusesforkWorker()directly withworkerNameset to a model name ('minilm','jina-small', ...) — an invalidCODEGRAPH_ENGINEvalue that tripped a"not a valid engine value"warning on every embed call inside that worker. Purely cosmetic noise (it already fell back to"auto"correctly), but a real fix rather than living with it.Fix
forkWorker()now only setsCODEGRAPH_ENGINEwhen the caller'senvKeyis the sameWORKER_ENV_KEYforkEngines()itself uses internally — true for an actual engine-comparison fork, never true for a caller using its own distinct env key (likeembedding-benchmark.ts'sMODEL_WORKER_KEY). No call-site changes needed anywhere, includingembedding-benchmark.tsitself.Test plan
tests/unit/fork-engine-codegraph-engine-env.test.ts: forks a tiny throwaway child script and confirmsCODEGRAPH_ENGINEis set whenenvKeyis the realWORKER_ENV_KEY, and unset for a different envKey.npm testsuite passes (4606 tests, 287 files).npx tsc --noEmitandnpm run lintclean.