# Understanding Activity and Workflow Task Event Histories in Temporal

> Every event in a Temporal history is named after the state of the task it belongs to. Remove the leading ActivityTask or WorkflowTask from the name and what remains is Scheduled, Started, Completed, Failed or TimedOut: three steps of one lifecycle, in a fixed order. This lecture lays that lifecycle out, shows why a worker is the party that reports completion and failure while the Temporal cluster is the party that declares a timeout, and reads the Start-To-Close timeout straight off the picture as the window between step two and step three. The same reading then transfers to workflow task events, so an event history in the Web UI can be interpreted rather than decoded.

- Canonical watch page: [Understanding Activity and Workflow Task Event Histories in Temporal](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal)
- Publisher: [Academa, Inc.](https://academa.ai)
- Subject: Computer Science
- Published: 2026-09-01T02:05:27.516Z
- Updated: 2026-09-01T02:05:27.516Z
- Duration: PT338S (5 minutes 38 seconds)
- Chapters: 4
- Views: 0
- Language: en-US
- Access: Free
- Video stream: [HLS content](https://academa.ai/media/l/01M1DABYJK6ZWC90PVPVTQ9420/0/dark/master.m3u8)
- Audiovisual record: [Semantic JSON](https://academa.ai/media/l/01M1DABYJK6ZWC90PVPVTQ9420/0/semantic.json)
- Thumbnail: [Image](https://academa.ai/media/l/01M1DABYJK6ZWC90PVPVTQ9420/0/dark/poster.jpg)

## Description

Strip the prefix from a Temporal event name and it names the task state: the lifecycle, the closed states, and the Start-To-Close window.

## Chapters

- [00:00–00:59.306 · Reading the Event Names](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=0)
- [00:59.306–02:48.659 · Three Steps, and the Window Between Them](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665)
- [02:48.659–04:34.774 · Who Decides How It Ends](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=168.65925000000004)
- [04:34.774–05:38 · The Same Pattern for Workflow Tasks](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=274.77377083333334)

## Transcript

### [00:00 · Reading the Event Names](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=0)

Open an event history in the Temporal Web UI and the names are long. Activity Task Scheduled. Activity Task Started. Activity Task Completed. There is a pattern in them, and it is worth a couple of minutes of your attention. Every activity event begins with the same two words. Cross those off, and what is left is a state: Scheduled, in this case. That is the whole convention. It is not a coincidence and it is not occasional. Every activity event in the history is named this way. So here are the five you will meet. Scheduled and Started at the top, then the three ways a task can end: Completed, Failed, and Timed Out. Five names, five states. And those five states are not five separate ideas. They are three steps in one lifecycle, so the next thing to do is lay that lifecycle out.

### [00:59.306 · Three Steps, and the Window Between Them](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665)

Those five states are three steps, and an activity task always takes them in the same order. Step one is Scheduled: the Temporal cluster has put the task on a task queue. Nothing of yours has run yet. Step two is Started. A worker has polled that queue, taken the task off it, and begun executing your activity code. Step three is a closed state, and there are three of those. Completed, when the worker ran your code all the way through and returned a value. Failed, when running your code produced an error instead. And Timed Out, when the time allowed ran out before any result came back. So Scheduled is always first, Started is always second, and one of those three is always last. Anything else you see between them in the history belongs to the workflow, not to this task. Once you can see those three steps, the timeout names stop being jargon. Take the one called Start To Close. Its first half names step two, the moment the worker began. Its second half names step three, whichever of those closed states the task reaches. So the timeout is the longest gap allowed between those two moments, and nothing else. A Start To Close of ten seconds says exactly this: once a worker picks the task up, it has ten seconds to finish, to fail, or to be declared timed out. Read another one the same way. Schedule To Start spans step one to step two: how long the task may sit on the queue before a worker picks it up. Every timeout in Temporal is named this way: two points of that lifecycle, and the stretch of time between them.

### [02:48.659 · Who Decides How It Ends](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=168.65925000000004)

Now, which of those three closed states a task lands in is decided by two different parties, and the split between them is not arbitrary. Completed and Failed are the worker's call, and that is because the worker is the thing actually running your code. If your activity function returns a value, the worker reports the task as Completed. If it raises an error instead, the worker reports Failed. Same worker, same process, one difference in what your code did. Timed Out is the odd one out. That decision comes from the Temporal cluster, and not from the worker at all. So why is the cluster the one that decides a timeout? Think about what a timeout usually means in a distributed system. Here is the ordinary case. A worker has taken the task and started running your code, and the cluster is waiting for it to report the result back. Now the worker process dies. It cannot finish the task, so no Completed event is coming. It cannot hand you an error, so no Failed event is coming either. It cannot report anything at all. The only party left that can notice is the cluster. It knows when it handed the task out and how long the task was allowed, so when that time is up with nothing received, the cluster writes the timed out event itself. And that is the whole responsibility model. The worker decides Completed or Failed, because it is the only one that watched your code run. The cluster decides Timed Out, because it is the only one still there to notice.

### [04:34.774 · The Same Pattern for Workflow Tasks](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=274.77377083333334)

One more thing, and it is the reason any of this is worth learning. The same pattern runs straight through workflow task events. Here are the activity events again, with the state beside each one. And here are the workflow task events. Scheduled, when the cluster puts a workflow task on a queue. Started, when a worker picks it up and runs your workflow code. Then Completed, when the worker is done with it. Failed, when the code raised. And Timed Out, when the cluster stopped waiting. Two different kinds of task, one vocabulary. The state column is the same on both sides, and so is the division of labour: the worker reports completion or failure, and the cluster declares the timeout. So there is nothing here to memorize. Read the suffix on an event, and it tells you where that task had got to. Read the pair of names in a timeout, and it tells you which stretch of that lifecycle the clock was watching.

## About Academa, Inc.

Academa makes technical knowledge easier to understand through visual lectures and lets learners request new lecture videos on the topics they need.

## Complete audiovisual record

Immutable source: [semantic.json](https://academa.ai/media/l/01M1DABYJK6ZWC90PVPVTQ9420/0/semantic.json)

Record version: 1. Render attempt: 0.

### How to read this timeline

Each scene owns its object identifiers. A beat's board is the complete board when listed, empty when marked empty, and unchanged from the nearest earlier listed board in the same scene when marked unchanged. Action times are absolute positions in the published video.

### Scene 1: [Reading the Event Names](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=0)

Span: 00:00–00:59.306 (0s–59.306354166666665s).

#### Objects

- head: a Heading that says "Reading the Event Names"
- name: a Math \[text\] that says "$upright("ActivityTask") upright("Scheduled")$"
- names: a Table \[text\] that says "Event in the history What is left ActivityTaskScheduled Scheduled ActivityTaskStarted Started ActivityTaskCompleted Completed ActivityTaskFailed Failed ActivityTaskTimedOut TimedOut" (rows=(('Event in the history', 'What is left'), ('ActivityTaskSchedu…, header=True)
- rule: a Panel that says "Drop the leading $upright("ActivityTask")$ from an activity event name. What is left is the state that task was in when the event was written."

#### Beats

##### [00:00](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=0)

Narration: Open an event history in the Temporal Web UI and the names are long. Activity Task Scheduled. Activity Task Started. Activity Task Completed. There is a pattern in them, and it is worth a couple of minutes of your attention.

Board: Empty.

Actions:
- [00:00](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=0): head is shown on the screen, written out.
- [00:5.48](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=5.48): name is shown on the screen, written out.

##### [00:15.704](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=15.7045)

Narration: Every activity event begins with the same two words. Cross those off, and what is left is a state: Scheduled, in this case.

Board: name — a Math \[text\] that says "$upright("ActivityTask") upright("Scheduled")$"; head — a Heading that says "Reading the Event Names"

Actions:
- [00:19.687](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=19.686999999999998): name (the "upright("ActivityTask")" part) is struck through — it is ruled out.
- [00:22.694](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=22.694000000000003): name (the "upright("Scheduled")" part) is emphasized.

##### [00:25.198](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=25.198)

Narration: That is the whole convention. It is not a coincidence and it is not occasional. Every activity event in the history is named this way.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [00:25.198](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=25.198): name (the "upright("Scheduled")" part) is no longer emphasized.
- [00:26.556](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=26.556): rule is shown on the screen, written out.
- [00:34.672](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=34.6715): name is hidden from the screen — left the board.
- [00:34.672](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=34.6715): rule is hidden from the screen — left the board.

##### [00:35.272](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=35.2715)

Narration: So here are the five you will meet. Scheduled and Started at the top, then the three ways a task can end: Completed, Failed, and Timed Out.

Board: head — a Heading that says "Reading the Event Names"

Actions:
- [00:35.272](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=35.2715): names is shown on the screen, written out.
- [00:38.058](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=38.05800000000001): names is shown on the screen, written out.
- [00:38.661](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=38.66100000000001): names is shown on the screen, written out.
- [00:43.178](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=43.178000000000004): names is shown on the screen, written out.
- [00:44.246](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=44.246): names is shown on the screen, written out.
- [00:45.151](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=45.151): names is shown on the screen, written out.

##### [00:46.808](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=46.80800000000001)

Narration: Five names, five states. And those five states are not five separate ideas. They are three steps in one lifecycle, so the next thing to do is lay that lifecycle out.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [00:48.213](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=48.21300000000001): names (the "column=2" part) is emphasized.
- [00:53.75](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=53.75000000000001): names (the "column=2" part) is no longer emphasized.
- [00:58.265](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=58.26468750000001): head is hidden from the screen — left the board.
- [00:58.265](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=58.26468750000001): names is hidden from the screen — left the board.

### Scene 2: [Three Steps, and the Window Between Them](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665)

Span: 00:59.306–02:48.659 (59.306354166666665s–168.65925000000004s).

#### Objects

- actor\_cluster: a Math \[gray\] that says "$upright("cluster")$" drawn in diagram
- actor\_worker: a Math \[gray\] that says "$upright("worker")$" drawn in diagram
- arrow\_completed: a Vector \[green\] drawn in diagram (start=(7.4, 3.5), end=(8.5, 5.0))
- arrow\_dequeue: a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3))
- arrow\_failed: a Vector \[red\] drawn in diagram (start=(7.4, 3.3), end=(8.5, 3.3))
- arrow\_timed\_out: a Vector \[magenta\] drawn in diagram (start=(7.4, 3.1), end=(8.5, 1.6))
- box\_completed: a Polygon \[green\] drawn in diagram (vertices=((8.7, 4.7), (11.5, 4.7), (11.5, 5.7), (8.7, 5.7)), fill\_opacity=0.18)
- box\_failed: a Polygon \[red\] drawn in diagram (vertices=((8.7, 2.8), (11.5, 2.8), (11.5, 3.8), (8.7, 3.8)), fill\_opacity=0.18)
- box\_scheduled: a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18)
- box\_started: a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18)
- box\_timed\_out: a Polygon \[magenta\] drawn in diagram (vertices=((8.7, 0.9), (11.5, 0.9), (11.5, 1.9), (8.7, 1.9)), fill\_opacity=0.18)
- diagram: a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0))
- drop\_closed: a Line \[yellow\] drawn in diagram (start=(10.1, 5.8), end=(10.1, 6.4), dashed=True)
- drop\_started: a Line \[yellow\] drawn in diagram (start=(5.8, 3.9), end=(5.8, 6.4), dashed=True)
- head: a Heading that says "Three Steps, and the Window Between Them"
- label\_completed: a Math \[green\] that says "$upright("Completed")$" drawn in diagram
- label\_failed: a Math \[red\] that says "$upright("Failed")$" drawn in diagram
- label\_scheduled: a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram
- label\_started: a Math \[yellow\] that says "$upright("Started")$" drawn in diagram
- label\_timed\_out: a Math \[magenta\] that says "$upright("TimedOut")$" drawn in diagram
- span: a Line \[yellow\] labelled "upright("Start-To-Close")" drawn in diagram (start=(5.8, 6.4), end=(10.1, 6.4))
- timeout\_math: a Math \[text\] that says "$upright("Step 2") arrow.r upright("Step 3")$"
- timeout\_note: a Panel that says "The longest time allowed between step two, when the worker begins executing the task, and step three, when the task reaches a closed state."

#### Beats

##### [00:59.306](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665)

Narration: Those five states are three steps, and an activity task always takes them in the same order. Step one is Scheduled: the Temporal cluster has put the task on a task queue. Nothing of yours has run yet.

Board: Empty.

Actions:
- [00:59.306](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665): head is shown on the screen, written out.
- [00:59.306](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=59.306354166666665): diagram is shown on the screen, written out.
- [01:5.088](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=65.08835416666666): box\_scheduled is shown on the screen, written out.
- [01:5.924](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=65.92435416666666): label\_scheduled is shown on the screen, written out.
- [01:9.163](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=69.16335416666666): actor\_cluster is shown on the screen, written out.

##### [01:12.584](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=72.58435416666667)

Narration: Step two is Started. A worker has polled that queue, taken the task off it, and begun executing your activity code.

Board: diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram

Actions:
- [01:12.932](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=72.93235416666667): box\_started is shown on the screen, written out.
- [01:13.966](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=73.96635416666666): label\_started is shown on the screen, written out.
- [01:15.37](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=75.37035416666666): actor\_worker is shown on the screen, written out.
- [01:17.007](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=77.00735416666666): arrow\_dequeue is shown on the screen, written out.

##### [01:21.555](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=81.55485416666667)

Narration: Step three is a closed state, and there are three of those. Completed, when the worker ran your code all the way through and returned a value.

Board: diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram; box\_started — a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18); label\_started — a Math \[yellow\] that says "$upright("Started")$" drawn in diagram; actor\_worker — a Math \[gray\] that says "$upright("worker")$" drawn in diagram; arrow\_dequeue — a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3))

