Skip to content

Surface per-iteration / per-region step logs in run observability (ADR-0031 follow-up) #1505

@os-zhuang

Description

@os-zhuang

Follow-up to ADR-0031 / #1479 (now complete).

AutomationEngine.runRegion() (the executor for the loop body, parallel branches, and try_catch regions) currently runs each region against a region-local StepLogEntry[] that is not merged into the parent run's step log. There's a TODO(#1479) marking this in packages/services/service-automation/src/engine.ts:

// TODO(#1479): merge region step logs into the parent run log so
// per-iteration body steps surface in run observability.
const regionSteps: StepLogEntry[] = [];

Impact

Run logs (listRuns / getRun) show the container node (loop/parallel/try_catch) as a single step, but not the body/branch/handler steps that executed inside it, nor per-iteration detail for loops. This is a gap for debugging and audit.

Scope

  • Thread the parent steps array (or a child grouping) into runRegion so body steps are recorded.
  • Decide on representation: flat append vs nested/grouped (e.g. parentNodeId + iteration index on each entry) so a loop's N iterations are distinguishable.
  • Extend StepLogEntry if grouping metadata is needed; update engine.test.ts accordingly.
  • Mind concurrency for parallel branches (single-threaded JS, but interleaved at await points — appends must stay consistent).

Executors don't currently receive the steps array, so this is a deliberate engine-level change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions