Skip to content

Commit ea887a0

Browse files
committed
examples: "failures" and "diagnose" become flags for extra data on list and describe
1 parent c787a8b commit ea887a0

14 files changed

Lines changed: 101 additions & 101 deletions

File tree

examples/EXPERIMENT.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The `debug-loop-fresh` example contains a TOCTOU race condition with all hints r
100100
### LLM's Diagnosis Process
101101

102102
1. **Ran the scenario** - Started worker and triggered race condition
103-
2. **Used `temporal workflow diagnose`** - Found `ReserveInventory` failed for KEYBOARD-03
103+
2. **Used `temporal workflow describe --trace-root-cause`** - Found `ReserveInventory` failed for KEYBOARD-03
104104
3. **Used `temporal workflow show --compact`** - Analyzed timestamps of both workflows
105105
4. **Built a race timeline** - Correlated events across both orders:
106106

@@ -136,8 +136,8 @@ Based on experiment findings, the following improvements were made:
136136

137137
| Feature | Status | Command |
138138
|---------|--------|---------|
139-
| Find recent failures | ✅ Done | `temporal workflow failures` |
140-
| Trace workflow chain | ✅ Done | `temporal workflow diagnose` |
139+
| Find recent failures | ✅ Done | `temporal workflow list --failed` |
140+
| Trace workflow chain | ✅ Done | `temporal workflow describe --trace-root-cause` |
141141
| Workflow timeline | ✅ Done | `temporal workflow show --compact` |
142142

143143
### Phase 2: Filtering & Compaction
@@ -179,11 +179,11 @@ Based on experiment findings, the following improvements were made:
179179

180180
| Feature | Status | Flag/Command |
181181
|---------|--------|--------------|
182-
| Trace flowchart | ✅ Done | `temporal workflow diagnose --format mermaid` |
182+
| Trace flowchart | ✅ Done | `temporal workflow describe --trace-root-cause --format mermaid` |
183183
| Timeline sequence diagram | ✅ Done | `temporal workflow show --compact --format mermaid` |
184184
| State diagram | ✅ Done | `temporal workflow describe --pending --format mermaid` |
185-
| Failures pie chart | ✅ Done | `temporal workflow failures --group-by error --format mermaid` |
186-
| Failures flowchart | ✅ Done | `temporal workflow failures --format mermaid` |
185+
| Failures pie chart | ✅ Done | `temporal workflow list --failed --group-by error --format mermaid` |
186+
| Failures flowchart | ✅ Done | `temporal workflow list --failed --format mermaid` |
187187

188188
---
189189

examples/agent-demo/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ After workflows have run, use the agent commands to analyze them.
8787
### List Recent Failures
8888

8989
```bash
90-
temporal workflow failures \
90+
temporal workflow list --failed \
9191
--address $TEMPORAL_ADDRESS \
9292
--namespace $TEMPORAL_NAMESPACE \
9393
--api-key $TEMPORAL_API_KEY \
@@ -101,7 +101,7 @@ temporal workflow failures \
101101

102102
```bash
103103
# Find the deepest failure in an order workflow
104-
temporal workflow diagnose \
104+
temporal workflow describe --trace-root-cause \
105105
--address $TEMPORAL_ADDRESS \
106106
--namespace $TEMPORAL_NAMESPACE \
107107
--api-key $TEMPORAL_API_KEY \
@@ -110,7 +110,7 @@ temporal workflow diagnose \
110110
--format json | jq
111111

