Closed hudson-ai closed 1 month ago
Ping @mmoskal (for some reason, I can't mark you as a reviewer... not in the org?)
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 61.47%. Comparing base (
edd8b87
) to head (e406a70
). Report is 1 commits behind head on main.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
LGTM. Really nice find and solution @hudson-ai.
Puts
_self_call_placeholder_
inthreading.local()
to prevent other threads from tricking the decorator into thinking we're in a recursive call.Small note: the thread-local storage is in the wrapped function's closure, not an attribute on the function itself.
Tests would be nice, but annoyingly I can only stochastically reproduce the issue as it is due to a race condition. Increasing the number of threads and/or jobs might make the bug occur with higher probability though -- happy to add @mmoskal's repro if we're all okay with a slightly stochastic test...
Closes https://github.com/guidance-ai/guidance/issues/1031