Skip to content

Simplify the tool declarations - #6

Closed
SomeoneToIgnore wants to merge 2 commits into
cppalliance:masterfrom
SomeoneToIgnore:kb/better-tool-declarations
Closed

SomeoneToIgnore wants to merge 2 commits into
cppalliance:masterfrom
SomeoneToIgnore:kb/better-tool-declarations

Conversation

@SomeoneToIgnore

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The new behavior reaches plugin tools that opt into the typed Pack API.

The PR appears safe to merge, with a non-blocking documentation gap around shared tool state.

Findings

  1. P2 Shared tool lifetime is undocumented ▶
Fix with agent prompt
### Issue 1
crates/runvil-plugin/src/tool.rs:41
`Tools` keeps each tool alive in the factory and shares that same object across every run. The new docs do not explain this, while the surrounding `Pack` docs describe per-run instances. Authors may therefore expect tool state to reset when a run ends.

Document that mutable tool state is shared across runs and that a tool's `Drop` does not run when a run ends. Authors who need per-run state should use their own `PackFactory`.

```suggestion
/// A [`PackFactory`] whose Pack offers each [`Tool`] added to it.
///
/// Every run shares the same tool objects, including their mutable state.
/// A tool's `Drop` does not run when a run ends. Use a custom
/// [`PackFactory`] when tools need per-run state.
```

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds Tool and Tools to let plugins declare typed arguments and outputs with less boilerplate.

  • Rust tool types now build Packs with matching schemas and JSON results.

Reviews (1) · Last reviewed commit: "Simplify the tool declarations" · Reviewed by Greptile

) -> impl Future<Output = Result<Self::Output, Error>> + Send;
}

/// A [`PackFactory`] whose Pack offers each [`Tool`] added to it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Shared tool lifetime is undocumented

Tools keeps each tool alive in the factory and shares that same object across every run. The new docs do not explain this, while the surrounding Pack docs describe per-run instances. Authors may therefore expect tool state to reset when a run ends.

Document that mutable tool state is shared across runs and that a tool's Drop does not run when a run ends. Authors who need per-run state should use their own PackFactory.

Suggested change
/// A [`PackFactory`] whose Pack offers each [`Tool`] added to it.
/// A [`PackFactory`] whose Pack offers each [`Tool`] added to it.
///
/// Every run shares the same tool objects, including their mutable state.
/// A tool's `Drop` does not run when a run ends. Use a custom
/// [`PackFactory`] when tools need per-run state.
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/runvil-plugin/src/tool.rs
Line: 41

Comment:
**Shared tool lifetime is undocumented**

`Tools` keeps each tool alive in the factory and shares that same object across every run. The new docs do not explain this, while the surrounding `Pack` docs describe per-run instances. Authors may therefore expect tool state to reset when a run ends.

Document that mutable tool state is shared across runs and that a tool's `Drop` does not run when a run ends. Authors who need per-run state should use their own `PackFactory`.

```suggestion
/// A [`PackFactory`] whose Pack offers each [`Tool`] added to it.
///
/// Every run shares the same tool objects, including their mutable state.
/// A tool's `Drop` does not run when a run ends. Use a custom
/// [`PackFactory`] when tools need per-run state.
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@SomeoneToIgnore
SomeoneToIgnore marked this pull request as draft November 13, 2026 16:55
@SomeoneToIgnore
SomeoneToIgnore force-pushed the kb/better-tool-declarations branch from 21476a1 to 657c59b Compare November 16, 2026 13:21
@SomeoneToIgnore

Copy link
Copy Markdown
Author

Seems that we do not need to change the entire API for this case, https://github.com/cppalliance/runvil-plugin-api/compare/master...SomeoneToIgnore:runvil-plugin-api:kb/json-helper?expand=1 is enough, hence closing for now.

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.

1 participant