112112
# Trace the nested failure workflow (3 levels deep)
113-
temporal workflow diagnose \
113+
temporal workflow describe --trace-root-cause \
114114
--address $TEMPORAL_ADDRESS \
115115
--namespace $TEMPORAL_NAMESPACE \
116116
--api-key $TEMPORAL_API_KEY \
@@ -161,6 +161,6 @@ NestedFailureWorkflow (depth=0)
161161
└── FailingActivity → FAILS: "database connection refused"
162162
```
163163

164-
The `temporal workflow diagnose` command will automatically traverse this entire chain
164+
The `temporal workflow describe --trace-root-cause` command will automatically traverse this entire chain
165165
and identify the leaf failure with its root cause.
166166

examples/agent-demo/starter/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,5 +266,5 @@ func runDeepChainScenario(ctx context.Context, c client.Client, taskQueue, times
266266
}
267267
log.Printf("Started DeepChainWorkflow (4 levels deep, fails with DB error): %s", run.GetID())
268268
log.Println("TIP: Trace the full chain with:")
269-
log.Printf(" temporal workflow diagnose --workflow-id %s --namespace <your-namespace> --format json", workflowID)
269+
log.Printf(" temporal workflow describe --trace-root-cause --workflow-id %s --namespace <your-namespace> --format json", workflowID)
270270
}

examples/ai-research-agent-impl/CLAUDE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ When debugging Temporal workflows, use the `temporal workflow` CLI commands inst
66

77
### Find Failures
88
```bash
9-
temporal workflow failures --since 1h --format json
10-
temporal workflow failures --since 1h --follow-children --leaf-only --compact-errors --format json
11-
temporal workflow failures --since 1h --group-by error --format json
9+
temporal workflow list --failed --since 1h --format json
10+
temporal workflow list --failed --since 1h --follow-children --leaf-only --compact-errors --format json
11+
temporal workflow list --failed --since 1h --group-by error --format json
1212
```
1313

1414
### Trace Workflow Chain
1515
```bash
16-
temporal workflow diagnose --workflow-id <id> --format json
17-
temporal workflow diagnose --workflow-id <id> --format mermaid
16+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json
17+
temporal workflow describe --trace-root-cause --workflow-id <id> --format mermaid
1818
```
1919

2020
### Get Timeline
@@ -60,7 +60,7 @@ Use `--format mermaid` to generate diagrams:
6060
User: "The order workflow failed"
6161

6262
You should:
63-
1. Run `temporal workflow diagnose --workflow-id order-123 --format json`
63+
1. Run `temporal workflow describe --trace-root-cause --workflow-id order-123 --format json`
6464
2. If complex, add `--format mermaid` for visual
6565
3. Identify the leaf failure and root cause
6666
4. Explain what went wrong

examples/ai-research-agent/PLAN.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Or create your own `.cursorrules` file with this content:
3333
```
3434
When debugging Temporal workflows, use the `temporal workflow` CLI commands:
3535
36-
- `temporal workflow failures --since 1h` - Find recent failures
37-
- `temporal workflow diagnose --workflow-id <id>` - Trace workflow chain to leaf failure
36+
- `temporal workflow list --failed --since 1h` - Find recent failures
37+
- `temporal workflow describe --trace-root-cause --workflow-id <id>` - Trace workflow chain to leaf failure
3838
- `temporal workflow show --compact --workflow-id <id>` - Get event timeline
3939
- `temporal workflow describe --pending --workflow-id <id>` - Check pending activities/children
4040
@@ -70,8 +70,8 @@ Then load this into your agent framework's tool configuration.
7070
At the beginning of each session, tell your AI:
7171

7272
> "I'm using Temporal for workflow orchestration. When I have issues, use the `temporal workflow` CLI to debug. The commands are:
73-
> - `temporal workflow failures` - find failures
74-
> - `temporal workflow diagnose` - trace workflow chains
73+
> - `temporal workflow list --failed` - find failures
74+
> - `temporal workflow describe --trace-root-cause` - trace workflow chains
7575
> - `temporal workflow show --compact` - see event history
7676
> - `temporal workflow describe --pending` - check pending work
7777
>
@@ -85,8 +85,8 @@ Test that your AI knows the commands by asking:
8585
8686
**Expected response should include:**
8787
```bash
88-
temporal workflow diagnose --workflow-id <id> --format json
89-
temporal workflow failures --since 1h --follow-children --format json
88+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json
89+
temporal workflow list --failed --since 1h --follow-children --format json
9090
```
9191

9292
If the AI suggests looking at logs, remind it about the workflow debugging commands (`failures`, `diagnose`, `show --compact`, `describe --pending`).
@@ -128,7 +128,7 @@ go run ./starter -question "What is Temporal?"
128128
temporal workflow list
129129

