You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MAINT: Make batch_task_async generic over the task result (unsound-assignment follow-up) #4550
PR #4544 (UA-2 of #4402) fixed the unsound-assignment finding in PromptNormalizer.send_prompt_batch_to_target_async with a local cast("list[Message]", ...), because the root cause is out of UA-2's scope: batch_task_async in pyrit/prompt_target/batch_helper.py takes task_func: Callable[..., Any] and returns list[Any], even though it always returns one task_func result per batched item.
The arguments side stays Callable[..., ...] — the helper builds kwargs dynamically from task_arguments strings, so a ParamSpec can't model it. The win is the return type.
pyrit/score/scorer.py (two call sites, ~1636 and ~1672): the results are only documented as list[list[Score]] by a comment today; they become statically typed.
I would like to take this. Plan: add a _BatchResult TypeVar to batch_task_async so the return type is inferred from task_func, remove the cast in send_prompt_batch_to_target_async, and tighten the scorer / scorer_evaluator call sites, keeping make ty clean and the existing unit tests unchanged. Roman Lutz (@romanlutz) please share your thought
Activity
szKubica commentedon Nov 21, 2026
I would like to take this. Plan: add a
_BatchResultTypeVar tobatch_task_asyncso the return type is inferred fromtask_func, remove thecastinsend_prompt_batch_to_target_async, and tighten the scorer / scorer_evaluator call sites, keepingmake tyclean and the existing unit tests unchanged.Roman Lutz (@romanlutz) please share your thought