Skip to content

Improvement: run independent steps and a forEach's items at the same time, and try a failed step again after a wait #4928

Open

Description

@yannickmonney

Summary

A run does one thing at a time: one step after another, and a forEach one item after another. A model call that meets a provider rate limit fails its step and a person retries it. This issue is about three things the owner asked for on 2026-10-08 that all live in the walk: steps that do not need each other running side by side, a forEach working on several items at once, and a failed step trying again after a wait that survives a restart. #4936 has the larger picture and #4927 is the walk they would be built on.

Anchors are at main da3b98b730 (2026-10-13) unless stated.

What the repo says today

  • Steps: a live run takes the first node without a checkpoint, one at a time (services/platform/backend/core/automations/stepper.ts:1047); the in-process walker does the same (services/platform/lib/engine/core/execute/index.ts:191).
  • Items: one at a time inside the node's turn (stepper.ts:1472, :1486); the cursor is saved between items when the turn hands off.
  • A node has no concurrency or retry field (services/platform/lib/engine/core/types.ts:54-135).
  • A model call is not retried (services/platform/backend/core/automations/llm_call.ts has no retry or attempt handling; each call reserves budget before and books usage after). A connector failure arrives folded into connector_error (services/platform/backend/domains/automations/shim.ts:352-376). An agent node retries inside its own machinery (services/platform/backend/core/automations/agent_retry.ts).
  • The switches that exist are AUTOMATION_ORG_CONCURRENCY (services/platform/backend/env.ts:75) and AUTOMATION_RUNNER_PROCESSES (:87). Nothing yet for steps, items or an in-flight limit per process.

What it could be worth (modelled, not measured on a deployment)

From the design pass of 2026-10-09. These are arithmetic on a stated latency model (model call 2.5 s, read 0.4 s, write 0.5 s, transform 8 ms, commit 4 ms, 20 items per forEach), not measurements:

Document Today Items 8 at a time Plus 4 steps at once
github/triage-issues 50.4 s 7.9 s 7.9 s
github/review-pull-requests 68.5 s 10.7 s 10.7 s
gmail, outlook, imap-smtp triage-inbox 63.4 s 12.4 s 12.4 s
a fan-out (3 reads, 3 model calls, a merge, a write) 9.2 s 9.2 s 3.4 s

Item concurrency is what the shipped packs would gain; steps at once pay off for fan-out documents that authors write themselves. The repo's benchmark (services/platform/lib/engine/core/execute/perf.bench.ts) is where these would be measured.

Not examined: provider rate limits under parallel model calls; budget reservations (each concurrent call reserves its maximum, so a run with items at a time can be refused a call it would have made one at a time).

The forks

The design pass assumed the first answer of each so slices could proceed. Each is the owner's to change, and a different answer only changes the slice named.

# Question Options Touches
1 Writes next to reads Barrier: a step that can act outside the run (a write or unknown connector action, an agent, a subautomation) waits for every step above it and holds every step below it, so the writes happen in exactly the order they do now. Lane: writes are ordered among themselves and a read after a write may run beside it (at most 0.5 s gained on the packs in the model; a read could run before a write it relies on without naming it). the scheduler's ordering rules, the docs
2 Steps at once in the first release 1: the scheduler ships and runs one step at a time, and the switch flips to 4 in the next release after a canary on one deployment. 4: at once from the start. the default of AUTOMATION_PARALLEL_STEPS
3 A model step without retry Retry a rate limit or an unreachable provider (3 tries, 5 s then 10 s, retry: false opts out). Leave as today: the step fails and a person retries. the model step's failure path
4 The shipped packs Set concurrency: 5 on their model and read forEach steps (writes stay 1). Or leave them as they are. the pack documents
5 Largest concurrency 10, or higher (20) validation

What the design pass proposed beyond the forks (open to change)

  • concurrency from 1 to 10 on forEach (default 1, refused on repeatUntil); output and effects stay in item order.
  • retry: {attempts, delay, backoff, maxDelay, on} on model and connector steps. Failures are classed (rate limited, unavailable, timeout, invalid output, failed). A wait of 15 s or less happens inside the turn; a longer one parks the run and survives a restart. A write that is not idempotent retries only on a rate limit.
  • When a step fails, nothing new starts below it, in-flight steps finish, and the reported failure is the first failing step in document order.
  • One commit lane per run, so concurrent steps cannot overwrite each other's record rows or the cursor.
  • Everything additive: no engine protocol bump and no migration; an old worker in a rolling deploy steps the same run one thing at a time.
  • The canvas and the Steps view show what ran at the same time; the docs and manual boxes say so; the benchmarks prove the budget before the default flips.

