audit-log trailer + pre-commit stash/restore: silent staged-file swap on conventional-commits retry #1
Loading…
Add table
Add a link
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?
Originally filed by @coilysiren on 2026-05-23T06:18:38Z - https://github.com/coilysiren/coily/issues/333
Problem
In an agentic-os-kai session today, pre-commit's stash/restore-unstaged dance interacted badly with the
coily audit-log trailerhook and silently swapped which file ended up committed.Sequence:
.agents/skills/coding-otel-a2a-relay/SKILL.md, new) and an unstaged file (config/mcporter.json, modified).coily git commit -F msg.txtran. pre-commit stashed the unstagedconfig/mcporter.json, ran all hooks against the staged skill, all passed.conventional-commitshook rejected the commit message subject ("skill:" not in the allowed type list).config/mcporter.jsonto the working tree.config/mcporter.jsononly. The skill was back to untracked.End state: 9b7ccb1 closed #757 with the wrong file. The skill stayed uncommitted on disk. Required #759 as a re-do.
Hypothesis
The
coily audit-log trailerhook runs in the second pass and may re-stage the working tree (to append its trailer to the commit). When it re-stages, it picks up whatever is in the working tree, not what was originally staged. After the restore, the working tree had the mcporter.json change unstaged plus the skill staged. Something in the second pass dropped the skill from staging and added mcporter.json instead.Fix candidates
commit-msghook (operates only on the message), not apre-commithook that touches the index.Reproducer sketch
Why this matters
Silent file-swap during commit is the worst class of pre-commit bug. The user sees "Passed" and "[main hash] ...", trusts it, pushes. Two pushes later they notice the wrong content is on the wire. In this session: skill missed Windows-side Claude entirely, requiring a follow-up issue and a second commit.
Out of scope