Repository navigation
Add opt-in auto-push of agent commits to git remote - #282
Open
zwanski-start wants to merge 1 commit into
Open
zwanski-start wants to merge 1 commit into
zwanski-start wants to merge 1 commit into
Conversation
New opt-in 'Auto-push to Git Remote' setting (Settings > Version Control, or AUTOFORGE_GIT_AUTO_PUSH=1). After each successful coding session the orchestrator pushes the project's current branch to its upstream, or to origin with --set-upstream. Never force-pushes, never creates remotes, runs non-interactively with a timeout, and failures are logged with a [GIT] prefix without affecting the agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
🔍 QA report: ✅ PassedTester: Barbara (cubefarm agent, in a fresh session) · Round: 1 · Author: Dennis Opt-in auto-push works as described and meets issue #151. The push helper never force-pushes, skips safely without an upstream, origin or branch, can't hang on a password prompt, and a password embedded in the remote URL does not appear in its log line. The setting defaults to off, persists through the Settings API and the new Version Control card, and the env var overrides it. Lint, build and the 11 new tests pass; the pytest failures and mypy errors are the same as on master.
🧪 Commands run
No browser screenshots were taken in this round. Posted by cubefarm · merges automatically once GitHub's checks pass |
cabana8471-arch
pushed a commit
to cabana8471-arch/autoforge
that referenced
this pull request
Nov 8, 2026
After a coding session ends successfully, the project's current branch can be pushed to its git remote, so the agent's commits show up on GitHub without manual steps. Adaptations on integration (the agent can run any git command in the project, and the push runs in the orchestrator, outside its sandbox): - per project and off by default (Settings > Version Control for the selected project) instead of a global toggle / AUTOFORGE_GIT_AUTO_PUSH; turning it on stores the remote's current URL, which the page shows; - every push goes explicitly to the stored URL (full refspec, no force) and is refused when `git remote get-url <remote>` differs from it; - refused when the repo-local config sets url.* (insteadOf/pushInsteadOf rewrite even an explicit URL), core.sshCommand/askpass/hooksPath/ fsmonitor/gitProxy, credential.*, include.*/includeIf.*, http.* or gpg.*; - hooks never run (-c core.hooksPath=/dev/null, --no-verify), push.gpgSign and submodule recursion are off; - the push runs in a background thread after _signal_agent_completed(); - git_sync.py added to package.json files; - tests: changed remote URL, stored URL used over a planted pushurl, each unsafe key, a pre-push hook writing a marker does not run, no force, the orchestrator does not wait for the push, REST API; each guard checked by removing it (the matching tests fail). Integrates AutoForgeAI#282 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeH26pcsqoxPb3CDs8g1VN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #151
Issue #151 asks whether AutoForge could push to a remote automatically when a feature build cycle ends. This PR adds that as an opt-in setting and documents the feature-branch workflow described in the issue.
What changed
git_sync.py(new):push_current_branch(project_dir)pushes the current branch to its upstream. If the branch has no upstream, it pushes tooriginwith--set-upstream. Rules:origin.GIT_TERMINAL_PROMPT=0) with a 60s timeout. A lock serializes concurrent pushes from parallel agents.is_auto_push_enabled()readsAUTOFORGE_GIT_AUTO_PUSHfirst, then thegit_auto_pushregistry setting. Default is off.parallel_orchestrator.py: after a coding agent exits with code 0, it calls the push helper if the setting is on. The result is printed as a[GIT] ...log line, so it shows up in the UI log stream, where existing token redaction applies. Errors are never fatal.server/schemas.py,server/routers/settings.py): adds thegit_auto_pushbool to GET/PATCH.SettingsView.tsx) with an "Auto-push to Git Remote" switch. The same toggle is also inSettingsModal.tsx, which is not currently rendered, so it stays in sync with the page as its header comment says. Types and defaults are updated.gh repo create --source=. --pushsetup and the feature-branch workflow. CLAUDE.md lists the new module and test.Verification
test_git_sync.py(11 tests) uses real temp repos and a local bare remote. It covers: not a repo, no remote, push to origin plus upstream setup, a follow-up push through the upstream, a feature branch, detached HEAD, a rejected non-fast-forward push (it checks the remote is not overwritten), and env var / setting precedence.ruff check .is clean.mypyreports no errors in the touched files (the other errors are pre-existing).test_security.py,test_client.py,test_dependency_resolver.pyandtest_rate_limit_utils.pyall pass.npm run lintshows 0 errors andnpm run buildsucceeds.GET /api/settingsreturns"git_auto_push": true).Assumptions
ghcommands.gh auth setup-git, SSH key, or a credential helper).🤖 Generated with Claude Code