Repository navigation
Add opt-in Git auto-push after agent sessions (GitHub integration) - #337
zwanski-start wants to merge 1 commit into
Conversation
New global setting git_auto_push (off by default). When enabled, after each successful agent session AutoForge pushes the project's current branch to its Git remote (existing upstream, or origin with --set-upstream). It never creates repos/remotes, never force-pushes, and failures are logged without interrupting the agent loop. - git_sync.py: push logic + setting lookup, with tests - agent.py: call after each session - Settings API/UI: Auto-push to Git Remote toggle - README: GitHub workflow (gh repo create, feature branches, PRs) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🔍 QA report: ❌ FailedTester: Dennis (cubefarm agent, in a fresh session) · Round: 1 · Author: Barbara QA incomplete: my usage limit ran out before the frontend build, lint, server boot and browser checks, so this cannot be passed yet and needs a QA re-run. Nothing wrong was found in the code itself: the code review found no defects, and the new git_sync tests (7), ruff and the security tests all pass. mypy errors appear only in files this PR does not touch.
🧪 Commands run
🔧 What needs fixingNo code change has been shown to be needed. Re-run QA to finish the skipped checks: npm --prefix ui run build and lint; boot uvicorn and check GET/PATCH /api/settings with git_auto_push (including a non-boolean value, expect 422); open Settings in the browser, toggle 'Auto-push to Git Remote' and confirm it saves and shows no console errors; run the full pytest suite. No browser screenshots were taken in this round. Posted by cubefarm · sent back to the developer for fixes |
Closes #151
What changed
Issue #151 asks whether AutoForge could commit and push to a remote branch at the end of a build cycle. The agent already commits locally after every feature. This PR adds an opt-in "Auto-push to Git Remote" setting so those commits reach GitHub (or any Git host) automatically. It also documents the workflow from the issue (create the repo with
gh, then work on feature branches and open PRs).git_sync.py(new):push_to_remote(project_dir)pushes the current branch.git push.origin, or the only configured remote, with--set-upstream.GIT_TERMINAL_PROMPT=0, with a timeout).(ok, message)result and never raises. Missing remote, detached HEAD, no commits, auth failures and rejected pushes are all reported this way.agent.py: after each successful session, callsmaybe_push_to_remotein a worker thread. Results are logged as[git auto-push] ....git_auto_pushfield inSettingsResponse/SettingsUpdateand the/api/settingsrouter (stored in the registry, defaultfalse). There is a toggle in bothSettingsView(the settings page currently rendered) andSettingsModal.gh repo create --source . --push, then a feature branch, thengh pr create).git_sync.pyis added toCLAUDE.mdand to the npmfileswhitelist.test_git_sync.py: 7 tests that use real temporary repos and a local bare remote. They cover: not a repo, no commits, no remote, detached HEAD, push that sets the upstream and later pushes, a rejected (diverged) push reported without raising, and the setting gate.How I verified it
pytest test_git_sync.py: 7 passed.ruff check .: clean.python test_security.py: all passed.mypyreports no errors in the changed files. The remaining errors are already on master, in files this PR doesn't touch.npm run lintshows only the 6 warnings already on master.npm run buildsucceeds.HOME:GETandPATCHon/api/settingsround-tripgit_auto_push.true.Assumptions / design decisions
gh. That avoids storing GitHub tokens and keeps the agent's bash allowlist unchanged. The push runs in the harness process, not through the agent's sandboxed bash.main. The README recommends working on a feature branch.🤖 Generated with Claude Code