Apply review feedback: trace panic safety, cost pre-check, parallel JoinSet, ToolFuture alias#137
Merged
Apply review feedback: trace panic safety, cost pre-check, parallel JoinSet, ToolFuture alias#137
Conversation
- trace.rs: Clarify SpanGuard::drop comment to explain it handles panics - cost.rs: Pre-check budget before applying delta to avoid fail-open overrun - graph.rs: Use JoinSet for parallel execution; collect results as tasks finish - tool.rs: Add ToolFuture<'a> type alias to simplify ClosureTool signatures" Co-authored-by: Tuntii <121901995+Tuntii@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add AI-native runtime to RustAPI project
Apply review feedback: trace panic safety, cost pre-check, parallel JoinSet, ToolFuture alias
Feb 25, 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.
Four targeted fixes addressing reviewer feedback on the AI-native runtime crates.
rustapi-context—trace.rsSpanGuard::drop: Clarified comment — this is a panic-safety path, not a general "forgot to call complete" warning. Explicit callers usemem::forgetto skip it; theDropimpl only fires on unwinding.rustapi-context—cost.rsCostTracker::record: Switched from fail-open (apply → check) to pre-check (check projected totals → apply only if within limits). A rejected call no longer mutates any atomic counters. Added a doc-comment concurrency note explaining the intentional TOCTOU trade-off in the lock-free design.rustapi-tools—graph.rsToolNode::Parallel: ReplacedVec<JoinHandle>+ sequential in-order awaiting withtokio::task::JoinSet. Results are collected as tasks complete rather than in submission order; a first failure immediately callsset.abort_all().rustapi-tools—tool.rsClosureTool: Added aToolFuture<'a>type alias for the fullPin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'a>>type. AllClosureToolbounds now use the alias:💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.