SIGN IN SIGN UP

fix: fire wait_for_done callback for already-terminal tasks (QA-3371) (#161)

wait_for_done invoked the caller-supplied callback only from inside the
polling `while` loop. A task that was already terminal (ready/failed) at
entry skipped the loop body entirely, so the callback never fired; the
initial observed status of in-progress tasks was also skipped.

Invoke the callback once immediately after the initial fetch (before the
loop) in all four implementations, keeping the in-loop invocation unchanged:
- TaskClientWrapper / AsyncTaskClientWrapper (tasks.wait_for_done)
- EmbedTasksClientWrapper / AsyncEmbedTasksClientWrapper (embed.tasks.wait_for_done)

No change to public signatures, defaults, the sleep_interval<=0 validation,
the retry/print behavior, done_statuses, or the return value. Adds
tests/custom/test_wait_for_done.py (cases 1-5 x 4 methods + retry-path).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
G
Genie committed
5ad32601b3b607cf1def4bc6b10f75dde868e9bb
Parent: 729a0b0
Committed by GitHub <noreply@github.com> on 6/4/2026, 2:25:57 AM