Skip to content

Textmatcher timeouts#1477

Merged
inducer merged 3 commits intomainfrom
textmatcher-timeouts
Apr 18, 2026
Merged

Textmatcher timeouts#1477
inducer merged 3 commits intomainfrom
textmatcher-timeouts

Conversation

@inducer
Copy link
Copy Markdown
Owner

@inducer inducer commented Apr 16, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a subprocess-based timeout mechanism to prevent long-running SymPy-based text answer matching from hanging, and wires it into the text question matchers.

Changes:

  • Introduce call_with_timeout() (multiprocessing-based) and a TIMED_OUT sentinel in relate.utils.
  • Update SymPy-based matchers in course/page/text.py to evaluate/compare expressions under a time limit and provide timeout feedback.
  • Add unit tests for call_with_timeout and update basedpyright configuration/baseline to support Sentinel.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
relate/utils.py Adds call_with_timeout() and TIMED_OUT sentinel used to bound execution time in subprocesses.
course/page/text.py Uses the timeout helper to protect SymPy evaluation in SymbolicExpressionMatcher and FloatMatcher.
tests/test_relate_utils.py Adds unit tests validating success/timeout/exception behavior for call_with_timeout().
pyproject.toml Enables basedpyright experimental features needed for Sentinel typing.
.basedpyright/baseline.json Updates static-type baseline to account for the new code/tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread course/page/text.py
Comment thread course/page/text.py Outdated
Comment thread relate/utils.py
Comment thread relate/utils.py
Comment thread course/page/text.py Outdated
Comment thread course/page/text.py
@inducer inducer force-pushed the textmatcher-timeouts branch 3 times, most recently from a8a223a to a15dbde Compare April 16, 2026 21:42
@inducer inducer force-pushed the textmatcher-timeouts branch from a15dbde to 78211a2 Compare April 18, 2026 16:59
@inducer inducer enabled auto-merge (rebase) April 18, 2026 17:01
@inducer inducer merged commit 550b8c5 into main Apr 18, 2026
18 checks passed
@inducer inducer deleted the textmatcher-timeouts branch April 18, 2026 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants