Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions enterprise/automations/data-center-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
| `comment_deleted` | A comment is deleted |

Use `jira:issue_*` to match created, updated, and deleted together. Other Jira events, such as
worklog or sprint events, are not subscribed and never reach automations.

Check warning on line 84 in enterprise/automations/data-center-events.mdx

View check run for this annotation

Mintlify / Mintlify Validation (allhandsai) - vale-spellcheck

Vale.Spelling

Did you really mean 'worklog'?

### Bitbucket Data Center

Expand Down Expand Up @@ -149,6 +149,81 @@
Try a new automation on a test project or repository before pointing it at production work: it
runs for every event its filter matches.

## Keep a Pull Request's Review Rounds in One Conversation

By default, every matching event starts a new run in a new sandbox, with a fresh clone. For
review comments on a pull request you usually want the opposite: the agent that made the change
should receive each new comment as another message, in the sandbox that still has its checkout.

An event trigger does this when its `destination` is `continue_conversation`:

- The first matching event for a pull request starts a run. That run's conversation and sandbox
are kept for the pull request.
- Each later matching event for the same pull request is sent to that conversation as a new
message. No run is created and nothing is cloned again.
- A comment on another pull request gets its own conversation and sandbox.

The setup form does not offer this setting yet. Create the automation through the API, or create
it in the form and then update its trigger and `keep_alive` with
`PATCH /api/automation/v1/{automation_id}`.

```http
POST /api/automation/v1/preset/prompt
```

```json
{
"name": "Address review comments: ENG/payments",
"prompt": "A reviewer commented on a pull request in ENG/payments. The event is included above. Check out the pull request's source branch (pullRequest.fromRef.displayId), make the requested change, run the tests, push to that branch, and reply on the pull request with one comment that starts with [openhands]. Later review comments on the same pull request arrive as new messages in this conversation: handle each one in the working tree you already have.",
"repos": [
{
"url": "https://bitbucket.example.com/scm/eng/payments.git",
"ref": "main",
"provider": "bitbucket_data_center"
}
],
"keep_alive": true,
"trigger": {
"type": "event",
"source": "bitbucket_data_center",
"on": "pr:comment:added",
"filter": "pullRequest.toRef.repository.project.key == 'ENG' && pullRequest.toRef.repository.slug == 'payments' && comment.author.name != 'svc-openhands' && !starts_with(comment.text, '[openhands]')",
"destination": "continue_conversation",
"subject_key_expr": "join('/', [pullRequest.toRef.repository.project.key, pullRequest.toRef.repository.slug, to_string(pullRequest.id)])",
"turn_text_expr": "join('', ['New review comment from ', comment.author.name, ' on pull request #', to_string(pullRequest.id), ':\n\n', comment.text])"
}
}
```

| Field | What it does |
| --- | --- |
| `destination` | `continue_conversation` sends later events to the existing conversation. The default, `dispatch_run`, starts a new run every time. |
| `subject_key_expr` | A JMESPath expression that names what the events are about. Events with the same result share a conversation. The expression above yields `ENG/payments/42` for pull request 42. |

Check warning on line 201 in enterprise/automations/data-center-events.mdx

View check run for this annotation

Mintlify / Mintlify Validation (allhandsai) - vale-spellcheck

Vale.Spelling

Did you really mean 'JMESPath'?
| `turn_text_expr` | A JMESPath expression for the text of each later message. Always set it for Bitbucket Data Center: without it the agent receives the whole event as JSON. |

Check warning on line 202 in enterprise/automations/data-center-events.mdx

View check run for this annotation

Mintlify / Mintlify Validation (allhandsai) - vale-spellcheck

Vale.Spelling

Did you really mean 'JMESPath'?
| `keep_alive` | Keeps the sandbox after the first run finishes. Releases before 0.110.0 do not set it for you; without it the sandbox is deleted and the next comment starts over. |
| `filter` | Must exclude the automation's own replies, or every reply would trigger another message. Exclude the Bitbucket account the automation runs as (`comment.author.name`), a marker its replies start with, or both. |

The first run receives the full event with the prompt. Later messages contain only what
`turn_text_expr` produces, so put standing instructions in the prompt and tell the agent there
that more comments will follow.

### Limits

- **Paused sandboxes.** An idle sandbox is paused after the **Idle Time** set in the Admin Console
(one hour by default; 20 minutes by default on Helm installations). On releases up to 0.124.x,
an event that arrives after the pause starts a new run in a new sandbox instead of continuing
the conversation. Raise the idle time if review rounds are usually further apart than that.
- **Deleted sandboxes.** A paused sandbox is deleted after the **Deletion Time**. The next event
then starts a new run.
- **Running sandboxes per user.** Kept sandboxes count toward **Max Running Sandboxes per User**
for the account the automation runs as. When the limit is reached, that account's oldest running
sandbox is paused.
- **One automation, one source.** The conversation belongs to the automation and its event source.
A conversation started some other way, for example from a Jira issue or by an `@openhands`
mention, is not the one these events continue.
- **Editing the trigger.** The conversation is tied to the automation. Deleting and recreating the
automation starts new conversations for open pull requests.

## Which Organizations Receive Jira Events

A Jira Data Center installation is shared by the whole OpenHands Enterprise installation, so Jira
Expand Down
Loading