Skip to content

feat(tool): expose owned background progress handles - #69

Merged
ahavili merged 5 commits into
mainfrom
fix/issue-67-deferred-progress
Oct 22, 2026
Merged

ahavili merged 5 commits into
mainfrom
fix/issue-67-deferred-progress

Conversation

@WendellXY

@WendellXY WendellXY commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

A mutable tool that returns before its background work finishes cannot retain its borrowed ToolContext to report progress. Add ToolContext::progress() and ParallelToolContext::progress(), returning an owned, cloneable ToolProgress handle. 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 --check
  • cargo +1.97.1 clippy --workspace --all-targets --all-features -- -D warnings
  • cargo +1.97.1 test --workspace --all-features: 1,672 passed; 2 existing ignored smoke tests
  • cargo +1.97.1 test -p mentra --no-default-features: 1,284 passed; 2 existing ignored smoke tests
  • cargo +1.88.0 check --workspace --all-targets --all-features
  • Diff whitespace and patch reverse-apply checks

The 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_type link in mentra/src/media.rs:6, also reproduced on untouched main at e30dc0af3d10b5ba778d2b2e3f03009981996225. Qualify the target as crate::media::media_type so rustdoc resolves it consistently. RUSTDOCFLAGS='-D warnings' cargo +1.97.1 doc --offline --workspace --no-deps --all-features now 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 stall initialize instead of notifications/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/list assertions.

@WendellXY WendellXY linked an issue Oct 22, 2026 that may be closed by this pull request
@WendellXY WendellXY self-assigned this Oct 22, 2026
@WendellXY
WendellXY marked this pull request as ready for review October 22, 2026 11:31
Copilot AI balanced review requested due to automatic review settings October 22, 2026 11:31

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@ahavili
ahavili merged commit b6423bc into main Oct 22, 2026
12 checks passed
@ahavili
ahavili deleted the fix/issue-67-deferred-progress branch October 22, 2026 12:06
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.

A tool can leave deferred items for its agent's next round

3 participants