Commit cf84e6b
fix: surface a deterministic exception from ParallelWorker on concurrent failures
asyncio.wait returns completed tasks as an unordered set. _ParallelWorker
iterated that set directly to pick the exception to raise, so when two or
more branches failed within the same wake-up, which branch's exception
surfaced depended on set iteration order (object-hash dependent). This made
failure output differ between runs — and between record and replay for
frameworks that resume or replay agent workflows and filter retries by
exception type (RetryConfig.exceptions).
Iterate completed tasks in input-index order instead, so the lowest-index
failed branch's exception is surfaced consistently. Behavior is otherwise
unchanged.
The regression test fails ~50% of the time without the fix (two branches
failing in the same wake-up) and always passes with it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>1 parent 40cf97b commit cf84e6b
2 files changed
Lines changed: 38 additions & 1 deletion
File tree
- src/google/adk/workflow
- tests/unittests/workflow
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1090 | 1090 | | |
1091 | 1091 | | |
1092 | 1092 | | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
0 commit comments