130130
# Use workflow diagnose to see what happened
131-
temporal workflow diagnose --workflow-id <id> --format json
131+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json
132132
```
133133

134134
**This teaches:** Using `workflow diagnose` to understand workflow state.
@@ -150,7 +150,7 @@ activity not registered: ProcessQuestion
150150

151151
**AI uses workflow CLI to diagnose:**
152152
```bash
153-
temporal workflow diagnose --workflow-id <id> --format json | jq '.root_cause'
153+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json | jq '.root_cause'
154154
# Shows: "activity not registered"
155155
```
156156

@@ -241,8 +241,8 @@ go run ./starter -question "Very complex philosophical question"
241241

242242
**Diagnose timeout:**
243243
```bash
244-
temporal workflow failures --since 5m --format json
245-
temporal workflow diagnose --workflow-id <id> --format json | jq '.root_cause'
244+
temporal workflow list --failed --since 5m --format json
245+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json | jq '.root_cause'
246246
# Shows: "activity StartToClose timeout"
247247
```
248248

@@ -260,11 +260,11 @@ temporal workflow diagnose --workflow-id <id> --format json | jq '.root_cause'
260260

261261
**Verify chain:**
262262
```bash
263-
temporal workflow diagnose --workflow-id <id> --format json | jq '.chain'
263+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json | jq '.chain'
264264
# Shows parent-child hierarchy
265265

266266
# Visualize the chain as a flowchart:
267-
temporal workflow diagnose --workflow-id <id> --format mermaid
267+
temporal workflow describe --trace-root-cause --workflow-id <id> --format mermaid
268268
```
269269

270270
The flowchart will show:
@@ -283,13 +283,13 @@ Coordinator → ResearchAgent1
283283
**AI suggests using agent CLI:**
284284
```bash
285285
# Find recent failures
286-
temporal workflow failures --since 10m --format json
286+
temporal workflow list --failed --since 10m --format json
287287

288288
# Get detailed trace showing which child failed
289-
temporal workflow diagnose --workflow-id <id> --format json | jq '{depth: .depth, root_cause: .root_cause}'
289+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json | jq '{depth: .depth, root_cause: .root_cause}'
290290

291291
# Use leaf-only to see actual failure, not parent wrapper
292-
temporal workflow failures --since 10m --follow-children --leaf-only --format json
292+
temporal workflow list --failed --since 10m --follow-children --leaf-only --format json
293293
```
294294

295295
**This teaches:** Using `--follow-children` and `--leaf-only` for nested workflows.
@@ -302,7 +302,7 @@ temporal workflow failures --since 10m --follow-children --leaf-only --format js
302302
303303
**Expected AI response:**
304304
```bash
305-
temporal workflow diagnose --workflow-id coordinator-12345 --format mermaid
305+
temporal workflow describe --trace-root-cause --workflow-id coordinator-12345 --format mermaid
306306
```
307307

308308
**AI outputs this diagram:**
@@ -339,7 +339,7 @@ graph TD
339339
go run ./starter -question "Mixed success question"
340340

341341
# See partial results
342-
temporal workflow diagnose --workflow-id <id> --format json
342+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json
343343
# Shows some children completed, some failed, parent still succeeded
344344
```
345345

@@ -390,7 +390,7 @@ Synthesizer → Coordinator: ✅ Done
390390
```bash
391391
go run ./starter -question "Gibberish input that produces bad results"
392392

393-
temporal workflow failures --since 5m --compact-errors --format json | jq '.failures[].root_cause'
393+
temporal workflow list --failed --since 5m --compact-errors --format json | jq '.failures[].root_cause'
394394
# Shows: "quality check failed: score 0.45 below threshold 0.7"
395395
```
396396

@@ -426,14 +426,14 @@ temporal workflow describe --pending --workflow-id <id> --format json | jq '.pen
426426
**Diagnose failures:**
427427
```bash
428428
# After batch completes
429-
temporal workflow failures --since 10m --format json | jq '.total_count'
429+
temporal workflow list --failed --since 10m --format json | jq '.total_count'
430430

431431
# Group by error type to find patterns
432-
temporal workflow failures --since 10m --group-by error --format json | jq '.groups'
432+
temporal workflow list --failed --since 10m --group-by error --format json | jq '.groups'
433433
# Might show: "rate limit: 6, timeout: 2, success: 2"
434434

435435
# Visualize as a pie chart - instantly see the breakdown:
436-
temporal workflow failures --since 10m --group-by error --format mermaid
436+
temporal workflow list --failed --since 10m --group-by error --format mermaid
437437
```
438438