Actions:
- [01:26.001](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=86.00135416666666): box\_completed is shown on the screen, written out.
- [01:26.234](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=86.23449440321022): label\_completed is shown on the screen, written out.
- [01:28.695](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=88.69535416666666): arrow\_completed is shown on the screen, written out.

##### [01:31.21](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=91.21035416666666)

Narration: Failed, when running your code produced an error instead. And Timed Out, when the time allowed ran out before any result came back.

Board: diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram; box\_started — a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18); label\_started — a Math \[yellow\] that says "$upright("Started")$" drawn in diagram; actor\_worker — a Math \[gray\] that says "$upright("worker")$" drawn in diagram; arrow\_dequeue — a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3)); box\_completed — a Polygon \[green\] drawn in diagram (vertices=((8.7, 4.7), (11.5, 4.7), (11.5, 5.7), (8.7, 5.7)), fill\_opacity=0.18); label\_completed — a Math \[green\] that says "$upright("Completed")$" drawn in diagram; arrow\_completed — a Vector \[green\] drawn in diagram (start=(7.4, 3.5), end=(8.5, 5.0))

Actions:
- [01:31.558](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=91.55835416666667): box\_failed is shown on the screen, written out.
- [01:31.889](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=91.88930343444909): label\_failed is shown on the screen, written out.
- [01:33.787](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=93.78735416666667): arrow\_failed is shown on the screen, written out.
- [01:35.784](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=95.78435416666666): box\_timed\_out is shown on the screen, written out.
- [01:36.012](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=96.01160312064155): label\_timed\_out is shown on the screen, written out.
- [01:38.582](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=98.58235416666666): arrow\_timed\_out is shown on the screen, written out.

##### [01:40.53](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=100.52985416666667)

Narration: So Scheduled is always first, Started is always second, and one of those three is always last. Anything else you see between them in the history belongs to the workflow, not to this task.

Board: diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram; box\_started — a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18); label\_started — a Math \[yellow\] that says "$upright("Started")$" drawn in diagram; actor\_worker — a Math \[gray\] that says "$upright("worker")$" drawn in diagram; arrow\_dequeue — a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3)); box\_completed — a Polygon \[green\] drawn in diagram (vertices=((8.7, 4.7), (11.5, 4.7), (11.5, 5.7), (8.7, 5.7)), fill\_opacity=0.18); label\_completed — a Math \[green\] that says "$upright("Completed")$" drawn in diagram; arrow\_completed — a Vector \[green\] drawn in diagram (start=(7.4, 3.5), end=(8.5, 5.0)); box\_failed — a Polygon \[red\] drawn in diagram (vertices=((8.7, 2.8), (11.5, 2.8), (11.5, 3.8), (8.7, 3.8)), fill\_opacity=0.18); label\_failed — a Math \[red\] that says "$upright("Failed")$" drawn in diagram; arrow\_failed — a Vector \[red\] drawn in diagram (start=(7.4, 3.3), end=(8.5, 3.3)); box\_timed\_out — a Polygon \[magenta\] drawn in diagram (vertices=((8.7, 0.9), (11.5, 0.9), (11.5, 1.9), (8.7, 1.9)), fill\_opacity=0.18); label\_timed\_out — a Math \[magenta\] that says "$upright("TimedOut")$" drawn in diagram; arrow\_timed\_out — a Vector \[magenta\] drawn in diagram (start=(7.4, 3.1), end=(8.5, 1.6))

