Introduce ToolBuildContext for tool construction#122
Conversation
|
Warning Review limit reached
More reviews will be available in 55 minutes and 45 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThis PR introduces Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/reloaded-code-agents/src/path/resolver.rs (1)
80-82: 💤 Low valueDocumentation inconsistency:
build_contextdoes not contain permission config.The doc comment states
build_contextcontains "permission config" butToolBuildContextonly holds thepermission: Option<&Ruleset>, not theIndexMap<String, PermissionRule>config which is passed as a separate parameter. Consider updating to:-/// - `build_context` - [`ToolBuildContext`] containing permission config and -/// canonicalized workspace root. +/// - `build_context` - [`ToolBuildContext`] containing the canonicalized workspace root +/// and optional permission ruleset. +/// - `config` - Permission config map used to look up tool-specific rules.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/reloaded-code-agents/src/path/resolver.rs` around lines 80 - 82, The doc comment for the function is incorrect: it claims `build_context` contains the "permission config" but `ToolBuildContext` only holds `permission: Option<&Ruleset>` while the actual permission rules map is passed separately (e.g. `permission_config: &IndexMap<String, PermissionRule>`). Update the comment to state that `build_context` provides an optional `Ruleset` reference (via `ToolBuildContext`) and that the canonical permission rules map is supplied by the separate `permission_config` parameter (mention `PermissionRule` and `Ruleset`), so callers understand which symbol holds the full ruleset vs the per-tool optional rules.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/reloaded-code-agents/src/path/resolver.rs`:
- Around line 80-82: The doc comment for the function is incorrect: it claims
`build_context` contains the "permission config" but `ToolBuildContext` only
holds `permission: Option<&Ruleset>` while the actual permission rules map is
passed separately (e.g. `permission_config: &IndexMap<String, PermissionRule>`).
Update the comment to state that `build_context` provides an optional `Ruleset`
reference (via `ToolBuildContext`) and that the canonical permission rules map
is supplied by the separate `permission_config` parameter (mention
`PermissionRule` and `Ruleset`), so callers understand which symbol holds the
full ruleset vs the per-tool optional rules.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a787738c-40da-4dce-8b47-b1651bd773c9
📒 Files selected for processing (4)
src/reloaded-code-agents/src/path/resolver.rssrc/reloaded-code-core/src/lib.rssrc/reloaded-code-core/src/tool_context/mod.rssrc/reloaded-code-serdesai/src/agent_runtime/build.rs
…sions through tool construction - Add ToolBuildContext struct in reloaded-code-core with canonicalized workspace root and optional permission ruleset - Refactor build_resolver_for_tool to accept &ToolBuildContext instead of separate config and workspace_root parameters - Update reloaded-code-agents resolver and tests to use new context - Update reloaded-code-serdesai runtime to create one context before tool construction loop
97cd01d to
6a58235
Compare
Summary
Bundle workspace root and permissions into a single object passed when building tools, instead of sending them separately to every tool.
Motivation
Every tool builder needed the workspace root and permission config passed in individually. The workspace root also got canonicalized repeatedly. This groups those shared values into one object that's created once and reused.
Changes
ToolBuildContextstruct holds the canonicalized workspace root and optional permissionsbuild_resolver_for_toolnow takes this context instead of separate arguments