439439
The pie chart makes patterns obvious at a glance:
@@ -454,7 +454,7 @@ pie title Failures by error
454454
455455
**Expected AI response:**
456456
```bash
457-
temporal workflow failures --since 10m --follow-children --leaf-only --compact-errors --group-by error --format mermaid
457+
temporal workflow list --failed --since 10m --follow-children --leaf-only --compact-errors --group-by error --format mermaid
458458
```
459459

460460
**AI outputs this diagram:**
@@ -475,7 +475,7 @@ pie title Failures by error
475475
476476
**AI response:**
477477
```bash
478-
temporal workflow failures --since 10m --follow-children --group-by namespace --format mermaid
478+
temporal workflow list --failed --since 10m --follow-children --group-by namespace --format mermaid
479479
```
480480

481481
```mermaid
@@ -504,8 +504,8 @@ pie title Failures by namespace
504504
go run ./starter -load-test -count 20
505505

506506
# Watch for timeouts vs retries
507-
temporal workflow failures --since 10m --status TimedOut --format json
508-
temporal workflow failures --since 10m --status Failed --format json
507+
temporal workflow list --failed --since 10m --status TimedOut --format json
508+
temporal workflow list --failed --since 10m --status Failed --format json
509509
```
510510

511511
---
@@ -607,7 +607,7 @@ go run ./starter -question "Very long research"
607607
temporal workflow cancel --workflow-id <id>
608608

609609
# Check that children were also cancelled
610-
temporal workflow failures --since 5m --format json | jq '.failures[] | select(.status == "Canceled")'
610+
temporal workflow list --failed --since 5m --format json | jq '.failures[] | select(.status == "Canceled")'
611611
```
612612

613613
---
@@ -621,27 +621,27 @@ temporal workflow failures --since 5m --format json | jq '.failures[] | select(.
621621
**AI walks through debugging:**
622622
```bash
623623
# Step 1: Visualize the chain - immediately see where failure occurred
624-
temporal workflow diagnose --workflow-id <id> --format mermaid
624+
temporal workflow describe --trace-root-cause --workflow-id <id> --format mermaid
625625
# The flowchart highlights the failing path in red
626626

627627
# Step 2: Get the JSON details
628-
temporal workflow diagnose --workflow-id <id> --format json | jq '.root_cause'
628+
temporal workflow describe --trace-root-cause --workflow-id <id> --format json | jq '.root_cause'
629629
# Shows: error in SynthesizerWorkflow
630630

631631
# Step 3: Trace the child
632-
temporal workflow diagnose --workflow-id <synth-id> --format json | jq '.root_cause'
632+
temporal workflow describe --trace-root-cause --workflow-id <synth-id> --format json | jq '.root_cause'
633633
# Shows: "no findings to synthesize"
634634

635635
# Step 4: Visualize the timeline to see what happened
636636
temporal workflow show --compact --workflow-id <id> --format mermaid
637637
# Sequence diagram shows: 3 research agents all returned errors!
638638

639639
# Step 5: Find the actual root cause
640-
temporal workflow failures --since 10m --follow-children --leaf-only --compact-errors --format json
640+
temporal workflow list --failed --since 10m --follow-children --leaf-only --compact-errors --format json
641641
# Shows: "API key expired"
642642

643643
# Step 6: Visualize failure breakdown
644-
temporal workflow failures --since 10m --group-by error --format mermaid
644+
temporal workflow list --failed --since 10m --group-by error --format mermaid
645645
# Pie chart confirms: 100% of failures are "API key expired"
646646
```
647647

@@ -658,7 +658,7 @@ temporal workflow failures --since 10m --group-by error --format mermaid
658658
"Let me trace the workflow and show you what happened."
659659

660660
```bash
661-
temporal workflow diagnose --workflow-id coordinator-99999 --format mermaid
661+
temporal workflow describe --trace-root-cause --workflow-id coordinator-99999 --format mermaid
662662
```
663663

664664
```mermaid
@@ -680,7 +680,7 @@ graph TD
680680
**AI explains:** "The diagram shows the Coordinator spawned 4 child workflows. All 3 ResearchAgents failed, and the Synthesizer also failed because it had no data to synthesize. But wait - this doesn't show WHY the research agents failed. Let me dig deeper..."
681681

