Skip to content

docs(adr): ADR-0031 — structured control-flow (loop/parallel/try-catch), BPMN as interop - #1472

Merged
xuyushun441-sys merged 3 commits into
mainfrom
docs/adr-0031-advanced-flow-nodes
Jun 1, 2026
Merged

docs(adr): ADR-0031 — structured control-flow (loop/parallel/try-catch), BPMN as interop#1472
xuyushun441-sys merged 3 commits into
mainfrom
docs/adr-0031-advanced-flow-nodes

Conversation

@xuyushun441-sys

@xuyushun441-sysxuyushun441-sys commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What

A decision record (no code) reframing how flows model loop / parallel / error-handling — driven by the AI-authoring lens ([ADR-0010/0011]).

The pivot: instead of implementing the four BPMN token nodes (loop stub, parallel_gateway, join_gateway, boundary_event) as the native model, adopt structured control-flow constructs — a loopcontainer, a parallelblock, and try/catch/retry — as the native + AI-authored model. BPMN gateways/boundary stay in the protocol + bpmn-interop as the import/export representation that maps to/from the structured constructs.

Why (AI authoring is the design center): a free-form node+edge graph with gateways/boundary/back-edges is easy for an LLM to make semantically broken (orphan joins, unbalanced gateways, deadlocks, infinite cycles). Structured constructs are well-formed by construction, locally composable (AI emits a subtree), and statically analyzable/terminating — the right substrate for AI. (The per-item-subflow loop is worse for AI — it fragments one loop into two flows + I/O mapping.)

Decisions

  1. Loop = structured iteration container (bounded body region + after-path), not a back-edge, not a subflow.
  2. Parallel = structured block with implicit join at block end (engine-synchronized), not author-visible split/join gateways.
  3. Errors = structured try/catch/retry, surfacing the engine's existing fault edge + errorHandling.retry.
  4. DAG invariant kept — ordinary edges acyclic; iteration/parallel are scoped containers (so inline loops without losing termination analysis).
  5. BPMN gateways/boundary retained for interop only, mapped onto the constructs.
  6. AI authoring generates the constructs from the live registry (/automation/actions + configSchema); valid-by-construction.

Open question flagged: representation (A) marker-delimited scoped regions vs (B) nested sub-structure — decided in the implementation PR.

Sequenced: spec-define constructs → loop container → parallel block → try/catch → BPMN mapping. wait + subflow already shipped (subflow = reuse primitive, not the loop mechanism).

Docs-only; no package changes. Awaiting direction, then implementation follows the roadmap.

🤖 Generated with Claude Code

os-zhuangand others added 2 commits June 1, 2026 22:23
The 3 status state machines (task/project/account) covered transition
topologies but not the rule's other knobs. Round it out so the showcase
exercises — and verifies — the full state_machine surface:
- events: ['update'] on all three — state machines validate *transitions*,
so they should run on update only (insert sets the initial state). Makes
the intent explicit rather than relying on the insert short-circuit.
- New advisory `project_health_progression` with severity: 'warning' — health
should step one level at a time (green↔yellow↔red); a skip is flagged
(logged) but NOT blocked, demonstrating soft guards alongside the existing
error-severity (blocking) status flows.
Verified against the runtime: error-severity invalid transition → HTTP 400
`invalid_transition`; warning-severity skip (health green→red) → HTTP 200.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Records the decisions needed for loop/parallel_gateway/join_gateway/
boundary_event given (a) the engine's DAG-only invariant (detectCycles throws on
back-edges), (b) valued BPMN import/export (keep protocol BPMN-complete), and
(c) the multi-agent shared engine.ts. Proposes: keep DAG strict; ship DAG-safe
per-item-subflow loop + pass-through parallel split now; defer join/inline-loop/
runtime-boundary as ADR-gated engine work; drive authoring/AI from the live
executable registry. wait + subflow already shipped.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercelBot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 1, 2026 2:52pm

Request Review

…horing
Pivot from 'implement the four BPMN token nodes' to 'adopt structured
control-flow constructs (loop container, parallel block, try/catch/retry) as the
native + AI-authored model; keep BPMN gateways/boundary in the protocol as the
import/export representation that maps onto them.'
Rationale: AI authoring of flow metadata is the design center. Structured
constructs are well-formed by construction, locally composable, and
analyzable/terminating — whereas a free-form gateway/boundary/back-edge graph is
easy for an LLM to make broken (deadlocks, orphan joins, infinite cycles). Keeps
the DAG invariant (loops are scoped containers, not cycles); preserves BPMN
interop. Sequenced: spec-define constructs -> loop container -> parallel block ->
try/catch -> BPMN mapping.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xuyushun441-sysxuyushun441-sys changed the title docs(adr): ADR-0031 — advanced flow-node executors (loop/parallel/boundary) + the DAG invariantdocs(adr): ADR-0031 — structured control-flow (loop/parallel/try-catch), BPMN as interopJun 1, 2026
@xuyushun441-sys
xuyushun441-sys merged commit 8b8480d into mainJun 1, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the docs/adr-0031-advanced-flow-nodes branch June 1, 2026 14:53
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationsize/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang