Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion skills/rig/references/claude-workflow-conversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Then read [Behavior differences](#behavior-differences-to-keep-in-mind) before y
| `await agent(prompt)` | `await call.text(prompt, options?)` | Returns `string \| null` |
| `await agent(prompt, { schema })` | `await call.json(prompt, schema, options?)` | `schema` is any `s.*` value (`s.object`, `s.enum`, `s.array`, …); result is typed and validated. Claude workflows only support object schemas; rig accepts any schema type. |
| Reused prompt + schema pair | `agent({ input, output, instructions })` then `call(worker, input, options?)` | Preferred for anything invoked more than once |
| `parallel(thunks)` | `parallel(thunks)` | Same barrier semantics; failures become `null` holes. **TypeScript note:** `parallel` uses a single generic `Result` type, so all thunks must return the same type. For agents with different output types, use `Promise.all` (which skips the concurrency limiter) or cast: `parallel<TypeA \| TypeB>([...]) as Promise<[TypeA \| null, TypeB \| null]>`. |
| `parallel(thunks)` | `parallel(thunks)` | Same barrier semantics; failures become `null` holes. **TypeScript note:** `parallel` uses a single generic `Result` type, so all thunks must return the same type. For agents with different output types, cast to preserve limiter semantics: `parallel<TypeA \| TypeB>([...]) as Promise<[TypeA \| null, TypeB \| null]>`. Avoid `Promise.all` in workflow bodies — it bypasses the concurrency limiter and skips the `null`-hole failure model that `parallel` provides. |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] The updated parallel row now warns against Promise.all, but the Behavior differences section — the place porters check before finalising a migration — does not mention this pitfall. A developer skimming that section could still reach for Promise.all for heterogeneous types.

💡 Suggested addition to "Behavior differences"
- **Avoid `Promise.all` in workflow bodies.** `Promise.all` bypasses the shared concurrency limiter and propagates exceptions instead of producing `null` holes. Use `parallel(thunks)` (casting for heterogeneous output types) to match Claude dynamic-workflow semantics.

| `pipeline(items, ...stages)` | `pipeline(items, ...stages)` | Stages receive `(previous, item, index)`; the first stage's `previous` is the item |
| `phase(title)` | `phase(title)` | Same |
| `{ phase: "Verify" }` on a call | `{ phase: "Verify" }` in call options | Overrides the ambient phase for that call only |
Expand Down
Loading