docs(agents): a cherry-pick keeps its source's author, and the check is per own commit (improvise-1xfb.3)
The wrapper's contract drops cherry-pick, because git ignores GIT_AUTHOR_NAME there, and rule 8's cherry-pick -x should keep who wrote the commit. A new case asserts it. The pre-push check now asks that every commit you made names your actor, since a stacked or cherry-picked commit keeps its own author. Answers the Codex P2 and the review on PR #310. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
committed by
Edward Langley
parent
256057b7f8
commit
0539fb37ac
@@ -221,8 +221,7 @@ out on purpose:
|
||||
(matching BEADS_ACTOR)" (2026-09-25; improvise-1xfb.3). Make every commit
|
||||
through the wrapper, merge commits included:
|
||||
`BEADS_ACTOR=<your actor> scripts/agent-git commit …`, and the same for
|
||||
`merge` or `cherry-pick`. The wrapper sets the author name for that one
|
||||
command, and it refuses (exit 2) when `BEADS_ACTOR` is unset or empty. It
|
||||
`merge`. The wrapper sets the author name for that one command, and it refuses (exit 2) when `BEADS_ACTOR` is unset or empty. It
|
||||
reads `BEADS_ACTOR` from its own environment, so the prefix works in a shell
|
||||
that keeps nothing between commands.
|
||||
- **The author email, the committer and the `Co-Authored-By` trailer stay as
|
||||
@@ -235,8 +234,12 @@ out on purpose:
|
||||
`context/test-evidence/tooling.md`.
|
||||
- A plain `git commit --amend` keeps the author it amends, so amend with
|
||||
plain git or with the wrapper.
|
||||
- **A cherry-pick keeps its source's author**, through the wrapper or not:
|
||||
git ignores `GIT_AUTHOR_NAME` there. That is right, because rule 8 allows
|
||||
only `cherry-pick -x` of commits that keep whoever wrote them.
|
||||
- Before you push, check `git log --format='%an <%ae> | %cn' <pinned
|
||||
SHA>..HEAD`. Every line must name your actor.
|
||||
SHA>..HEAD`. Every commit **you made** must name your actor. A
|
||||
cherry-picked commit, or one from a PR you stack on, keeps its own author.
|
||||
- **The format is a proposal.** `Claude (<BEADS_ACTOR>)` is the default
|
||||
proposed on improvise-1xfb.3's PR. The user may change it there. The format
|
||||
lives in `scripts/agent-git` and nowhere else.
|
||||
|
||||
@@ -1789,7 +1789,16 @@ commit reads `Claude (t) <o@x> | Owner`. The same probe showed that a merge
|
||||
takes `GIT_AUTHOR_NAME` too, and that a plain `--amend` keeps the author it
|
||||
amends.
|
||||
|
||||
**Rivals.**
|
||||
**A cherry-pick keeps its source's author** (Codex P2 and the review on PR
|
||||
#310). The first version of the rule listed `cherry-pick` among the wrapper's
|
||||
subcommands, but git ignores `GIT_AUTHOR_NAME` there. That is the behaviour
|
||||
this repo wants, since rule 8 allows only `cherry-pick -x` of commits that keep
|
||||
their own author. So the contract names only `commit` and `merge`. The case "a
|
||||
cherry-pick keeps its source's author" picks a commit authored `Claude
|
||||
(agent-b2)` with the wrapper set to `agent-a1`, and asserts `agent-b2`. A pick
|
||||
that failed would leave the owner-authored base at HEAD and fail the case too.
|
||||
|
||||
**Rivals** (run against the first eleven cases).
|
||||
- **`exec git -c user.name="Claude ($BEADS_ACTOR)" "$@"`**: 10 passed,
|
||||
1 failed, "the committer is untouched" (got `Claude (agent-a1)`).
|
||||
- **The refusal removed** (`if false`): 7 passed, 4 failed. They are "an unset
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ set -euo pipefail
|
||||
|
||||
if [ -z "${BEADS_ACTOR:-}" ]; then
|
||||
echo 'agent-git: BEADS_ACTOR is unset; refusing to author as the owner' >&2
|
||||
echo 'usage: BEADS_ACTOR=<actor> scripts/agent-git commit|merge|cherry-pick ...' >&2
|
||||
echo 'usage: BEADS_ACTOR=<actor> scripts/agent-git commit|merge ...' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ BEADS_ACTOR=agent-a1 "$RUN" merge -q --no-edit side
|
||||
same "a merge commit is authored by the agent" 'Claude (agent-a1)' "$(git log -1 --format=%an)"
|
||||
same "the merge has two parents" 2 "$(git log -1 --format=%P | wc -w | tr -d ' ')"
|
||||
|
||||
# A cherry-pick keeps its source's author, whatever the wrapper sets.
|
||||
git checkout -q -b pick "$base"
|
||||
BEADS_ACTOR=agent-a1 "$RUN" cherry-pick -x --allow-empty "$(git rev-parse side)" > /dev/null 2>&1
|
||||
same "a cherry-pick keeps its source's author" 'Claude (agent-b2)' "$(git log -1 --format=%an)"
|
||||
git checkout -q -
|
||||
|
||||
# git's own failure is passed through, not swallowed.
|
||||
BEADS_ACTOR=agent-a1 "$RUN" commit -q -m nothing-staged > /dev/null 2>&1
|
||||
rc=$?
|
||||
|
||||
Reference in New Issue
Block a user