Constraints

  • A step that waits for a person (approval, a question, an agent) never shares a wave with siblings, and only one step that iterates at a time holds the run's single cursor (services/platform/backend/core/automations/checkpoints.ts).
  • Budget enforcement reserves before each call; the per-organization limit across workers stays.
  • A document that uses concurrency or retry is refused by an old API replica during a rolling deploy (unknown node field): a release note.

Not examined

Behaviour under real parallel load at a provider; what the per-run commit lane costs the database at scale; how many existing documents have independent steps worth running side by side beyond the fan-out example.

Related

#4936, #4927, #4929

Activity

  1. added
    needs discussion
    perf
    improvement
    service: platform
    on Oct 13, 2026
  2. yannickmonney commented on Nov 14, 2026

    @yannickmonney
    ContributorAuthor

    Decision

    This is built on the feature line (release/0.6, through feature-train), on top of the shared walker. #4927 has landed, and #5258 (the durable stepper as a host on that walker) must land first.

    The forks

    1. Writes next to reads: Barrier. Some steps can act outside the run: a step with a write or unknown connector action, and any agent, subautomation, approval or question step. Such a step waits for every step above it and holds back every step below it. Writes keep today's order exactly.
    2. Steps at once in the first release: 1. AUTOMATION_PARALLEL_STEPS ships with a default of 1. A separate change raises it to 4 after the benchmark and a canary on one deployment.
    3. A model step without retry: Retry on a rate limit or an unavailable provider. That is 3 attempts, 5 s then 10 s, with Retry-After honoured up to maxDelay. retry: false opts out. Connector steps retry only when retry is written. No action declares idempotency today, so every write retries on a rate limit only.
    4. The shipped packs: their model and read forEach steps get concurrency: 5.
    5. Largest concurrency: 10.

    Rules

    • concurrency is an integer from 1 to 10, on forEach only. Validation refuses it on repeatUntil, and refuses a value above 1 on any barrier type instead of quietly ignoring it. Output, effects, item errors and onItemError outcomes stay in item order.
    • retry is allowed on model and connector steps only: {attempts 1-5, delay 1s-1h, backoff fixed|exponential, maxDelay up to 1h, on} or false. invalid_output applies to model steps only.
    • Under forEach, retries apply per item, and an item counts as failed for onItemError only after its attempts are used up. Every attempt reuses the idempotency key. An approval granted for a write covers its attempts.
    • A wait of 15 s or less happens in the turn. A longer wait drains in-flight work, starts nothing new, and parks the run without a lease until the earliest wake time. The park is an additive checkpoint field, and an engine that ignores it runs the step again with the same idempotency key.
    • When a step fails, nothing new starts, in-flight work finishes, and the run reports the first failing step in document order.
    • Each run has one commit lane for checkpoints, the cursor and the record. Only one iterating step holds the cursor at a time, and a step that waits for a person never shares a wave.
    • Budget: a refused reservation waits while a sibling holding a reservation is in flight, and fails only when none is. Concurrency never refuses a call that a one-at-a-time run would have made. Each attempt reserves and books on its own.
    • A run has at most 10 bodies in flight. AUTOMATION_ORG_CONCURRENCY stays. There is no protocol bump and no migration. An old API replica refuses the new fields, and the release notes say so.

    Why. The barrier makes concurrency a pure speed change for anything that touches the outside world. Refusing concurrency where it cannot apply keeps documents honest. The park, retry-order and approval rules close the gaps where concurrency and retries meet. Parallel steps, the riskiest part, start at 1 and change only after a canary, while item concurrency, where the packs gain 5-6x, ships first. Model retries fit AUTO-R13. A cap of 10 can be raised later without breaking documents.

    Implementation units (base feature-train). Each behaviour unit carries its own spec rule, named tests, docs and manual box.

    1. refactor(platform): step live runs as a host on the shared walker #5258: the stepper becomes a host on the shared walker, with no change in behaviour.
    2. Accept concurrency and retry: types, validation, analysis, the editor's schema and a release note.
    3. One commit lane per run.
    4. A forEach step's items several at a time, with the budget-wait rule and at most 10 in flight.
    5. Retry after a wait: failure classes, defaults, per-item order, waits in the turn or parked.
    6. Independent steps side by side behind AUTOMATION_PARALLEL_STEPS (default 1): the barrier and the failure rule.
    7. The canvas and the Steps view show concurrency and retries, with locale strings in every locale.
    8. The packs' model and read forEach steps run five items at a time.
    9. After the benchmark and the canary, the default for steps becomes 4.

    Cross-issue amendments (decisions taken together with #4936, #4929):

  3. added
    agent-ready
    and removed
    needs discussion
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyimprovementperfservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions