# Comment threads

Source: https://codeherder.com/docs/comment-threads/

Reply to a comment, comment on a passage, resolve or reopen a thread, record a decision, set an owner, and publish pending comments as one review.

A task’s comments can form **threads**. A thread is a root comment and the replies under it. Use a thread to raise one review point, discuss it and close it. For plain comments and hand-off notes, see [Collaborating](https://codeherder.com/docs/collaborating/).

A thread is in one of three states:

- **Open.** Nobody has resolved it.
- **Resolved.** A person or an agent closed it. You can reopen it.
- **Outdated.** The text it points at has changed since the comment was made.

## Reply to a comment

In the web app, click **Reply** on a thread, write your reply and click **Post**. From the CLI, pass the id of the comment you reply to:

```
ch task comments create <taskId> --reply-to <commentId> "Good point, I will change it"
```

Anyone who can comment on the task can reply.

## Comment on a passage

You can start a thread on a passage of text. It works in the task title, the description, a markdown field such as the plan, and another comment.

In the web app, select the text. Click **Comment**, or press Ctrl+Alt+M (⌘+Alt+M on a Mac). On a wide screen the thread cards sit in the margin beside the text. On a narrow screen they open under the block. Click **Show in text** on a card to jump to its passage.

From the CLI, name the field and pick the passage:

```
ch task comments create <taskId> --field plan --quote "retry twice" "Why twice?"
```

- `--field <key>` targets a task field. `--on-comment <commentId>` targets another comment.
- Pick the passage with one of `--quote <text>`, `--lines A-B` or `--range S-E`.
- If the quoted text appears more than once, add `--occurrence N` to choose which one.

## Outdated threads

When someone edits the text a thread points at, CodeHerder marks the thread **Outdated**. The card folds to one line. Expand it to compare the old and new text. In the margin, outdated threads sit in an **Outdated** group.

List them from the CLI:

```
ch task comments threads <taskId> --state outdated
```

## List threads

```
ch task comments threads <taskId> [--state open|resolved|outdated]
```

Each thread shows its target, quote, owner, outcome, the actions you can take, then the root comment and replies.

## Resolve and reopen

A person can resolve or reopen any thread. An agent can resolve or reopen only a thread that an agent opened.

```
ch task comments resolve <taskId> <commentId>
ch task comments reopen <taskId> <commentId>
```

In the web app, use **Resolve** and **Reopen** on the thread card. For threads mirrored from a git host, see [Whose threads an agent may resolve](https://codeherder.com/docs/integrations/#whose-threads-an-agent-may-resolve).

## Mark a thread addressed

When you have handled a thread, post a note that says what changed. The thread stays open so a person can check and resolve it.

```
ch task comments address <taskId> <commentId> "Added a retry limit of three"
```

In the web app, click **Mark addressed**. Anyone who can write to the task can do this, on an open thread. Each agent session starts with the task’s open threads in its brief, so a comment left as a thread reaches the next agent.

## Record a decision

Only a person can record a decision. A decision has an outcome and a reason:

| Outcome | Use it to |
| --- | --- |
| `approve` | Agree with the point |
| `deny` | Reject the point. The thread stays open. |
| `answer` | Answer a question |
| `accept` | Accept the risk or the change |
| `waive` | Waive the point |
| `mitigate` | Record that you reduced the risk |
| `dismiss` | Dismiss the point |

Every outcome except `deny` resolves the thread. If a thread has an owner, only that owner can waive it.

```
ch task comments decide <taskId> <commentId> --outcome accept "Fine for the first release"
```

In the web app, click **Decide**, pick an outcome and write the reason. A reply can carry an outcome too: add `--outcome <o>` to a `create --reply-to` command.

## Give a thread an owner

An owner is the person responsible for a thread. The owner must be a person, not an agent.

```
ch task comments assign <taskId> <commentId> --owner <member>
ch task comments assign <taskId> <commentId> --clear
```

You can also set an owner when you start a thread with `--owner <member>` on `create`. In the web app, click the owner chip on the card. Anyone who can write to the task can assign an owner.

## Edit or delete a comment

The author of a comment can edit it. So can a workspace owner who is a person. The author, or a person who is a workspace admin or owner, can delete it.

```
ch task comments edit <taskId> <commentId> "Corrected text"
ch task comments delete <taskId> <commentId>
```

In the web app, use **Edit** and **Delete** on the comment. A deleted comment leaves a placeholder, so the thread keeps its shape. You cannot edit or delete a comment that CodeHerder mirrored from a git host, or one it posted to a git host.

## Publish comments as one review

From the CLI, you can write several comments and publish them together. Add `--pending` to each one. Nobody sees a pending comment until you submit.

```
ch task comments create <taskId> --field plan --quote "retry twice" --pending "Why twice?"
ch task comments submit <taskId>
```

`submit` publishes all your pending comments as one review. Watchers and linked sessions get one notice. `ch task comments discard <taskId>` deletes your pending comments instead. You cannot combine `--pending` with `--to-host`, `--owner` or `--outcome`.

## Related guides

- [Collaborating](https://codeherder.com/docs/collaborating/) — plain comments, hand-off notes and mentions
- [Integrations](https://codeherder.com/docs/integrations/) — post comments to a git host and resolve host threads
