Repository navigation
feat(tool): expose owned background progress handles - #69
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
A mutable tool that returns before its background work finishes cannot retain its borrowed
ToolContextto report progress. AddToolContext::progress()andParallelToolContext::progress(), returning an owned, cloneableToolProgresshandle. Updates immediately reach the parent's existing progress event stream and synchronous taps with the originating call id and name, including after the call or run returns.Progress remains transient: it does not enter model context, enqueue deferred items, or trigger another model round. Existing deferred-result ordering and final-answer behavior are unchanged. This addresses the remaining progress gap in #67; deferred results themselves already shipped in 0.32.0.
Regression coverage
Controlled provider streams exercise mutable and parallel tools and verify delivery after the tool returns but before the next round boundary, ordered broadcast/tap delivery, parent isolation, no duplicate events or extra rounds, and reporting after the run ends. Both new tests and three existing progress tests pass.
Validation
Verified locally on macOS with cached dependencies (
--offline):cargo +1.97.1 fmt --all --checkcargo +1.97.1 clippy --workspace --all-targets --all-features -- -D warningscargo +1.97.1 test --workspace --all-features: 1,672 passed; 2 existing ignored smoke testscargo +1.97.1 test -p mentra --no-default-features: 1,284 passed; 2 existing ignored smoke testscargo +1.88.0 check --workspace --all-targets --all-featuresThe test suites passed with loopback access enabled for their local server fixtures. All six checks in PR CI run 39773275211 passed on
87e22b1b781292027ee486fb8aefa5e769fcc517: documentation, defaults-off tests, Rust 1.88, and format/lint/tests on Linux, macOS, and Windows.Documentation CI fix
The documentation gate exposed an unresolved
media_typelink inmentra/src/media.rs:6, also reproduced on untouched main ate30dc0af3d10b5ba778d2b2e3f03009981996225. Qualify the target ascrate::media::media_typeso rustdoc resolves it consistently.RUSTDOCFLAGS='-D warnings' cargo +1.97.1 doc --offline --workspace --no-deps --all-featuresnow passes, and the generated link was verified to point to the function page.SSE timeout test CI fix
The defaults-off CI run exposed a race in
bounds_the_initialized_notification_post: the fixture signals that a POST arrived before selecting its reply, so queuing the stall after that signal could stallinitializeinstead ofnotifications/initialized. Queue both replies before advertising the POST endpoint. A temporary 50 ms delay between the fixture signal and reply selection reproduced the exact CI failure before the change and passed afterward; the delay was removed from the final patch. The test keeps its existing timeout and no-tools/listassertions.