Pin the agent Git attribution interpreter off the pyenv shim #823
Labels
No labels
burndown-2026-06
burndown-2026-08
autonomy
async-consult
autonomy
epic
autonomy
headless
autonomy
live-collab
coherence-core
priority
P0
priority
P1
priority
P2
priority
P3
priority
P4
qa-fixture
role/advocate
role/director
role/exec
role/frontend
role/gamedev
role/human
role/platform
role/qa
role/science
role/sysadmin
state
ambient
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
coilyco-flight-deck/infrastructure#823
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
agent_git_attribution.pyis deployed to~/.local/share/agent-git-attribution/and symlinked asgiton PATH, then executed directly. Its shebang is therefore the interpreter selection, and it runs once per agent Git call.The shebang is
#!/usr/bin/env python3, which on a host with pyenv resolves to~/.pyenv/shims/python3. Shim resolution dominates the run.Measured on kais-macbook-pro, ten runs each:
/usr/bin/env python3/usr/bin/python3Roughly 190ms of pure overhead on every agent Git call, paid to resolve an interpreter the fleet has already standardized on elsewhere.
History
This was diagnosed on 2026-08-12 on branch
aos/claude/git-attribution-pin-interpreterand left as an uncommittedgit stashentry. The branch carries no commits and is now 13 behindmain, so the stash is the entire body of work. There is no issue for it. This issue adopts that work so it stops living in a stash.Change
Take the stashed shebang pin, plus a guard the original did not have.
The role assumes
/usr/bin/python3exists but never states it. That assumption holds today becauseansible/inventory/fleet.ymlandansible/inventory/local.ymlboth pinansible_python_interpreter: /usr/bin/python3, so Ansible itself runs under that interpreter on every host this role reaches. The assumption breaks if a host overrides the interpreter, and the failure mode is bad out of proportion to the cause: the shim isgit, so a missing interpreter breaks Git for agents on that host.Add an assertion before the script is installed, so a host that cannot satisfy the pin fails the converge loudly and keeps its existing working Git rather than receiving a shim that cannot execute.
A silent fallback to
env python3was considered and rejected. It would restore the 190ms with no signal that the pin had not applied. A converge-time failure is the safer shape for something on the Git hot path.Resolving the shebang from
ansible_python_interpreterat converge time was also considered. It is the cleaner design, but it requires convertingfiles/agent_git_attribution.pyinto a template, andscripts/agent_git_attribution_test.pyimports that exact path throughimportlib. That is a larger change to adjacent code and is left for a follow-up.Scope
The role reaches non-server hosts only, through the
claude-hooksandcodex-hooksdependencies gated onhostclass_server not in group_names. That is the Mac and the WSL towers.kai-serverandser8are excluded. Native Windows is not converged yet and stays blocked on #356.Verification
/usr/bin/python3, which is 3.9.6.from __future__ import annotationsis present, and nothing evaluates annotations at runtime.ward exec ansible-lintandward exec pre-commit.Known gap:
scripts/agent_git_attribution_test.pydoes not complete under either 3.9.6 or 3.13.2 in an agent session, hanging past 45 seconds in both. That predates this change and is interpreter-independent, so it is not evidence about the pin, but it does mean the suite did not gate this work.Note
Apple's
/usr/bin/python3is 3.9.6, which is end of life upstream. It runs this script correctly today. Moving the pin to a maintained interpreter is a separate question from getting off the pyenv shim.