Auto-commit & auto-push
Overview
Auto-commit and auto-push let KanbanAI automatically commit and optionally push Attempt changes when an Attempt finishes successfully, based on per-project settings.Configuration
- Project-level flags (repository defaults):
- Auto-commit on finish (
autoCommitOnFinish):- When enabled, a successful Attempt triggers an automatic commit in the Attempt worktree.
- Auto-push after auto-commit (
autoPushOnAutocommit):- When enabled alongside auto-commit, the auto-commit handler also pushes the branch to the preferred remote.
- Auto-commit on finish (
- These settings are managed by the project settings service and can be edited in the project Settings UI.
Event flow
Git listeners orchestrate the automation:-
attempt.completedlistener:- Fires whenever an Attempt finishes.
- If the Attempt status is anything other than
succeeded, it returns. - It loads project settings based on the board ID.
- If
autoCommitOnFinishis disabled, it returns. - Otherwise, it publishes
attempt.autocommit.requestedwith:attemptId,boardId,cardId.worktreePath.profileId(if present).autoPushOnAutocommit.preferredRemote.
-
attempt.autocommit.requestedlistener:- Invokes
performAutoCommitwith the payload. performAutoCommit:- Creates a commit in the Attempt worktree using content derived from the Attempt (e.g. last assistant message).
- Optionally pushes the branch to
preferredRemotewhenautoPushOnAutocommitis enabled. - Emits relevant
git.*events (commit, status, push) so the UI can refresh.
- Auto-commit runs while the Attempt still has an active worktree; if the card is later moved to Done and
workspace cleanup runs, the
attempts.worktree_pathcolumn for that Attempt is set toNULLand subsequent attempt-scoped Git operations will return a409“No worktree for attempt” problem response.
- Invokes
Auto-push conflict recovery
When auto-push is enabled and a push operation fails due to a conflict (non-fast-forward rejection), the system automatically attempts to recover:Retry workflow
- Initial push fails: The system detects a push conflict based on the error message (e.g., “rejected - non-fast-forward”).
- Pull with rebase: Executes
git pull --rebaseto fetch and rebase local commits on top of the remote changes. - Rebase succeeds: If the rebase completes without conflicts, the system retries the push operation.
- Rebase has conflicts: If conflicts are detected during rebase, the rebase is aborted gracefully and the push is skipped.
Behavior and guarantees
- Single retry: The system attempts rebase and retry once only per auto-push operation.
- Graceful degradation: Auto-commit always succeeds if changes exist; auto-push is best-effort.
- Conflict detection: The system detects conflicts during rebase using pattern matching on error output.
- Clean state: If rebase conflicts occur,
git rebase --abortensures the worktree returns to a clean state. - Non-blocking: Push failures (including retry failures) do not fail the overall Attempt.
Event notifications
The retry process emits the following events for real-time UI updates:git.rebase.started: Published when pull-rebase beginsgit.rebase.completed: Published when rebase succeedsgit.rebase.aborted: Published when rebase has conflicts or fails (with reason: “conflicts” or “error”)git.push.retried: Published when retry push is attemptedgit.push.failed: Published when push fails (including after retry exhaustion)
Usage considerations
- Auto-commit and auto-push are best suited for:
- Branches dedicated to Attempts/automation.
- Teams that want Attempts to leave behind a clean, ready-to-review branch after success.
- For more manual workflows:
- Keep auto-commit disabled.
- Use the Commit dialog and push/PR flows from the UI instead.
core/git-integration.mdfor commit/push endpoints and git events.core/ai-attempts.mdfor Attempt lifecycle and worktree behavior.