682682
```bash
683-
temporal workflow failures --since 10m --follow-children --leaf-only --group-by error --format mermaid
683+
temporal workflow list --failed --since 10m --follow-children --leaf-only --group-by error --format mermaid
684684
```
685685

686686
```mermaid
@@ -768,7 +768,7 @@ The AI should respond with:
768768
After completing all phases, you should:
769769

770770
1. ✅ Have a working multi-agent research system
771-
2. ✅ Understand how to use `temporal workflow diagnose` for debugging
771+
2. ✅ Understand how to use `temporal workflow describe --trace-root-cause` for debugging
772772
3. ✅ Know when to use `--follow-children` and `--leaf-only`
773773
4. ✅ Be able to analyze failures with `--group-by`
774774
5. ✅ Use `workflow describe --pending` to check pending work

examples/debug-loop/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ This is a classic TOCTOU race condition!
7070

7171
```bash
7272
# Get the trace - shows root cause
73-
temporal workflow diagnose --workflow-id order-123456 --namespace default --format json
73+
temporal workflow describe --trace-root-cause --workflow-id order-123456 --namespace default --format json
7474

7575
# THIS IS KEY: Get the timeline to see the race condition
7676
temporal workflow show --compact --workflow-id order-123456 --namespace default --format json
@@ -103,7 +103,7 @@ A workflow failed with "insufficient inventory for KEYBOARD-03: requested 1, ava
103103
The logs show the inventory check passed, but the reservation failed.
104104
105105
Use temporal workflow CLI to diagnose:
106-
temporal workflow diagnose --workflow-id [id] --namespace default --format json
106+
temporal workflow describe --trace-root-cause --workflow-id [id] --namespace default --format json
107107
temporal workflow show --compact --workflow-id [id] --namespace default --format json
108108
109109
Questions to answer:

examples/debug-loop/create-fresh.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ func runRaceScenario(c client.Client, namespace, orderID string, ts int64, wait
517517
log.Println("=== DEBUG CHALLENGE ===")
518518
log.Println("One order failed. Use temporal workflow CLI to diagnose why.")
519519
log.Println("")
520-
log.Printf(" temporal workflow diagnose --workflow-id %s --namespace %s --format json", failedID, namespace)
520+
log.Printf(" temporal workflow describe --trace-root-cause --workflow-id %s --namespace %s --format json", failedID, namespace)
521521
log.Printf(" temporal workflow show --compact --workflow-id %s --namespace %s --format json", failedID, namespace)
522522
log.Println("")
523523
log.Println("Question: Why did the inventory check pass but the reservation fail?")
@@ -602,8 +602,8 @@ But the workflow checks inventory before reserving. Why does the check pass but
602602
Diagnose using `temporal workflow`:
603603
604604
```bash
605-
temporal workflow failures --namespace default --since 5m --format json
606-
temporal workflow diagnose --workflow-id <id> --namespace default --format json
605+
temporal workflow list --failed --namespace default --since 5m --format json
606+
temporal workflow describe --trace-root-cause --workflow-id <id> --namespace default --format json
607607
temporal workflow show --compact --workflow-id <id> --namespace default --format json
608608
```
609609

examples/debug-loop/starter/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func runRaceScenario(c client.Client, namespace, orderID string, ts int64, wait
187187
log.Println("")
188188
log.Println("Use temporal workflow CLI to analyze the failed order:")
189189
log.Println("")
190-
log.Printf(" temporal workflow diagnose --workflow-id %s --namespace %s --format json", failedID, namespace)
190+
log.Printf(" temporal workflow describe --trace-root-cause --workflow-id %s --namespace %s --format json", failedID, namespace)
191191
log.Printf(" temporal workflow show --compact --workflow-id %s --namespace %s --format json", failedID, namespace)
192192
log.Println("")
193193
log.Println("Key insight: Look at the timeline to see that:")

0 commit comments

Comments
 (0)