Why this matters
Several MokoGIT automations merge pull requests on your behalf without a human clicking the merge button. The most common is the CI-driven version-advance and bump flow on the dev base: a workflow opens a small pull request, waits for it to pass, and merges it. That merge is pushed by the forge's built-in Actions identity, a virtual system user.
A virtual user is not a real account. It has no row in the user database. MokoGIT reserves two such identities with negative IDs:
- Ghost (uid
-1) - stands in for a deleted account so old history still renders. - Actions (uid
-2, namedmokogit-actions) - the identity every CI job runs and pushes as.
Because the Actions user has no database row, a naive "look up the pushing user by ID" fails for it. That lookup sits directly on the critical path of finalizing a merge, so when a CI job pushed a merge commit, the merge commit itself landed on the base branch correctly, but the step that records the merge in the database errored out. The pull request was left open and never marked merged. Over time this stacked duplicate, apparently-unmerged bot pull requests fleet-wide and left the version-advance ladder looking stalled.
How it works
Every push in MokoGIT passes through a post-receive hook. When that push is the merge commit for a pull request, the hook runs a finalize step that: looks up the user who performed the merge (the "pusher"), then records the merge against the pull request - setting it merged, stamping the merge time and merger, closing the issue, and triggering head-branch cleanup.
The fix is in how the pusher is resolved. The hook no longer assumes the pusher is a normal database user. It branches on the user ID:
- For a negative ID (a system user such as Actions
-2or Ghost-1), it resolves the identity through the system-user path,GetPossibleUserByID, which synthesizes the correct virtual user object in memory rather than querying a table that has no such row. - For a normal positive ID, it uses the usual cached database lookup, exactly as before.
With a valid pusher object in hand, the finalize step - internally the same SetMerged routine that a human merge uses - now runs to completion for CI merges. The pull request transitions to merged, the merger is attributed to the Actions user, the linked issue closes, and the head branch is deleted under your repository's delete-after-merge setting. The CI-driven dev-base version bumps finalize and clean up after themselves rather than piling up.
The underlying resolver is deliberately forgiving. GetPossibleUserByID returns the matching reserved system user for a known negative ID, falls back to the Ghost user when a positive ID no longer exists, and only returns a hard error on a genuine database failure - so the finalize path stays robust rather than aborting on an identity edge case.
How it relates to the interrupted-merge detector
This fix removes the cause of one specific way a merge could be left open. MokoGIT also ships a separate safety net that catches the symptom regardless of cause: a scheduled detector that finds open pull requests whose head branch is already an ancestor of the base branch - the signature of a merge whose commit landed but whose finalize step was lost (tracked as #1742). That detector alerts operators and, when explicitly enabled, can finalize the already-landed merge. The two work together: this change stops the virtual-user case from happening in the first place, and the detector remains as a belt-and-suspenders catch for any future interrupted merge, from any source.
Do you need to do anything
No. This is internal forge behavior and takes effect automatically once your MokoGIT instance is on a version that includes it. There is no setting to toggle and nothing to configure. CI jobs that merge pull requests simply finalize correctly from now on.
If you maintained a workaround - for example a cleanup job that closed or re-merged the stranded automation pull requests, or a manual sweep to delete their leftover head branches - you can retire it. Any pull requests that were already stuck open before the upgrade can be finalized once by the interrupted-merge detector (or closed by hand); they will not re-accumulate.
How to confirm it is working
You do not interact with the virtual Actions user directly, but you can observe the result:
- Find an automation pull request that was merged by CI (for example a dev-base version-advance or bump pull request).
- Open it and confirm it shows as Merged, with the merger attributed to the
mokogit-actionsbot identity. - Confirm its head branch was deleted (assuming your repository has delete-after-merge enabled), rather than lingering in the branch list.
You should no longer see a growing backlog of open, apparently-unmerged bot pull requests on the dev base.
Caveats
- This change only affects how the pusher identity is resolved during merge finalization. It does not change merge policy, branch protection, or who is allowed to merge. The Actions user's ability to merge onto a protected branch is governed separately by branch protection (its merge-whitelist flag), not by this fix.
- The virtual Actions and Ghost users remain purely virtual - they are never created as database rows. They are synthesized on demand whenever a negative ID needs to be resolved.
- Head-branch auto-deletion still depends on your repository's delete-after-merge setting. If that is off, the branch is preserved after a CI merge exactly as it would be after a human merge.
- A pull request left open by this bug before the upgrade is not retroactively closed by this change alone; it is picked up by the interrupted-merge detector, or you can finalize it manually.
Get help
Open a support ticket or call (931) 820-0265.