Skip to content

## Feature request: inject git-annex into PATH for git subprocess calls ### Bac

Feature request: inject git-annex into PATH for git subprocess calls

Background

When an agent runs git add in a DataLad-managed repo (e.g. labbox), git invokes the filter registered in .git/config:

[filter "annex"]
    process = git-annex filter-process
    smudge = git-annex smudge -- %f
    clean = git-annex smudge --clean -- %f

If git-annex is not on the agent's PATH, the filter subprocess fails with a misleading "Permission denied" error, breaking any staging operation on new files. Read-only git ops (git status, git log) are unaffected since they don't invoke filters.

Why projio's own MCP tools are fine

datalad_save, datalad_push, etc. use the full path to the datalad binary (resolved at project setup, e.g. /storage/share/python/environments/Anaconda3/envs/labpy/bin/datalad). Datalad internally resolves git-annex from its own conda env. These tools never depend on PATH.

Where it breaks

Agents that call raw git add / git commit with new files — which is the natural fallback when no MCP tool covers the operation. The error is non-obvious and hard to diagnose without knowing the DataLad/git-annex setup.

Proposed fix

At MCP server startup (or lazily on first git call), detect the git-annex binary by looking relative to the known datalad binary: $(dirname $DATALAD)/git-annex. If found, prepend its parent directory to the PATH used for all git subprocess calls within projio.

This way agents never need to know about the conda env layout — git ops just work.

Alternative (lower effort)

Expose the git-annex path in runtime_conventions() output under a git_annex_bin key with a note explaining that agents must prepend $(dirname git_annex_bin) to PATH before calling git directly. Less transparent but trivial to implement.

Context

Discovered while merging gitlab/master MATLAB content into the labbox repo. The workaround was:

PATH="/storage/share/python/environments/Anaconda3/envs/labpy/bin:$PATH" git add ...


Source context: labbox

Labbox (labbox): sirotalab MATLAB toolbox

Recent commits:

4b9ab32 Import basic_unit_analysis from gitlab/master into +Labbox/Tutorials/
0381c94 Add dependency links between docs task notes
26940cf Add 5 focused task notes for labbox docs improvements