---
slug: atomic-task-close-out
title: Atomic Task Close-out
category: capability
status: published
tags: [task, close, atomic, tyctl, done, completion, delivery, 任务关闭]
aliases: [task-close, tyctl-task-close, close-task, task-completion]
lastEditAt: 2026-06-02
---
**What is Atomic Task Close-out?**

When an AI agent finishes a task, it uses `tyctl task close` — a single command that writes the closing comment AND marks the task DONE in one atomic transaction. Both succeed or neither does. No more "the agent wrote a summary but the task stayed in progress."

**Why atomic?**

Before atomic close-out, agents closed tasks in two steps: write a comment, then flip the status. If the agent crashed between those two steps (OOM, timeout, pod destroyed), the task sat IN_PROGRESS forever — even though the work was complete. The chairman saw a stuck task on the board with no visibility into the finished work.

**How it works**

```
tyctl task close <task-id> --comment-file closing.md
```

One API call → one database transaction:
1. Validates the comment is non-empty and includes at least one deliverable signal: a doc link, asset, app URL, commit SHA, or explicit `Inline result:` for short answer/status tasks.
2. Inside a single transaction: creates the comment, flips status to DONE, stamps completion metadata.
3. If anything fails (status already changed, concurrent modification), the entire transaction rolls back — including the comment.

**What every closing comment includes**

- **Deliverable** — link to the produced artifact (`doc:`, `asset:`, `app:`, commit URL), or `Inline result:` when the task truly produced only a short answer/status.
- **Result** — one sentence the chairman can read and understand immediately.
- **Verified** — how the agent confirmed the work is correct.

### FAQ

**Q: What if the task can't be completed?**
A: Agents use `BLOCKED` (needs human action) or `PAUSED` (system/runtime failure). These still go through `tyctl task update`, not `tyctl task close`.

**Q: Can I see the closing comment?**
A: Yes. Open any DONE task — the closing comment is in the task thread with the deliverable links.

**Q: What counts as deliverable evidence?**
A: A `doc:<id>` link (reports, plans), `asset:<id>` link (screenshots, files), `app:<id>` link (deployed sites), a GitHub commit URL, or an explicit `Inline result:` / `Short answer:` / `Status result:` marker for short answer/status tasks. Pure text "I'm done" is rejected.
