Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

eca__git tool calls in one assistant message run concurrently and race on index.lock

Abierto
#611 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
clojure, emacs, git
Área
backend, tooling

Línea de trabajo

Start by verifying the reported dispatch behavior in src/eca/features/chat/tool_calls.clj, especially the :add-future handling and the post-reduce join. Then trace how eca__git calls are dispatched and whether they share a repository context; the issue also notes that eca__shell_command can run Git. Done means concurrent Git writes to the same repository are serialized or fail explicitly, with tests covering the race and confirming ordinary tool calls can still run concurrently.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Describe the bug

Multiple eca__git calls in a single assistant message execute concurrently, so they race on .git/index.lock and the ref store. The failure is usually silent: the second command operates on the tree as it was before the first, and both report success.

on-tools-called! in src/eca/features/chat/tool_calls.clj reduces over the turn's tool calls and starts each approved one as a future — the :add-future action forces the delay — then moves to the next without waiting. The futures are joined in a doseq only after the reduce has started them all. So a turn containing two git calls runs two git processes against the same repo simultaneously.

That's correct and desirable for most tools. Git is the exception: its writes take exclusive locks, so concurrent invocations in one repo are never safe, even when they look independent.

To Reproduce

Get the model to emit two eca__git calls in one message, e.g.

  1. git add -A
  2. git commit --amend -F - <<'EOF' ... EOF

Observed outcomes:

  • fatal: Unable to create '.../index.lock': File exists — visible and recoverable
  • the amend silently doesn't happen, the previous commit stays in place, and both calls report success

git commit + git push has the same shape, and there the silent case pushes the pre-commit tree while reporting a normal ref update.

Expected behavior

Git writes against the same repo are serialised, or the second fails loudly instead of racing.

Doctor

ECA server: 0.160.2
Client: emacs GNU Emacs 30.2 (aarch64-apple-darwin25.6.0)
OS: Mac OS X 26.7
Java: 25.0.4

Additional context

Prompt-level rules are unreliable here. The system prompt encourages batching independent tool calls, and add + commit read as independent verbs while being one logical operation, so the judgement goes wrong exactly where it matters.

Possible approaches, increasing in precision:

  1. Serialise all eca__git calls behind a per-repo lock. Git commands are short and there's little to gain from running them concurrently.
  2. Serialise writes only. The tool's operation enum nearly classifies this already (status, diff, log, pr_view are reads), but it's LLM-supplied, so parsing the command is safer — shell-parser/approval-keys already does command parsing for approvals.
  3. Reject a second concurrent git write with an explicit error. Noisier, but it teaches the model to split the calls rather than hiding the mistake.

eca__shell_command can also run git, so it has the same exposure, though detecting it there is harder.

One caveat: the dispatch behaviour above is from reading tool_calls.clj, not from instrumenting a build. The delay/future/:add-future chain and the post-reduce join look unambiguous, but worth confirming before acting on it.

Lenguaje dominante
Clojure
Estrellas
1k
Forks
82
Merge medio
1 d 14 h
PR fusionados (30 d)
16

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de editor-code-assistant/eca

Todos los issues de editor-code-assistant/eca

Issues similares

Más issues de Clojure

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.