Skip to content

fix(sessions): commit as the deployment's bot in every agent session - #545

Merged
artempartos merged 2 commits into
developfrom
artempartos/agent-git-identity
Oct 22, 2026
Merged

artempartos merged 2 commits into
developfrom
artempartos/agent-git-identity

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

Summary

Agent containers had no git identity. The first git commit in every session failed with Author identity unknown … unable to auto-detect email address, on GitHub, GitLab and Bitbucket alike. The agent then retried with -c user.name=… -c user.email=… and picked an author itself, so every agent commit cost an extra failed step and its author was unpredictable.

  • GitCredentials::SessionGitSetup.identity_env sets GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL and GIT_COMMITTER_NAME/GIT_COMMITTER_EMAIL to Aixle Flow <noreply@<DOMAIN>>. The domain comes from Settings.domain without its port, which is the source ApplicationMailer uses for its noreply@ sender, so a self-hosted deployment commits as its own address.
  • AgentBaseStrategy#build_env_vars adds it to every agent container, not only sessions with code-host repositories. It covers Azure DevOps repos and repositories the agent clones itself.
  • Environment instead of git config: git ranks GIT_* above user.* config and -c, so an agent cannot swap in an identity it made up. An explicit git commit --author still sets the author, and the committer stays the bot.
  • Docs: Repositories page states who the author of agent commits is.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / chore
  • Breaking change

How was this tested?

  • New test in test/services/container_strategies/agent_session_strategy_test.rb: the container env carries the four GIT_* variables, with the port dropped from the domain.
  • test/services/container_strategies/ and test/services/git_credentials/ run locally in Docker against a private database: 218 runs, 0 failures. rubocop clean on the changed files.
  • Checked by hand in the web image, with the four variables set: git commit, then git -c user.name=Agent -c [email protected] commit. Both commits come out as Aixle Flow <[email protected]> for author and committer.

The full suite runs on CI.

Checklist

  • I read CONTRIBUTING.md.
  • All my commits are signed off for the DCO (git commit -s).
  • I have signed (or will sign) the CLA when the bot prompts me — or my
    organization has executed the Corporate CLA.
  • make check_all passes locally (tests, rubocop, brakeman, eslint, typescript).
  • I added/updated tests where it makes sense.
  • I updated documentation where it makes sense.
  • User-visible changes have an entry under [Unreleased] in CHANGELOG.md.
  • My commits use clear, descriptive messages.

🤖 Generated with Claude Code

artempartos and others added 2 commits October 23, 2026 00:05
Agent containers had no git identity, so the first commit failed with
"Author identity unknown" and the agent then picked an author itself.
The identity comes from DOMAIN, so a self-hosted deployment commits as
its own noreply address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
…git-identity

* origin/develop:
  fix(pull-requests): return the GitLab head pipeline from pull_request_checks (#546)

# Conflicts:
#	CHANGELOG.md
@artempartos
artempartos merged commit 1bdd865 into develop Oct 22, 2026
16 checks passed
artempartos added a commit that referenced this pull request Nov 26, 2026
Agent sessions commit as noreply@<deployment domain> since #545, which is
[email protected] in production. The service-account match only took
*@aixle.com, so a bot-opened PR failed DCO on every agent commit that the
agent did not happen to sign off itself (#900).

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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