Skip to content

fix(reprocess): resolve cocoindex via PATH, not just next-to-python#410

Merged
HumanBean17 merged 1 commit into
masterfrom
fix/reprocess-cocoindex-path-fallback
Jul 10, 2026
Merged

fix(reprocess): resolve cocoindex via PATH, not just next-to-python#410
HumanBean17 merged 1 commit into
masterfrom
fix/reprocess-cocoindex-path-fallback

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Problem

java-codebase-rag reprocess (no flags) failed with cocoindex not found next to python on installs where the cocoindex console script lives away from the venv python — e.g. ~/.local/bin from pip install --user — even though cocoindex was installed, importable, and on PATH.

Meanwhile every sibling command worked on the same install:

Command Resolves cocoindex via
init, increment, reprocess --vectors-only, erase next-to-python → then shutil.which (PATH)
reprocess (no flags) next-to-python only

The two code paths disagreed: the sync path (pipeline.cocoindex_bin, pipeline.py:45) falls back to shutil.which; the async path (server.run_refresh_pipeline, server.py:425) checked only Path(sys.executable).parent / "cocoindex".

Fix

server.run_refresh_pipeline now reuses the shared pipeline.cocoindex_bin() helper (imported as resolve_cocoindex_bin) instead of hardcoding the next-to-python path. Both paths now resolve cocoindex identically. The not-found message now names both locations checked.

Tests

  • test_cocoindex_bin_falls_back_to_path — unit guard on the helper's PATH fallback (shutil.which).
  • test_refresh_pipeline_resolves_cocoindex_via_path_not_next_to_python — regression: with vector_stack_installed=True and cocoindex reachable only via PATH, run_refresh_pipeline spawns cocoindex instead of short-circuiting to the not-found failure.

Verification

  • tests/package/test_graph_only_boot.py — 6 passed
  • tests/package/ tests/mcp/ — 691 passed, 5 skipped
  • Full suite — 1295 passed, 14 skipped (6 warnings are pre-existing: lancedb table_names() deprecation, an unrelated FastMCP coroutine warning)

Workaround for users on existing installs (before this ships)

reprocess --graph-only && reprocess --vectors-only, or reinstall cocoindex into the same venv as java-codebase-rag.

🤖 Generated with Claude Code

`reprocess` (no flags) routed through `server.run_refresh_pipeline`, which
hardcoded `Path(sys.executable).parent / "cocoindex"` and ignored PATH —
unlike the sync path (`pipeline.cocoindex_bin`) used by init/increment/
`reprocess --vectors-only`, which falls back to `shutil.which`. So a legit
console-script location (e.g. `~/.local/bin` from `pip install --user`)
made `reprocess` fail with "cocoindex not found next to Python" while every
sibling command succeeded on the same install.

Reuse the shared `cocoindex_bin()` helper so both paths resolve identically,
and clarify the not-found message to name both locations checked.

Co-Authored-By: Claude <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit a640ffd into master Jul 10, 2026
4 checks passed
@HumanBean17 HumanBean17 deleted the fix/reprocess-cocoindex-path-fallback branch July 10, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant