{ "name": "nested-loop-sees-outer-item", "description": "A node inside a nested loop must still be able to reference the OUTER loop's item. Reproduces the Email OCR failure of 2026-09-04: build_email sits in a loop over one email's attachments, nested in a loop over emails, and {{email.from}} resolved to empty - so the reply was addressed to nobody and the send failed with \"At least one recipient is required\". The inner loop deliberately uses a different item variable name, and the assertion checks both are visible at once.", "nodes": [ { "id": "n1", "name": "Trigger", "type": "click-trigger", "position": { "x": 0, "y": 0 }, "config": {} }, { "id": "seed", "name": "Seed", "type": "code", "position": { "x": 0, "y": 100 }, "config": { "code": "return { mails: [{ from: 'a@example.com', parts: ['p1', 'p2'] }] };" } }, { "id": "outer", "name": "Outer", "type": "loop", "position": { "x": 0, "y": 200 }, "config": { "inputField": "result.mails", "itemVariableName": "email", "continueOnError": false } }, { "id": "inner", "name": "Inner", "type": "loop", "position": { "x": 240, "y": 200 }, "config": { "inputField": "data.parts", "itemVariableName": "part", "continueOnError": false } }, { "id": "build", "name": "Build", "type": "set-fields", "position": { "x": 480, "y": 200 }, "config": { "mode": "only-set", "fields": [ { "name": "outerFrom", "value": "{{email.from}}" }, { "name": "innerPart", "value": "{{part}}" } ] } }, { "id": "after", "name": "After", "type": "set-fields", "position": { "x": 240, "y": 340 }, "config": { "mode": "only-set", "fields": [ { "name": "done", "value": "yes" } ] } } ], "connections": [ { "sourceNodeId": "n1", "sourceOutput": "main", "targetNodeId": "seed", "targetInput": "data" }, { "sourceNodeId": "seed", "sourceOutput": "main", "targetNodeId": "outer", "targetInput": "data" }, { "sourceNodeId": "outer", "sourceOutput": "loop", "targetNodeId": "inner", "targetInput": "data" }, { "sourceNodeId": "inner", "sourceOutput": "loop", "targetNodeId": "build", "targetInput": "data" }, { "sourceNodeId": "outer", "sourceOutput": "done", "targetNodeId": "after", "targetInput": "data" } ], "expect": { "build": { "status": "completed", "output": { "outerFrom": "a@example.com", "innerPart": "p2" } } } }