Actions:
- [01:42.12](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=102.12035416666666): box\_scheduled is indicated — a transient flash.
- [01:43.594](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=103.59435416666668): box\_started is indicated — a transient flash.
- [01:46.322](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=106.32235416666666): box\_completed is indicated — a transient flash.
- [01:46.322](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=106.32235416666666): box\_failed is indicated — a transient flash.
- [01:46.322](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=106.32235416666666): box\_timed\_out is indicated — a transient flash.

##### [01:53.018](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=113.01785416666667)

Narration: Once you can see those three steps, the timeout names stop being jargon. Take the one called Start To Close. Its first half names step two, the moment the worker began.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [02:1.109](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=121.10935416666666): diagram moves to a new place on the board.
- [02:1.109](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=121.10935416666666): timeout\_math is shown on the screen, written out.
- [02:2.143](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=122.14335416666667): drop\_started is shown on the screen, written out.

##### [02:5.622](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=125.62235416666667)

Narration: Its second half names step three, whichever of those closed states the task reaches. So the timeout is the longest gap allowed between those two moments, and nothing else.

Board: timeout\_math — a Math \[text\] that says "$upright("Step 2") arrow.r upright("Step 3")$"; diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram; box\_started — a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18); label\_started — a Math \[yellow\] that says "$upright("Started")$" drawn in diagram; actor\_worker — a Math \[gray\] that says "$upright("worker")$" drawn in diagram; arrow\_dequeue — a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3)); box\_completed — a Polygon \[green\] drawn in diagram (vertices=((8.7, 4.7), (11.5, 4.7), (11.5, 5.7), (8.7, 5.7)), fill\_opacity=0.18); label\_completed — a Math \[green\] that says "$upright("Completed")$" drawn in diagram; arrow\_completed — a Vector \[green\] drawn in diagram (start=(7.4, 3.5), end=(8.5, 5.0)); box\_failed — a Polygon \[red\] drawn in diagram (vertices=((8.7, 2.8), (11.5, 2.8), (11.5, 3.8), (8.7, 3.8)), fill\_opacity=0.18); label\_failed — a Math \[red\] that says "$upright("Failed")$" drawn in diagram; arrow\_failed — a Vector \[red\] drawn in diagram (start=(7.4, 3.3), end=(8.5, 3.3)); box\_timed\_out — a Polygon \[magenta\] drawn in diagram (vertices=((8.7, 0.9), (11.5, 0.9), (11.5, 1.9), (8.7, 1.9)), fill\_opacity=0.18); label\_timed\_out — a Math \[magenta\] that says "$upright("TimedOut")$" drawn in diagram; arrow\_timed\_out — a Vector \[magenta\] drawn in diagram (start=(7.4, 3.1), end=(8.5, 1.6)); drop\_started — a Line \[yellow\] drawn in diagram (start=(5.8, 3.9), end=(5.8, 6.4), dashed=True)

Actions:
- [02:7.317](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=127.31735416666666): drop\_closed is shown on the screen, written out.
- [02:12.588](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=132.58835416666668): span is shown on the screen, written out.
- [02:14.423](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=134.42335416666666): timeout\_note is shown on the screen, written out.

##### [02:16.915](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=136.91535416666667)

Narration: A Start To Close of ten seconds says exactly this: once a worker picks the task up, it has ten seconds to finish, to fail, or to be declared timed out.

Board: timeout\_math — a Math \[text\] that says "$upright("Step 2") arrow.r upright("Step 3")$"; timeout\_note — a Panel that says "The longest time allowed between step two, when the worker begins executing the task, and step three, when the task reaches a closed state."; diagram — a Figure (x\_range=(0.0, 12.0), y\_range=(0.0, 7.0), aspect=(12.0, 7.0)); head — a Heading that says "Three Steps, and the Window Between Them"; box\_scheduled — a Polygon \[blue\] drawn in diagram (vertices=((0.5, 2.8), (3.3, 2.8), (3.3, 3.8), (0.5, 3.8)), fill\_opacity=0.18); label\_scheduled — a Math \[blue\] that says "$upright("Scheduled")$" drawn in diagram; actor\_cluster — a Math \[gray\] that says "$upright("cluster")$" drawn in diagram; box\_started — a Polygon \[yellow\] drawn in diagram (vertices=((4.4, 2.8), (7.2, 2.8), (7.2, 3.8), (4.4, 3.8)), fill\_opacity=0.18); label\_started — a Math \[yellow\] that says "$upright("Started")$" drawn in diagram; actor\_worker — a Math \[gray\] that says "$upright("worker")$" drawn in diagram; arrow\_dequeue — a Vector \[yellow\] drawn in diagram (start=(3.45, 3.3), end=(4.3, 3.3)); box\_completed — a Polygon \[green\] drawn in diagram (vertices=((8.7, 4.7), (11.5, 4.7), (11.5, 5.7), (8.7, 5.7)), fill\_opacity=0.18); label\_completed — a Math \[green\] that says "$upright("Completed")$" drawn in diagram; arrow\_completed — a Vector \[green\] drawn in diagram (start=(7.4, 3.5), end=(8.5, 5.0)); box\_failed — a Polygon \[red\] drawn in diagram (vertices=((8.7, 2.8), (11.5, 2.8), (11.5, 3.8), (8.7, 3.8)), fill\_opacity=0.18); label\_failed — a Math \[red\] that says "$upright("Failed")$" drawn in diagram; arrow\_failed — a Vector \[red\] drawn in diagram (start=(7.4, 3.3), end=(8.5, 3.3)); box\_timed\_out — a Polygon \[magenta\] drawn in diagram (vertices=((8.7, 0.9), (11.5, 0.9), (11.5, 1.9), (8.7, 1.9)), fill\_opacity=0.18); label\_timed\_out — a Math \[magenta\] that says "$upright("TimedOut")$" drawn in diagram; arrow\_timed\_out — a Vector \[magenta\] drawn in diagram (start=(7.4, 3.1), end=(8.5, 1.6)); drop\_started — a Line \[yellow\] drawn in diagram (start=(5.8, 3.9), end=(5.8, 6.4), dashed=True); drop\_closed — a Line \[yellow\] drawn in diagram (start=(10.1, 5.8), end=(10.1, 6.4), dashed=True); span — a Line \[yellow\] labelled "upright("Start-To-Close")" drawn in diagram (start=(5.8, 6.4), end=(10.1, 6.4))

Actions:
- [02:19.388](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=139.38835416666666): span is indicated — a transient flash.

##### [02:29.288](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=149.28785416666668)

Narration: Read another one the same way. Schedule To Start spans step one to step two: how long the task may sit on the queue before a worker picks it up.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [02:33.537](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=153.53735416666666): The segment (1.9, 2.55) to (5.8, 2.55) in diagram is lit up.
- [02:39.97](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=159.96985416666666): diagram: retire a lit segment (unemphasize\_line).

##### [02:40.57](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=160.5698541666667)

Narration: Every timeout in Temporal is named this way: two points of that lifecycle, and the stretch of time between them.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [02:43.809](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=163.80935416666665): timeout\_math is indicated — a transient flash.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): diagram is hidden from the screen — left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): box\_scheduled is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): label\_scheduled is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): actor\_cluster is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): box\_started is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): label\_started is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): actor\_worker is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): arrow\_dequeue is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): box\_completed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): label\_completed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): arrow\_completed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): box\_failed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): label\_failed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): arrow\_failed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): box\_timed\_out is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): label\_timed\_out is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): arrow\_timed\_out is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): drop\_started is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): drop\_closed is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): span is hidden from the screen — diagram left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): head is hidden from the screen — left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): timeout\_math is hidden from the screen — left the board.
- [02:47.618](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=167.61758333333336): timeout\_note is hidden from the screen — left the board.

