Skip to content

feat: sign agent-authored commits with a Co-Authored-By trailer - #121

Merged
thefullgc merged 2 commits into
mainfrom
feat/pizza-co-author
Nov 15, 2026
Merged

thefullgc merged 2 commits into
mainfrom
feat/pizza-co-author

Conversation

@thefullgc

Copy link
Copy Markdown
Collaborator

What

Like Cursor, Claude Code and Codex, Pizza now attributes the commits it creates. Every git commit the agent runs gets a trailer:

Co-Authored-By: pizza-agent[bot] <356990035+pizza-agent[bot]@users.noreply.github.com>

which GitHub renders as a clickable co-author linking to the Pizza Agent app.

How

A spawnHook on the cli shell fallback deterministically appends --trailer to top-level git commit invocations — not a prompt instruction (cannot be forgotten or hallucinated), and no hook files written into user repos.

  • src/core/git-attribution.ts — POSIX-aware rewrite using the shared shell-word mask: env prefixes (FOO=1, env, command), git global options (-C, -c, --git-dir=), chains/pipes/&/newlines, mid-command redirects. Conservatively skips --dry-run, -- pathspec separators, unclosed $(/subshells, commands already carrying a co-authored-by trailer, and segments ending in a redirect operator. Requires git ≥ 2.32 (--trailer flag); detected once per process.
  • src/core/exec/shell-words.ts — export computeUnquotedCodeMask; add splitShellCommands (lossless, separator-preserving split incl. & and newlines) and hasUnquotedShellChar.
  • settings.gitCommitCoAuthor (default true) to opt out.
  • Prompt guideline tells the model the trailer is automatic so it doesn't add a duplicate (git dedupes identical trailers anyway — verified on --amend).

The hook composes after any user-supplied spawnHook, so SDK/extension callers see the final command.

Tests

test/git-attribution.test.ts — 18 cases covering chaining, pipes, redirects, env prefixes, --/--dry-run skips, command substitution, and mid-line redirects. E2E verified in a scratch repo (trailer written; dedup on amend).

thefullgc and others added 2 commits November 15, 2026 22:19
Like Cursor, Claude Code and Codex, Pizza now attributes the commits it
creates. A shell spawnHook deterministically appends the
Co-Authored-By trailer for the pizza-agent GitHub App's bot identity
to top-level `git commit` invocations — no hook files written into user
repos, no prompt reliance. GitHub renders it as a clickable co-author
linking to https://github.com/apps/pizza-agent.

- src/core/git-attribution.ts: POSIX-aware rewrite (env prefixes, git
  global options, chains, pipes, background ops); conservatively skips
  --dry-run, '--' pathspec separators, command substitutions, existing
  co-author trailers, and redirect-at-tail segments. Requires git >= 2.32.
- src/core/exec/shell-words.ts: export computeUnquotedCodeMask, add
  splitShellCommands (lossless, separator-preserving incl. & and newlines)
  and hasUnquotedShellChar.
- settings.gitCommitCoAuthor (default true) to opt out.
- Prompt guideline tells the model the trailer is automatic so it does
  not add a duplicate (git dedupes identical trailers anyway).

Co-Authored-By: pizza-agent[bot] <356990035+pizza-agent[bot]@users.noreply.github.com>
Adds a Website row (Globe icon, opens externally) above the repository
row in Settings → About, with en/zh-CN labels.

Co-Authored-By: pizza-agent[bot] <356990035+pizza-agent[bot]@users.noreply.github.com>
@thefullgc
thefullgc merged commit 61a7cd1 into main Nov 15, 2026
7 checks passed
@thefullgc
thefullgc deleted the feat/pizza-co-author branch November 15, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant