# Stop labels

A stop label pauses all work on an issue or pull request until a person removes it. The default is `needs-human`. Agents never set workflow labels themselves; the launcher applies them from the reported outcome.

Adding a stop label also stops a running agent at the next lease renewal check, within `lease-renew-minutes` (10 minutes by default). The launcher discards any early report, leaves labels unchanged and does not count the stop as a failed attempt. Its output and run record name the stop label.

Closing the issue, closing the pull request without merging, or someone else merging the pull request also stops the agent, even with `stop-labels: []`. If the run stored a report before the process stopped, the launcher settles it through the same validation and outcome transitions as a normal exit. A rejected report gets the same result as after a normal exit. The report stays recoverable if the launcher is interrupted before release. Without a stored report, the run is recorded as `blocked`, with no failed attempt or **Action needed** notice.

A run that merges its own pull request keeps running to finish its post-merge work and report. The merge must be by the launcher's GitHub account, from the assigned head or the run's base merges on it. The lease, ownership checks and agent timeout still apply. A stop label still stops the run and discards its report after this merge.

If that run ends without an accepted report, the launcher records `blocked` and posts an **Action needed** notice that post-merge work may be unfinished. This includes timeouts, crashes, rejected reports, lost ownership and launcher interruptions. A restarted launcher preserves the warning and can settle a stored report without rerunning the agent.

The check covers setup from the claim until the agent process exits. A label removed or an item reopened before the check has no effect. Once the process exits, the normal outcome transition checks apply instead of cancelling the run.

```yaml
stop-labels: [needs-human]
```

```flow
flow v0
# A stop label pauses the item until a person answers.

columns side main

box agent col=main "reports needs-human with one ask per decision"
panel stopped tone=stop
  pill needs-human
  strong "Action needed comment"
  muted "one line per ask"
panel answer tone=stop
  strong "A person answers on GitHub"
  muted "removes needs-human"
  muted "re-adds the trigger label"
end again "The agent runs again"

panel blocked col=side row=stopped tone=muted
  strong "Blocked run"
  muted "same ask, no label"
panel retry col=side row=answer tone=stop
  strong "ub-agents retry N"
  muted "with a reason"

agent --> stopped tone=stop : needs-human
stopped --> answer tone=stop
answer --> again
agent --> blocked : blocked
blocked --> retry tone=stop
retry --> again from=bottom to=left

legend
  pill tone=stop "GitHub label"
  panel tone=stop "human involved"
```

## How an agent stops

Give the role an [outcome](https://agents.uberblick.ai/docs/configuration/outcomes.md) that adds the stop label, and say in its instructions when to use it.

```yaml
implementer:
  outcomes:
    handed-off: {add: [needs-review]}
    needs-human: {add: [needs-human]}
```

The agent reports that outcome with at least one ask. The launcher adds the label and posts an **Action needed** comment that lists each ask.

```sh
ub-agents report --outcome needs-human --summary "Storage policy unclear" \
  --option "Owner: keep storage local." --option "Owner: move storage to the cloud."
```

If the outcome adds a stop label, `--handoff PR_NUMBER` may name a draft PR. The launcher puts the stop label and notice on that PR and leaves it draft. Other validation still applies. If the report is rejected, its notice keeps the asks and summary alongside the rejection reason.

## Say when a person decides

The agent stops only where its instructions tell it to. Name the decisions that belong to a person, and who answers them, in the [shared policy](https://agents.uberblick.ai/docs/configuration/instructions.md#shared-policy):

```markdown
## Human decisions

@acme/maintainers answers scope and policy questions. Stop and ask before you:
- change a public API, a database schema or a dependency
- delete data or change permissions
- choose between designs the issue leaves open
```

Then say in each role file what that means for the role:

```markdown
If the issue does not name the storage backend, or the change needs a
migration, report needs-human with one --action per decision.
```

## Resuming

Answer the asks on GitHub, remove the stop label and add the trigger label you want. A blocked run adds no label; once the blocker is fixed, run [`ub-agents retry`](https://agents.uberblick.ai/docs/commands/retry.md) or push a new commit to the pull request.

Use `ub-agents retry` to resume an item stopped during execution; it removes the stop label and restores the selected agent's trigger.
Stopping for closure without a stored report needs no further action and posts no **Action needed** notice. To resume work on a closed item, reopen it before retrying.
If a run merged its own PR and left an unfinished-work notice, review and complete the remaining work before deciding the next role or handoff.

```sh
ub-agents retry 214 --reason "Chose local storage"
```

With [approvals](https://agents.uberblick.ai/docs/configuration/approvals.md) on, ub-agents also adds the stop label when an item needs a maintainer, with a comment saying what to do.

The [`ub-agents-unblock`](https://skills.uberblick.ai/skills/ub-agents-unblock) skill walks your own agent through every item waiting for a person.

## Rules

An outcome may add a stop label but never remove one. `ub-agents doctor --offline` rejects it.

## Key reference

`stop-labels` accepts a label string or a list of labels; the default is `[needs-human]`.
Use `[]` to configure none. See [claim election](https://github.com/uberblick-ai/ub-agents/blob/main/docs/coordination.md#claim-election)
for cancellation checks and [explicit outcomes](https://github.com/uberblick-ai/ub-agents/blob/main/docs/coordination.md#explicit-outcomes)
for stops during transitions.
