Skip to content

Bundle builder tool-call payload (#42)#196

Draft
leynos wants to merge 1 commit into
mainfrom
issue-42-argument-count-in-builder-core-loop-helpers
Draft

Bundle builder tool-call payload (#42)#196
leynos wants to merge 1 commit into
mainfrom
issue-42-argument-count-in-builder-core-loop-helpers

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented May 22, 2026

Summary

This branch finishes the issue #42 argument-count refactor in the builder core loop by grouping the remaining tool-call response fields behind a private parameter object.

Closes #42.

Review walkthrough

  • Start with src/tools/builder/core/build_loop.rs to review the new ToolCallPayload parameter object and the updated handle_tool_calls signature.
  • Then review the RespondResult::ToolCalls branch in the same file to confirm the call site now constructs the payload without changing control flow.

Validation

  • cargo fmt --all: passed
  • cargo fmt --manifest-path tools-src/github/Cargo.toml --all: passed
  • make all: passed
  • Local argument-count check: handle_tool_calls is 4 explicit parameters, build_success_result is 3, fail_planning_stuck is 2, fail_max_iterations is 2, and the module average is 2.31.

Notes

  • CodeRabbit review was attempted with coderabbit review --agent, but the service returned a usage-credit rate-limit error before producing review findings.
  • This is a code-only internal refactor; no documentation label is needed because there are no documentation-only changes.

Summary by Sourcery

Refactor the builder core loop to bundle tool-call response data into a dedicated payload object passed to the tool-call handler.

Enhancements:

  • Introduce a ToolCallPayload struct to group tool_calls and content for tool-call handling in the builder loop.
  • Update the handle_tool_calls method and its call site to accept the new payload object without changing control flow.

Group the tool-call response fields behind a local parameter object so
`handle_tool_calls` meets the builder argument-count guideline.

Keep the refactor private to the build-loop module and preserve the
existing control flow, log strings, and result shapes.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 513b326c-874d-45d8-b38d-ee1a67facad2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-42-argument-count-in-builder-core-loop-helpers

Comment @coderabbitai help to get the list of available commands and usage tips.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 22, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refactors the builder core loop to bundle tool-call related arguments into a new ToolCallPayload struct, simplifying the handle_tool_calls signature while preserving existing control flow and behavior.

File-Level Changes

Change Details Files
Introduce ToolCallPayload struct to group tool-call response fields and update handle_tool_calls to use it.
  • Add ToolCallPayload struct encapsulating tool_calls and content fields.
  • Change handle_tool_calls signature to accept a ToolCallPayload instead of separate tool_calls and content parameters.
  • Update assistant_with_tool_calls invocation to read from the ToolCallPayload instance.
  • Adjust iteration over tool calls to consume payload.tool_calls.
src/tools/builder/core/build_loop.rs
Update the ToolCalls response handling branch to construct and pass ToolCallPayload without altering logic.
  • In the RespondResult::ToolCalls match arm, mark tools_executed and construct a ToolCallPayload from tool_calls and content.
  • Pass the constructed ToolCallPayload into handle_tool_calls, maintaining the previous control flow and async behavior.
src/tools/builder/core/build_loop.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#42 Refactor the four helper functions (handle_tool_calls, build_success_result, fail_planning_stuck, fail_max_iterations) in src/tools/builder/core/build_loop.rs to reduce their parameter counts to 4 or fewer by introducing parameter objects, without changing behaviour or the public API.
#42 Reduce the module’s average function-argument count below 4.00 while keeping control flow, log/error strings, and result shapes (user-visible messages/JSON) identical and ensuring all tests pass.
#42 Keep the refactor scoped to src/tools/builder/core/build_loop.rs and any strictly necessary internal helpers only.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@codescene-delta-analysis codescene-delta-analysis Bot left a comment

Choose a reason for hiding this comment

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

Gates Failed
Enforce advisory code health rules (1 file with Large Method)

Gates Passed
5 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Enforce advisory code health rules Violations Code Health Impact
build_loop.rs 1 advisory rule 8.96 → 8.58 Suppress

Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

Comment on lines +375 to +384
self.handle_tool_calls(
&inputs,
&mut bundle,
&mut state,
ToolCallPayload {
tool_calls,
content,
},
)
.await;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ New issue: Large Method
LlmSoftwareBuilder.execute_build_loop has 76 lines, threshold = 70

Suppress

@github-actions github-actions Bot added scope: tool/builder Dynamic tool builder size: S 10-49 changed lines risk: medium Business logic, config, or moderate-risk modules contributor: core 20+ merged PRs labels May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor: core 20+ merged PRs risk: medium Business logic, config, or moderate-risk modules scope: tool/builder Dynamic tool builder size: S 10-49 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Excess Number of Function Arguments: reduce argument count in builder core loop helpers

1 participant