feat(worker): add CLAUDE_MEM_WORKER_SCRIPT_PATH to pin the worker bundle#3055
Open
crippledgeek wants to merge 2 commits into
Open
feat(worker): add CLAUDE_MEM_WORKER_SCRIPT_PATH to pin the worker bundle#3055crippledgeek wants to merge 2 commits into
crippledgeek wants to merge 2 commits into
Conversation
Contributor
Greptile SummaryThis PR adds an opt-in worker bundle override for daemon launches. The main changes are:
Confidence Score: 5/5The change is limited to an opt-in environment override with existing fallback behavior preserved. The implementation is narrow, covered by focused tests for override and fallback cases, and the documentation matches the intended local-build workflow.
What T-Rex did
Reviews (1): Last reviewed commit: "docs(worker): document CLAUDE_MEM_WORKER..." | Re-trigger Greptile |
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.
Closes #3054.
Problem
resolveWorkerScriptPath()(src/shared/worker-utils.ts) resolves theworker-service.cjsthe daemon spawns/respawns from two hardcoded candidates — the installed marketplace path, then cwd — with no override. The installed path is checked first and almost always exists, so every respawn resolves to the installed bundle, even when the worker was launched from a local build. There's no documented way to run/test the worker against a local branch build without overwriting the install viasync-marketplace.Change
Add an opt-in env var
CLAUDE_MEM_WORKER_SCRIPT_PATH, checked first inresolveWorkerScriptPath()(guarded byexistsSync):worker-utils.tslazy-spawn,worker-service.tsrestart + restart-handoff successor,mcp-server.ts. (ThenpxCLI wrapper and hook shell templates intentionally keep resolving the installed bundle as thin entry-clients; they delegate to the daemon, which honors the override.)candidate &&guard is also required for the type to compile (process.env.Xisstring | undefined).SettingsDefaultsentry, mirroring howMARKETPLACE_ROOT/CLAUDE_CONFIG_DIRare env-derived.CLAUDE_MEM_WORKER_*scope (cf.WORKER_PORT/WORKER_HOST) +_PATHsuffix (cf.CLAUDE_MEM_CHROMA_UVX_PATH).Tests
New
tests/shared/worker-script-path.test.ts(first coverage for this resolver): override-set-and-existing wins; set-but-nonexistent ignored (== unset); empty-string ignored (== unset). Env/temp-file isolated.npm run typecheckclean; full suite shows no new failures.Docs
configuration.mdx(env table) +development.mdx(Manual Testing: local-build recipe, with a note that pinning a different-version bundle than the installed plugin can trigger the existing version-recycle restart behavior once sessions fire hooks).