### Scene 3: [Who Decides How It Ends](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=168.65925000000004)

Span: 02:48.659–04:34.774 (168.65925000000004s–274.77377083333334s).

#### Objects

- box\_cluster: a Polygon \[blue\] drawn in crash (vertices=((6.2, 3.9), (9.4, 3.9), (9.4, 5.1), (6.2, 5.1)), fill\_opacity=0.18)
- box\_timed\_out: a Polygon \[magenta\] drawn in crash (vertices=((6.2, 1.0), (9.4, 1.0), (9.4, 2.2), (6.2, 2.2)), fill\_opacity=0.18)
- box\_worker: a Polygon \[yellow\] drawn in crash (vertices=((0.6, 3.9), (3.8, 3.9), (3.8, 5.1), (0.6, 5.1)), fill\_opacity=0.18)
- crash: a Figure (x\_range=(0.0, 10.0), y\_range=(0.0, 6.0), aspect=(10.0, 6.0))
- elapsed: a Math \[gray\] that says "$upright("time limit elapses")$" drawn in crash
- fall: a Vector \[magenta\] drawn in crash (start=(7.8, 3.8), end=(7.8, 2.4))
- gash\_1: a Line \[red\] drawn in crash (start=(0.9, 4.1), end=(3.5, 4.9))
- gash\_2: a Line \[red\] drawn in crash (start=(0.9, 4.9), end=(3.5, 4.1))
- head: a Heading that says "Who Decides How It Ends"
- label\_cluster: a Math \[blue\] that says "$upright("Cluster")$" drawn in crash
- label\_timed\_out: a Math \[magenta\] that says "$upright("TimedOut")$" drawn in crash
- label\_worker: a Math \[yellow\] that says "$upright("Worker")$" drawn in crash
- outcomes: a Table \[text\] that says "Closed state Decided by Why Completed the worker your code returned Failed the worker your code raised an error TimedOut the cluster no result arrived in time" (rows=(('Closed state', 'Decided by', 'Why'), ('Completed', 'the work…, header=True)
- report: a Vector \[green\] labelled "upright("result")" drawn in crash (start=(3.9, 4.5), end=(6.1, 4.5))

#### Beats

##### [02:48.659](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=168.65925000000004)

Narration: Now, which of those three closed states a task lands in is decided by two different parties, and the split between them is not arbitrary.

Board: Empty.

Actions:
- [02:48.659](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=168.65925000000004): head is shown on the screen, written out.
- [02:53.419](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=173.41925000000003): outcomes is shown on the screen, written out.

##### [02:57.827](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=177.82725000000005)

Narration: Completed and Failed are the worker's call, and that is because the worker is the thing actually running your code. If your activity function returns a value, the worker reports the task as Completed.

Board: head — a Heading that says "Who Decides How It Ends"

Actions:
- [03:6.187](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=186.18725000000003): outcomes is shown on the screen, written out.

##### [03:10.804](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=190.80375000000004)

Narration: If it raises an error instead, the worker reports Failed. Same worker, same process, one difference in what your code did.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [03:14.113](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=194.11325000000005): outcomes is shown on the screen, written out.

##### [03:20.854](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=200.85425000000004)

Narration: Timed Out is the odd one out. That decision comes from the Temporal cluster, and not from the worker at all.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [03:21.156](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=201.15625000000006): outcomes is shown on the screen, written out.
- [03:26.171](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=206.17125000000004): outcomes (the "row=4" part) is emphasized.
- [03:28.912](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=208.91175000000004): outcomes (the "row=4" part) is no longer emphasized.

##### [03:29.512](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=209.51175000000003)

Narration: So why is the cluster the one that decides a timeout? Think about what a timeout usually means in a distributed system.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [03:37.812](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=217.81225000000003): outcomes is hidden from the screen — left the board.

##### [03:38.412](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=218.41225000000003)

Narration: Here is the ordinary case. A worker has taken the task and started running your code, and the cluster is waiting for it to report the result back.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [03:38.412](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=218.41225000000003): crash is shown on the screen, written out.
- [03:41.233](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=221.23325000000006): box\_worker is shown on the screen, written out.
- [03:41.405](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=221.40483957501766): label\_worker is shown on the screen, written out.
- [03:45.134](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=225.13425000000004): box\_cluster is shown on the screen, written out.
- [03:45.325](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=225.32451473350557): label\_cluster is shown on the screen, written out.
- [03:46.492](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=226.49225000000004): report is shown on the screen, written out.

##### [03:48.904](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=228.90425000000005)

Narration: Now the worker process dies. It cannot finish the task, so no Completed event is coming. It cannot hand you an error, so no Failed event is coming either. It cannot report anything at all.

Board: head — a Heading that says "Who Decides How It Ends"; crash — a Figure (x\_range=(0.0, 10.0), y\_range=(0.0, 6.0), aspect=(10.0, 6.0)); box\_worker — a Polygon \[yellow\] drawn in crash (vertices=((0.6, 3.9), (3.8, 3.9), (3.8, 5.1), (0.6, 5.1)), fill\_opacity=0.18); label\_worker — a Math \[yellow\] that says "$upright("Worker")$" drawn in crash; box\_cluster — a Polygon \[blue\] drawn in crash (vertices=((6.2, 3.9), (9.4, 3.9), (9.4, 5.1), (6.2, 5.1)), fill\_opacity=0.18); label\_cluster — a Math \[blue\] that says "$upright("Cluster")$" drawn in crash; report — a Vector \[green\] labelled "upright("result")" drawn in crash (start=(3.9, 4.5), end=(6.1, 4.5))

Actions:
- [03:50.645](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=230.64525000000003): gash\_1 is shown on the screen, written out.
- [03:51.201](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=231.20125922037613): gash\_2 is shown on the screen, written out.
- [04:2.313](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=242.31325000000004): report is hidden from the screen.

##### [04:4.365](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=244.36525000000006)

Narration: The only party left that can notice is the cluster. It knows when it handed the task out and how long the task was allowed, so when that time is up with nothing received, the cluster writes the timed out event itself.

Board: head — a Heading that says "Who Decides How It Ends"; crash — a Figure (x\_range=(0.0, 10.0), y\_range=(0.0, 6.0), aspect=(10.0, 6.0)); box\_worker — a Polygon \[yellow\] drawn in crash (vertices=((0.6, 3.9), (3.8, 3.9), (3.8, 5.1), (0.6, 5.1)), fill\_opacity=0.18); label\_worker — a Math \[yellow\] that says "$upright("Worker")$" drawn in crash; box\_cluster — a Polygon \[blue\] drawn in crash (vertices=((6.2, 3.9), (9.4, 3.9), (9.4, 5.1), (6.2, 5.1)), fill\_opacity=0.18); label\_cluster — a Math \[blue\] that says "$upright("Cluster")$" drawn in crash; gash\_1 — a Line \[red\] drawn in crash (start=(0.9, 4.1), end=(3.5, 4.9)); gash\_2 — a Line \[red\] drawn in crash (start=(0.9, 4.9), end=(3.5, 4.1))

Actions:
- [04:13.119](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=253.11925000000005): elapsed is shown on the screen, written out.
- [04:15.905](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=255.90525000000002): fall is shown on the screen, written out.
- [04:16.12](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=256.12041076516084): box\_timed\_out is shown on the screen, written out.
- [04:16.491](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=256.49136016144354): label\_timed\_out is shown on the screen, written out.

##### [04:18.781](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=258.78075)

Narration: And that is the whole responsibility model. The worker decides Completed or Failed, because it is the only one that watched your code run. The cluster decides Timed Out, because it is the only one still there to notice.

Board: head — a Heading that says "Who Decides How It Ends"; crash — a Figure (x\_range=(0.0, 10.0), y\_range=(0.0, 6.0), aspect=(10.0, 6.0)); box\_worker — a Polygon \[yellow\] drawn in crash (vertices=((0.6, 3.9), (3.8, 3.9), (3.8, 5.1), (0.6, 5.1)), fill\_opacity=0.18); label\_worker — a Math \[yellow\] that says "$upright("Worker")$" drawn in crash; box\_cluster — a Polygon \[blue\] drawn in crash (vertices=((6.2, 3.9), (9.4, 3.9), (9.4, 5.1), (6.2, 5.1)), fill\_opacity=0.18); label\_cluster — a Math \[blue\] that says "$upright("Cluster")$" drawn in crash; gash\_1 — a Line \[red\] drawn in crash (start=(0.9, 4.1), end=(3.5, 4.9)); gash\_2 — a Line \[red\] drawn in crash (start=(0.9, 4.9), end=(3.5, 4.1)); elapsed — a Math \[gray\] that says "$upright("time limit elapses")$" drawn in crash; fall — a Vector \[magenta\] drawn in crash (start=(7.8, 3.8), end=(7.8, 2.4)); box\_timed\_out — a Polygon \[magenta\] drawn in crash (vertices=((6.2, 1.0), (9.4, 1.0), (9.4, 2.2), (6.2, 2.2)), fill\_opacity=0.18); label\_timed\_out — a Math \[magenta\] that says "$upright("TimedOut")$" drawn in crash

Actions:
- [04:22.345](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=262.34525): box\_worker is indicated — a transient flash.
- [04:28.742](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=268.74225): box\_cluster is indicated — a transient flash.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): crash is hidden from the screen — left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): box\_worker is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): label\_worker is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): box\_cluster is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): label\_cluster is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): gash\_1 is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): gash\_2 is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): elapsed is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): fall is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): box\_timed\_out is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): label\_timed\_out is hidden from the screen — crash left the board.
- [04:33.732](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=273.7321041666667): head is hidden from the screen — left the board.

