Clear fatal-error interrupt window unconditionally on body exit
Merged
MA
2mo ago+91+91+01234567890123456789-10-10-01234567890123456789
Type of change
- Bug fix (non-breaking change which fixes an issue)
Changes To Core Features:
- Have you added an explanation of what your changes do and why you'd like us to include them?
- Have you written new tests for your core changes, as applicable?
- Have you successfully ran tests with your changes locally?
Description
Follow-up to #6990 (merged while this review round was in flight), addressing the two review threads that were still open there:
- cubic's finding is valid:
run_concurrently_contextclearedin_bodyonly on the normal post-body path and in theKeyboardInterrupthandler. If the with-body raises any other exception,in_bodystaysTrueā and since the executor shuts down withwait=False, a task failing after the context has unwound could still deliver a stray SIGINT into unrelated caller code. The fix wraps theyieldin atry/finallythat clearsin_bodyhowever the body exits, replacing the two scattered clears ā a net simplification of the mechanism, not an addition (per the review discussion, no extra guarded setup path). - greptile's nit: the hang regression test's bare
5-second assertion threshold now carries a comment explaining its relationship to the body's 10s wait.
Adds test_run_concurrently_context_no_interrupt_after_body_exception, which pins the escaped-interrupt case (late-failing task + body exception ā the body's own ValueError propagates, no stray KeyboardInterrupt).
Test Plan
uv run pytest tests/units/utils/test_processes.py -k run_concurrently: 4 passed (the new test plus the three from #6990).uv run ruff check/ruff format --checkclean on changed files;uv run pyright0 errors on changed files.reflex-release changelog-check --base-ref origin/mainpasses.- The two
test_is_process_on_port_*failures in this sandbox are pre-existing on clean main here (container network stack), unrelated to the diff.
š¤ Generated with Claude Code
https://claude.ai/code/session_01EMjBXPozsNeQNSBZecNH8x
Generated by Claude Code