Commit e77e578
[bugf][agent][run_batched drops every task when imgs is omitted]
`run_batched` zips the tasks against `imgs` using `imgs` as the loop variable:
return [
self.run(task=task, imgs=imgs, *args, **kwargs)
for task, imgs in zip(tasks, imgs)
]
Three problems in four lines:
1. `imgs` defaults to None and is documented as optional, but `zip(tasks, None)`
raises `TypeError: 'NoneType' object is not iterable` — so the documented
basic call `agent.run_batched(["a", "b"])` never runs a single task.
2. The loop variable rebinds the parameter, so each `self.run` call receives
one image string in `imgs`, a field declared `List[str]` and passed straight
through to the provider call. The single-image parameter is `img`.
3. Unequal lengths zip to the shorter one, so passing fewer images than tasks
silently discards tasks rather than reporting the mismatch.
Now: no images runs the tasks plainly, paired images go through `img`, and a
length mismatch raises rather than dropping work. The docstring said
"concurrently" while the body was always a list comprehension; it now says
what it does. Making it actually concurrent is a behaviour change and belongs
in its own PR.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 9d8f6ef commit e77e578
2 files changed
Lines changed: 59 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3349 | 3349 | | |
3350 | 3350 | | |
3351 | 3351 | | |
3352 | | - | |
| 3352 | + | |
3353 | 3353 | | |
3354 | 3354 | | |
3355 | 3355 | | |
3356 | | - | |
| 3356 | + | |
| 3357 | + | |
3357 | 3358 | | |
3358 | 3359 | | |
3359 | 3360 | | |
3360 | 3361 | | |
3361 | 3362 | | |
3362 | 3363 | | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
3363 | 3379 | | |
3364 | | - | |
3365 | | - | |
| 3380 | + | |
| 3381 | + | |
3366 | 3382 | | |
3367 | 3383 | | |
3368 | 3384 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3170 | 3170 | | |
3171 | 3171 | | |
3172 | 3172 | | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
0 commit comments