# System events

What the agent posts automatically: PR links, commits, errors, and when a job ends.



While a job is running, Nairi also posts its own short messages into the conversation. They sit alongside the agent's replies and describe actions the agent took or lifecycle events the system noticed. In Slack they're prefixed with a gear icon; Discord, the Tasks UI, and the API show them as system messages.

Most are informational. One is load-bearing: **automatic job completion**, which ends the job and stops the agent from picking up further messages in the thread. See [When a job finishes automatically](#when-a-job-finishes-automatically) for the details.

## Pull requests the agent opens [#pull-requests-the-agent-opens]

If the agent has a GitHub repo connected and produces code changes, it auto-commits to a working branch and opens a pull request on the first turn that lands. A system message goes into the thread:

```
Agent opened a pull request: <link>
```

Follow-up messages in the same conversation can keep pushing more commits to that same branch.

## New commits on an existing PR [#new-commits-on-an-existing-pr]

When a later turn produces more changes on top of an already-open PR, the agent posts a commit link and the PR number:

```
New commit added: a1b2c3d in #42
```

Each follow-up commit gets its own system message, so you can trace exactly which reply produced which commit.

## Errors during a turn [#errors-during-a-turn]

If the agent itself hits a problem (auth failure, tool crash, model error, git push rejection, etc.), it posts the error into the thread instead of an answer:

```
nairid encountered error: <details>
```

The job's status moves to `error` and it stops processing that turn. Reply in the same thread to retry.

## When a job finishes automatically [#when-a-job-finishes-automatically]

You don't have to close the conversation yourself. Nairi watches every active job in the background and ends it when either of two things happens. The completion message lands in the thread and the agent is unassigned, so further messages there are not picked up.

### The PR Nairi opened gets closed or merged [#the-pr-nairi-opened-gets-closed-or-merged]

This is the main case. Once a job has opened a pull request, that PR's lifecycle drives the job's lifecycle. When the PR is merged, Nairi posts `Job complete - Pull request was merged`. When the PR is closed without merging, it's `Job complete - Pull request was closed`.

If you don't want to keep iterating with the agent on a piece of work, close (or merge) the PR it opened. The job ends on its own. There's no need to type anything in the thread.

The check runs roughly once a minute, so expect a short delay between closing the PR on GitHub and the completion message landing.

Only PRs the agent itself opened in this conversation drive this behavior. PRs you created manually outside of Nairi are not tracked.

### The thread has been quiet for 25 hours [#the-thread-has-been-quiet-for-25-hours]

If no one has spoken in the thread for a day, and either there is no PR or the PR is still open, the job ends with:

```
Job complete - Thread is inactive
```

This is a backstop so idle conversations don't keep an agent slot reserved indefinitely.

### Which one wins [#which-one-wins]

Inactivity always trumps PR status. If a thread has gone quiet for over 25 hours, the job ends even if the PR is still open. And if the PR is closed before the inactivity window expires, the closure wins and you get the PR-related completion message instead.

## What it looks like per channel [#what-it-looks-like-per-channel]

| Surface            | What you see                                                                                                                             |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| **Slack**          | System messages prefixed with a gear icon in the thread. A green check reaction is added to the original message when the job completes. |
| **Discord**        | Same content, posted by the bot in the same thread or channel.                                                                           |
| **Tasks UI (web)** | Inline in the conversation, marked as system messages.                                                                                   |
| **API**            | Stored as conversation messages with a `system` role. Fetch via `GET /conversations/{job_id}/messages`.                                  |

## Continuing after a job has finished [#continuing-after-a-job-has-finished]

Once a job has ended (whether because of a PR event, inactivity, or an error), the agent stops picking up new messages in that thread. To keep working, open a new conversation:

* **Slack / Discord**: mention the bot again from the main channel to open a fresh thread.
* **Tasks UI**: click **New Task**.
* **API**: call `POST /conversations/start` again.

The previous conversation stays visible in your dashboard and in the API for inspection. Slack and Discord conversations are archived; API jobs are kept so you can read back the full history any time.

## Related [#related]

* [Communicate in Slack & Discord](/help/communicating-with-agents/slack-and-discord)
* [Communicate in the web app](/help/communicating-with-agents/web-app)
* [Communicate via the API](/help/communicating-with-agents/api)
* [Connect a GitHub account](/help/integrations/github)

***

*Can't find what you're looking for? Email [support@nairi.ai](mailto:support@nairi.ai).*