### Scene 4: [The Same Pattern for Workflow Tasks](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=274.77377083333334)

Span: 04:34.774–05:37.711 (274.77377083333334s–337.7111458333334s).

#### Objects

- activity: a Table \[text\] that says "ActivityTaskScheduled Scheduled ActivityTaskStarted Started ActivityTaskCompleted Completed ActivityTaskFailed Failed ActivityTaskTimedOut TimedOut" (rows=(('ActivityTaskScheduled', 'Scheduled'), ('ActivityTaskStarted'…)
- head: a Heading that says "The Same Pattern for Workflow Tasks"
- label\_left: a Tex \[text\] that says "Activity task events"
- label\_right: a Tex \[text\] that says "Workflow task events"
- workflow: a Table \[text\] that says "WorkflowTaskScheduled Scheduled WorkflowTaskStarted Started WorkflowTaskCompleted Completed WorkflowTaskFailed Failed WorkflowTaskTimedOut TimedOut" (rows=(('WorkflowTaskScheduled', 'Scheduled'), ('WorkflowTaskStarted'…)

#### Beats

##### [04:34.774](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=274.77377083333334)

Narration: One more thing, and it is the reason any of this is worth learning. The same pattern runs straight through workflow task events. Here are the activity events again, with the state beside each one.

Board: Empty.

Actions:
- [04:34.774](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=274.77377083333334): head is shown on the screen, written out.
- [04:43.528](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=283.52777083333336): label\_left is shown on the screen, written out.
- [04:45.2](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=285.19977083333333): activity is shown on the screen, written out.
- [04:45.4](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=285.39962340529576): activity is shown on the screen, written out.
- [04:45.613](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=285.6128597906188): activity is shown on the screen, written out.
- [04:45.835](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=285.83468998354726): activity is shown on the screen, written out.
- [04:46.026](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=286.02577374102293): activity is shown on the screen, written out.

##### [04:47.402](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=287.40177083333333)

Narration: And here are the workflow task events. Scheduled, when the cluster puts a workflow task on a queue. Started, when a worker picks it up and runs your workflow code.

Board: label\_left — a Tex \[text\] that says "Activity task events"; head — a Heading that says "The Same Pattern for Workflow Tasks"

Actions:
- [04:47.402](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=287.40177083333333): label\_right is shown on the screen, written out.
- [04:50.722](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=290.7217708333333): workflow is shown on the screen, written out.
- [04:54.809](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=294.80877083333337): workflow is shown on the screen, written out.

##### [04:58.938](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=298.9382708333333)

Narration: Then Completed, when the worker is done with it. Failed, when the code raised. And Timed Out, when the cluster stopped waiting.

Board: label\_left — a Tex \[text\] that says "Activity task events"; label\_right — a Tex \[text\] that says "Workflow task events"; head — a Heading that says "The Same Pattern for Workflow Tasks"

Actions:
- [04:59.6](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=299.59977083333337): workflow is shown on the screen, written out.
- [05:2.653](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=302.65277083333336): workflow is shown on the screen, written out.
- [05:5.591](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=305.59077083333335): workflow is shown on the screen, written out.

##### [05:9.081](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=309.08077083333336)

Narration: Two different kinds of task, one vocabulary. The state column is the same on both sides, and so is the division of labour: the worker reports completion or failure, and the cluster declares the timeout.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [05:14.375](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=314.37477083333334): activity (the "column=2" part) is emphasized.
- [05:14.375](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=314.37477083333334): workflow (the "column=2" part) is emphasized.
- [05:16.639](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=316.63877083333335): activity (the "column=2" part) is no longer emphasized.
- [05:16.639](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=316.63877083333335): workflow (the "column=2" part) is no longer emphasized.

##### [05:23.23](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=323.22977083333336)

Narration: So there is nothing here to memorize. Read the suffix on an event, and it tells you where that task had got to. Read the pair of names in a timeout, and it tells you which stretch of that lifecycle the clock was watching.

Board: Unchanged from the preceding beat in this scene.

Actions:
- [05:26.446](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=326.44577083333337): activity (the "column=2" part) is indicated — a transient flash.
- [05:26.446](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=326.44577083333337): workflow (the "column=2" part) is indicated — a transient flash.
- [05:36.669](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=336.6694791666667): activity is hidden from the screen — left the board.
- [05:36.669](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=336.6694791666667): head is hidden from the screen — left the board.
- [05:36.669](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=336.6694791666667): label\_left is hidden from the screen — left the board.
- [05:36.669](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=336.6694791666667): label\_right is hidden from the screen — left the board.
- [05:36.669](https://academa.ai/@sina/lectures/understanding-activity-and-workflow-task-event-histories-in-temporal?t=336.6694791666667): workflow is hidden from the screen — left the board.
