# Keep the merge button: let the agent prepare, and a person merge

By default, CodeHerder agents merge their own work. Some teams want a person to press the button. Here is how to set that up, and what the agent does meanwhile.

Source: https://codeherder.com/blog/keep-the-merge-button/

November 24, 2026 · The CodeHerder team · 4 min read

- [workflow](https://codeherder.com/blog/topics/workflow/)
- [quality](https://codeherder.com/blog/topics/quality/)

By default, a CodeHerder agent merges its own pull request. Review checks the code first. No person has to approve it.

Some teams do not want that. A developer wants to read the diff before it lands. A leader needs a name on every merge. Both want the agent to stay useful until then.

You can have both. The agent keeps the request ready. A person presses merge.

## Turn it on

The setting is `externally_merged`. You put it on the `merge` stage of a workflow of your own:

```
{ "name": "merge", "stage": "merge", "class": "doing", "externally_merged": true, "to": ["done", "code"] }
```

Three facts to know:

- An admin or owner sets it.
- Your plan must include custom workflows. That means the Starter plan or higher. See [plans and limits](https://codeherder.com/docs/plans-and-limits/).
- You set it from the CLI. The web app has no toggle. An agent cannot set it.

The full workflow file is in the guide to [waiting for a merge](https://codeherder.com/docs/waiting-for-a-merge/).

## What the agent does

The agent never merges. It does not move the task forward either.

It makes the request ready. It fixes conflicts. It makes the small changes that a review asks for. It hands larger work back to the `code` stage. Then it blocks the task on the request and stops.

While it waits, the agent costs nothing. No session runs.

## What wakes the task

A blocked task wakes on these events:

- The request merges. The task moves on, and no agent runs.
- The request closes without a merge. The agent does not reopen it. It asks a person.
- The pipeline fails.
- The request has a conflict.
- The merge queue removes the request. The agent does not queue it again. It asks a person, or it fixes a real defect.
- A reviewer adds a new comment or review.

These events do not wake it:

- An approval. You approved the code, so nothing needs fixing.
- A green pipeline. Nothing needs fixing here either.
- A comment from a bot that you set to drop.

CodeHerder waits until the newest comment is 90 seconds old. So one review is one wake, not ten. The rules for bots are in [integrations](https://codeherder.com/docs/integrations/). The rules for waking are in [blockers](https://codeherder.com/docs/blockers/).

## Reply on the pull request

The agent can post a task comment to the pull request. This is off by default. A workspace admin turns it on in Settings, or with `ch workspace edit --host-comment-writeback true`.

CodeHerder never posts on the host by itself. Each comment is a choice. `ch task comment <id> --to-host` adds a new comment to the request. To answer in the reviewer’s thread, the agent adds `--reply-to <commentId>`. On GitLab, the reply goes in the same discussion. On GitHub, it goes in the same thread for a line comment. See [integrations](https://codeherder.com/docs/integrations/).

So a reviewer writes “this loop is slow” on a line. The agent fixes it and replies in that thread. The reviewer sees the answer in the tool they already use.

## A second way: a hold stage with rounds

There is a second way to keep a person on the merge button. Use it instead of the `externally_merged` setup. The two do not stack.

In this setup, the last stage is a merge-hold stage. No agent runs there. It waits for a person to merge. You add a `send_back` setting to that stage. You set it from the CLI, because the web app has no control for it.

When the request needs work, the task goes back to an earlier stage. A red pipeline or a new comment goes to the `send_back` target. A conflict goes to a stage that can write code, such as `code`. The agent fixes the problem, and the task returns to the hold.

Each move back counts as one round. The cap is `max_rounds`. The default is 3. The most you can set is 20. At the cap, the task blocks and asks a person what to do. It does not loop forever.

The setup is in [converge a merge request before merge](https://codeherder.com/docs/converge-an-mr-before-merge/).

## Who this suits

This suits developers who review in GitHub or GitLab. They keep their usual tool. The agent responds to their comments there.

It suits leaders who need a human sign-off. They do not have to read code. They can ask who pressed merge, and the git host answers.

It does not suit a team that wants the fastest path from idea to production. For that, keep the default. Review still checks every change.

For other ways to put a person in the path, read [who approves the agent’s work](https://codeherder.com/blog/who-approves-the-agents-work/). It covers approval gates and git-host rules.

If you have a workflow that needs a person at the end, [start with the docs](https://codeherder.com/docs/waiting-for-a-merge/). The setup takes one file and one command.
