Repository navigation
Bound managed inference and cancel work on caller exit - #28
Draft
mtwilliams wants to merge 1 commit into
Draft
mtwilliams wants to merge 1 commit into
mtwilliams wants to merge 1 commit into
Conversation
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ortex.run/3adds finite:timeoutdeadlines and monitored ownership for bounded or explicitly controlled calls. Timeout raises Ortex.TimeoutError, requests native termination, and bounds caller wait. Caller death cancels the worker. An executing NIF retains resources until cooperative native termination completes; a kernel may hold the session longer than the caller deadline. Unbounded calls without a control keep the synchronous path.A watcher owns the worker and monitors its caller. Reply aliases suppress late results, monitor/reply messages are cleaned up, and worker errors retain their original stack. Completed/validation-failed workers do not cancel unrelated legitimate attempts using a reused or mismatched control. Control preparation uses dirty CPU independently of inference's dirty I/O mutex waits. Telemetry records deadline/mode and timeout exceptions in the caller span.
Validation: 216 checks passed on runtimes 1.17.3 and 1.24.4, including actual loop deadlines, caller death, queued deadlines, post-cancel inference, worker resource/exception ownership, reuse during an active attempt, and late-result/monitor races. Two optional ResNet checks excluded. Pool/environment regressions, formatting, and warnings-as-errors compile passed. Stacked on #27; fork only. Task commit unsigned because the signing agent cancels requests.
Required follow-up in the stack: #31 reserves ownership before worker/deadline creation, preventing a duplicate call from cancelling the legitimate original attempt before native entry. Review/merge the complete stack together.