fix(install): repair smart-explore runtime provisioning across IDEs#3095
fix(install): repair smart-explore runtime provisioning across IDEs#3095rymalia wants to merge 2 commits into
Conversation
Greptile SummaryThis PR makes smart-explore runtime setup explicit and validated. The main changes are:
Confidence Score: 4/5The changes appear merge-safe, with focused installer and parser updates backed by targeted regression coverage. The touched paths have tests covering provisioning, validation, Windows binary resolution, Codex installation, and writable cache behavior.
What T-Rex did
|
|
T-Rex pricing update — T-Rex was free through June 2026. Effective July 1, 2026, T-Rex adds 2 credits on top of the standard 1-credit review (3 total). T-Rex settings |
Address review feedback on thedotmack#3095: - isInstallCurrent treated a cache as current from node_modules + marker + version + Bun state alone, so a same-version cache with .install-version but a missing or broken tree-sitter-cli executable skipped installPluginDependencies and left smart-explore broken. Fail the fast path when the plugin declares tree-sitter-cli but its binary is unusable, forcing re-provisioning. (Reported by greptile.) - Make getTreeSitterBin injectable and port thedotmack#2918's Windows resolver tests so the tree-sitter.exe / bare-PATH / non-Windows branches are actually covered. Regenerate the MCP server bundle.
|
Thanks for the re-review. Both findings concern the explicitly documented, out-of-scope runtime silent-empty behavior rather than the changed installer paths. On head In the supported install flow, that executable fails the bounded We are intentionally retaining the parser assertion without a skip guard: silently passing when Tree-sitter cannot execute would conceal resolver and runtime regressions. Surfacing runtime query failures from MCP tools remains the separately documented follow-up from #2910 point 3. |
|
I prepared a clean sync branch for this PR since the current head is conflicting with Branch: https://github.com/Retengart/claude-mem/tree/pr3095-main-sync What it does:
Verification on the prepared branch:
One important PR-body fix is still needed before merge: GitHub currently treats #2964 as a closing reference because the body contains the phrase **tree-sitter slice**; refs #2964 but does not resolve the full tracker.That keeps #2964 open as the broader tracker while this PR covers only the tree-sitter slice. |
Address review feedback on thedotmack#3095: - isInstallCurrent treated a cache as current from node_modules + marker + version + Bun state alone, so a same-version cache with .install-version but a missing or broken tree-sitter-cli executable skipped installPluginDependencies and left smart-explore broken. Fail the fast path when the plugin declares tree-sitter-cli but its binary is unusable, forcing re-provisioning. (Reported by greptile.) - Make getTreeSitterBin injectable and port thedotmack#2918's Windows resolver tests so the tree-sitter.exe / bare-PATH / non-Windows branches are actually covered. Regenerate the MCP server bundle.
672f819 to
a20bd2a
Compare
| enableCodexPluginConfig(); | ||
| runCodexBestEffort( | ||
| ['plugin', 'marketplace', 'upgrade', MARKETPLACE_NAME], | ||
| 'Refreshed Codex marketplace and installed plugin cache.', | ||
| 'Could not refresh Codex marketplace cache; reinstall or upgrade claude-mem from /plugins if Codex still uses old MCP config', | ||
| ); | ||
| await installCodexPluginCache(marketplaceRoot); |
There was a problem hiding this comment.
Enable after provisioning
enableCodexPluginConfig() writes ~/.codex/config.toml before installCodexPluginCache() has installed the plugin cache and validated tree-sitter-cli. If plugin add or runtime provisioning fails, the installer returns failure but leaves claude-mem@claude-mem-local enabled in Codex config, so new Codex sessions can try to load a plugin cache that is missing or not runtime-ready. Move config enablement until after the cache install/provision step succeeds, or roll it back on failure.
Artifacts
- Contains supporting evidence from the run (text/typescript; charset=utf-8).
- Keeps the command output available without making the summary code-heavy.
|
Thanks @Retengart — resolved the conflict on our side (rebased onto main 13.9.2, regenerated mcp-server.cjs from source rather than hand-editing, same approach as your sync branch) and applied your #2964 body fix. PR is green/mergeable again. And thanks for the catch on the closing keyword - whoops. |
Address review feedback on thedotmack#3095: - isInstallCurrent treated a cache as current from node_modules + marker + version + Bun state alone, so a same-version cache with .install-version but a missing or broken tree-sitter-cli executable skipped installPluginDependencies and left smart-explore broken. Fail the fast path when the plugin declares tree-sitter-cli but its binary is unusable, forcing re-provisioning. (Reported by greptile.) - Make getTreeSitterBin injectable and port thedotmack#2918's Windows resolver tests so the tree-sitter.exe / bare-PATH / non-Windows branches are actually covered. Regenerate the MCP server bundle. Co-authored-by: Alex V. <119082209+Retengart@users.noreply.github.com>
a20bd2a to
edae7a1
Compare
Address review feedback on thedotmack#3095: - isInstallCurrent treated a cache as current from node_modules + marker + version + Bun state alone, so a same-version cache with .install-version but a missing or broken tree-sitter-cli executable skipped installPluginDependencies and left smart-explore broken. Fail the fast path when the plugin declares tree-sitter-cli but its binary is unusable, forcing re-provisioning. (Reported by greptile.) - Make getTreeSitterBin injectable and port thedotmack#2918's Windows resolver tests so the tree-sitter.exe / bare-PATH / non-Windows branches are actually covered. Regenerate the MCP server bundle. Co-authored-by: Alex V. <119082209+Retengart@users.noreply.github.com>
edae7a1 to
40bcc50
Compare
Plugin installation suppressed dependency lifecycle scripts, leaving tree-sitter-cli installed without its platform executable. The installer still reported success, but smart_search returned zero symbols and smart_outline could not parse supported files. On Windows the runtime resolver also ignored the downloaded tree-sitter.exe because it checked only the extensionless name. Tree-sitter queries additionally attempted to write compiled grammar data under the user cache, which may be read-only in managed environments. Those failures were suppressed as empty search results. This logic lives in the shared install/repair path, not a Codex-only branch, so the fix and its validation apply to every IDE. Fix runtime provisioning by: - running only tree-sitter-cli's required install script after the script-suppressed dependency install - validating the binary through a timed `tree-sitter --version` probe - resolving tree-sitter.exe before the extensionless name on Windows - installing the Codex plugin directly from the registered local marketplace - writing the Codex .install-version marker only after runtime provisioning succeeds, so it is a truthful "runtime ready" signal - using a writable process-local cache for compiled Tree-sitter grammars - failing installation when the runtime cannot be installed or validated - adding installer, parser, and corrupt-binary regression coverage - documenting the explicit Codex CLI installation command Regenerate the MCP server bundle with the parser fix.
Address review feedback on thedotmack#3095: - isInstallCurrent treated a cache as current from node_modules + marker + version + Bun state alone, so a same-version cache with .install-version but a missing or broken tree-sitter-cli executable skipped installPluginDependencies and left smart-explore broken. Fail the fast path when the plugin declares tree-sitter-cli but its binary is unusable, forcing re-provisioning. (Reported by greptile.) - Make getTreeSitterBin injectable and port thedotmack#2918's Windows resolver tests so the tree-sitter.exe / bare-PATH / non-Windows branches are actually covered. Regenerate the MCP server bundle. Co-authored-by: Alex V. <119082209+Retengart@users.noreply.github.com>
40bcc50 to
65b90cb
Compare
Community bleeding-edge batch 2.\n\nPR: #3095\nAuthor: rymalia\n\nSafety review: installer validates and provisions tree-sitter-cli with bounded execFile and Windows hidden spawn; no credential exfiltration or background telemetry added. Requires install/runtime, spawn-env, and smart-file-read tests. # Conflicts: # plugin/scripts/mcp-server.cjs
Community bleeding-edge batch 2 generated artifacts and integration fix.\n\nIncludes regenerated plugin bundles after merging #3112, #3108, #3099, #3095, #3061, #3055, #3006, #2998, #2945, #2944, #2890, #2889, #2887, #2830, and #2775.\n\nAdds plugin/sqlite to package.json files so the runtime modules from #3108 ship.\n\nHeld from batch 2 by safety review: #2710, #2531.\n\nVerification passed before commit:\n- npm install --no-audit --no-fund\n- npm run typecheck\n- npm run build\n- bun test\n- npm run lint:hook-io\n- npm run lint:spawn-env\n- npm run check:postinstall-allowlist\n- npm run test:agents\n- npm run test:infra\n- npm run test:sqlite\n- bun install --frozen-lockfile --ignore-scripts (plugin/)\n- focused Batch 2 regression bun test set\n- npm run smoke:clean-room\n- npm run e2e:server:docker
|
Merged into the |
Summary
Fix the shared installation path so smart-explore is actually functional after
installing claude-mem, and fail loudly when its runtime cannot be provisioned
instead of reporting success with silently broken tools.
Previously, the installer could report success while leaving
tree-sitter-cliwithout its platform executable. The MCP tools were registered and callable,
but structural parsing silently failed:
smart_searchscanned files but returned zero symbolssmart_outlinecould not parse supported TypeScript filessmart_unfoldcould not locate symbolsThis affected fresh installations across IDEs, including the current
13.9.1release.
Root cause
Three independent failures combined to make smart-explore appear operational
while returning empty results.
Plugin dependencies were installed with lifecycle scripts disabled.
tree-sitter-clirequires its top-level install script to download theplatform-specific executable, so only the npm package metadata was present.
On Windows, even when
tree-sitter.exewas present, the runtime resolverchecked only the extensionless
tree-sittername and discarded it, fallingthrough to a bare-PATH lookup that usually fails.
Tree-sitter attempted to write compiled grammar artifacts under the user's
cache directory, which managed environments may expose as read-only.
The parser caught Tree-sitter errors and returned an empty result, which hid
all three failures.
Changes
tree-sitter-cliinstall script after thescript-suppressed dependency installation.
tree-sitter --versionexecution instead of checking only whether a file exists.
tree-sitter.exebefore the extensionless binary on Windows so adownloaded Windows executable is actually used.
codex plugin addafter registeringthe local marketplace, removing the predictable Git-only
marketplace upgradefailure from local Codex installations..install-versionmarker into the plugin cache only afterruntime provisioning succeeds, so it is a truthful "runtime ready" signal
rather than one seeded optimistically before installation.
XDG_CACHE_HOMEto a writable process-local directory for Tree-sitterqueries.
.exeresolution and bare-PATH fallbacknpx claude-mem install --ide codex-cliin the README.Scope and intentional behavior change
The runtime-provisioning and validation logic added here lives in the shared
installPluginDependencies/verifyCriticalModulespath—not a Codex-onlybranch. It runs for the standard
npx claude-mem installflow and forrepairacross supported IDEs, including Claude Code.
That is deliberate: the same silent-failure mode existed on every shared
installation path, so the fix and its validation apply everywhere.
tree-sitter-clilacked a workingexecutable. Core memory remained functional, but smart-explore silently
returned empty or unparseable results.
installed Tree-sitter executable fails installation or repair.
smart-explore is the only feature that requires Tree-sitter; capture,
injection, recall, and the worker do not. This therefore converts some partial
successes into hard failures. That is intentional: a loud, correct failure is
preferable to reporting success with a broken installed feature, and uniform
behavior across IDEs is easier to support.
Newly blocked environments are platform-availability cases:
execute;
tree-sitter-cli's prebuilt matrix.Deferred follow-up, not included here: if unsupported environments become a
significant support burden, Claude Code could warn and continue without
smart-explore while Codex remains strict. The paths are separable, so that can
remain an isolated policy change.
Also out of scope:
parser.tsstill degrades a runtime Tree-sitter queryfailure to an empty result (#2910's third point). This PR fixes install-time
provisioning and validation so the binary is present and valid; surfacing a
runtime query failure in the tool result instead of returning empty is a
separate change.
Relationship to existing work
This change shares a root cause with an actively tracked cluster and supersedes
parts of two open PRs — flagged so it isn't reviewed in isolation.
tree-sitter-clibinary never downloaded under
--ignore-scripts, plus the Windowsextensionless resolver). Tracking issue tracking: plugin runtime deps missing in distributed bundles — zod external, tree-sitter-cli not downloaded, hooks crash #2964 consolidates a broader cluster
(also
zod/shell-quote/ grammar deps); this PR addresses itstree-sitter slice; refs tracking: plugin runtime deps missing in distributed bundles — zod external, tree-sitter-cli not downloaded, hooks crash #2964 but does not resolve the full tracker.
installPluginDependencies(
setup-runtime.ts) andgetTreeSitterBin(parser.ts). Different strategy:fix(setup): restore tree-sitter CLI on clean Windows installs (closes #2910) #2918 drops
--ignore-scriptsglobally; this PR keeps it and runs onlytree-sitter-cli's vetted install script, avoiding re-introduction of thetree-sitter-swiftpostinstall hang that--ignore-scriptswas added toprevent ([plan-04] Installer Failure Transparency — cross-IDE error taxonomy + 12×4 test matrix #2379). This PR adds
--versionvalidation fix(setup): restore tree-sitter CLI on clean Windows installs (closes #2910) #2918 lacks and folds infix(setup): restore tree-sitter CLI on clean Windows installs (closes #2910) #2918's Windows
tree-sitter.exeresolver fix, so the two are not competinghalf-fixes.
codex plugin addinstall and the sameremoval of the Git-only
marketplace upgradecall. This PR is a superset:it adds tree-sitter runtime provisioning and writes
.install-versionintothe Codex plugin cache after provisioning succeeds (rather than seeding the
marketplace root before
plugin add, so the marker cannot outlive a failedprovision). Verified end-to-end that Codex supplies the cache root to the hook
environment, so the cache-side marker is sufficient (see Verification). Credit
to @Retengart for identifying the missing-marker case.
Verification
codex-cli-installer,install-non-tty,setup-runtime,parser,verify-critical-modules).mcp-server.cjscontains the parser fix (Windows
.exeresolution and process-local cache).shared
installPluginDependenciespath and provisioned a workingtree-sitter 0.26.9executable.installer wrote
.install-versiononly to the Codex plugin cache (themarketplace root stayed marker-free), and the session did not emit
"runtime not yet set up". Repeated with the Claude-cache marker temporarily
removed to rule out the fallback path — the warning stayed absent, confirming
Codex supplies the installed plugin root to the hook environment.
tree-sitter-bin.test.ts) covertree-sitter.exepreference, bare-PATH fallback, and non-Windows resolution.isInstallCurrentregression test covers a same-version cache with a markerbut an unusable
tree-sitter-clibinary (the stale-cache repair path).successfully.
prepublishOnlyruns the full build before publishing; the npm CLI isrebuilt from
src/npx-cli/index.tsintodist/npx-cli/index.js.distisincluded in the published package but intentionally gitignored, so no
additional committed installer artifact is required.
smart_search(symbols found),smart_outline(structure returned), andsmart_unfold(implementationreturned).
13.9.1.Test-suite note
A full
npm testrun was attempted locally. Unrelated listener-based testscannot bind port
0inside the managed workspace sandbox and time out duringsetup. All tests covering the changed installation, parser, and platform paths
pass; CI should run the unrestricted full suite.
User impact
Codex users no longer receive a successful claude-mem installation with
silently broken smart-explore tools. Installation provisions and validates the
required runtime and fails clearly if it cannot.
Claude Code and other IDE users receive the same strict validation through the
shared install and repair paths. Environments without a working
tree-sitter-clibinary—musl/Alpine and architectures outside the prebuiltmatrix—now fail loudly instead of completing with smart-explore silently
broken.
This behavior is intentional; see "Scope and intentional behavior change."