trace: a commit made in the same Bash call as the edit loses the session trailer and attestation

Ouverte
#3,625 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@waveywaves y travaille déjà.

Depuis le 15/10/2026.

  • #3631 par @waveywaves — ouverte

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
15/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
bash, git, go

Piste de recherche

Start with HandleCommitMsgHook, which matches staged files against the AI line attributions, and with the PreToolUse and PostToolUse hooks for Bash that record those attributions. The race is that the commit-msg hook runs before PostToolUse writes the attribution, so check the .git/chainloop-trace/commits/<sha>.json output for a missing session_ids. Open pull request #3631 already targets this, so review it before starting. Done means a commit made in the same Bash call carries the session trailer, or pre-push warns when a session's changes are not in any pushed commit.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug component/CLI trace-provider

What happens

When Claude Code changes a file and commits it in the same Bash tool call, the commit gets no Chainloop-Trace-Sessions trailer. The pre-push hook then finds no traced commit, and the push gives no AI coding session attestation. The session is lost without any message.

Example of a single Bash call that loses the session:

echo "change" >> README.md && git add README.md && git commit -m "..." && git push origin my-branch

Why

Trace records the lines that a Bash call changed in the PostToolUse hook, so only after the whole call ends. The git hooks run while the call is still running:

  1. commit-msg runs. HandleCommitMsgHook matches the staged files against the AI line attributions, but the attribution for this call does not exist yet. No trailer.
  2. pre-push runs and sees no traced commit. No attestation.
  3. The Bash call ends, and PostToolUse records the attribution for the session. It is too late for this commit.

In the run where we saw this, the commit time was 17:02:07 and the attribution recorded_at was 17:02:08. The record in .git/chainloop-trace/commits/<sha>.json has no session_ids, and the attribution stays pending.

An edit with the Edit or Write tool, followed by a separate Bash commit, works as expected, because PostToolUse of the edit runs before the commit.

Expected

A commit made inside a Bash tool call carries the session trailer when the same call changed the committed files, and the push gives an attestation.

Ideas

  • In PreToolUse for Bash, mark the session as having a Bash call in progress. commit-msg could then compare the staged files with the PreToolUse snapshot and attribute the changes to that session.
  • At minimum, have pre-push warn when a session recorded changes that no pushed commit carries, so the loss is visible.

Environment

Chainloop CLI 1.122.0, Claude Code in a Docker Sandbox (sbx v0.47, clone mode). The behavior does not depend on the sandbox.

Langage dominant
Go
Étoiles
582
Forks
61
Merge moyen
12 h 47 min
PR mergées (30 j)
137

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de chainloop-dev/chainloop

Toutes les issues de chainloop-dev/chainloop

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.