Skip to content

fix(moa): preserve caller tool schemas - #1344

Merged
michaelneale merged 1 commit into
mainfrom
fix/moa-preserve-tool-schemas
Aug 15, 2026
Merged

fix(moa): preserve caller tool schemas#1344
michaelneale merged 1 commit into
mainfrom
fix/moa-preserve-tool-schemas

Conversation

@michaelneale

@michaelneale michaelneale commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • remove natural-language heuristics that narrowed caller-provided tool schemas on MoA actor and continuation turns
  • preserve every caller-provided schema unless an explicit forced/allowed subset applies
  • retain forced tool_choice behavior as a single-tool subset
  • add a multi-turn read_file -> read_file -> write_file regression

Why

MoA's schema relevance classifier recognized write, file_write, and edit_file, but not the common schema name write_file. A read-then-write workflow therefore gave the actor only read_file; after each tool result the recent read chain stayed selected and the reducer genuinely could not call write_file.

Tool availability is an API contract, not something MoA should infer from prompt wording. This deletes that heuristic class rather than adding another alias.

Verification

At commit e8dc0e8d216a543fb22ed856696838e7b5a88ae2:

  • cargo test -p mesh-mixture-of-agents (174 unit tests plus complete crate integration/doc suite; 10 network/cost tests remain explicitly ignored)
  • cargo clippy -p mesh-mixture-of-agents --all-targets -- -D warnings
  • cargo fmt --check
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes
    • Tool-enabled requests now preserve all caller-provided tools instead of filtering them based on prompt wording.
    • Explicitly permitted tool subsets remain respected.
    • Forced tool selections continue to use only the specified tool.
    • Chained tool interactions now retain the schemas needed for subsequent read and write operations.

Co-authored-by: michaelneale <14976+michaelneale@users.noreply.github.com>
Signed-off-by: michaelneale <14976+michaelneale@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f5b8029-1683-420f-8f0e-aa867ccbd8a3

📥 Commits

Reviewing files that changed from the base of the PR and between bb88017 and e8dc0e8.

📒 Files selected for processing (3)
  • crates/mesh-mixture-of-agents/src/context.rs
  • crates/mesh-mixture-of-agents/src/lib.rs
  • crates/mesh-mixture-of-agents/src/tool_turn.rs

📝 Walkthrough

Walkthrough

Tool selection no longer filters tools by prompt text. Query and tool-result paths preserve all caller-provided tools unless allowed_tools restricts them. Tool turns honor forced_tool, and tests verify selection and schema preservation.

Changes

Tool selection behavior

Layer / File(s) Summary
Selection policy and forced tools
crates/mesh-mixture-of-agents/src/lib.rs, crates/mesh-mixture-of-agents/src/tool_turn.rs
Selection helpers now return all session tools or the caller-authorized subset. Forced tool turns select only the forced tool. Obsolete prompt-based selection logic was removed.
Query and reducer integration
crates/mesh-mixture-of-agents/src/lib.rs, crates/mesh-mixture-of-agents/src/context.rs
Query and tool-result handling pass the selected tools to context packing. Tests verify preservation of multiple tool schemas and restriction by explicit allowed-tool lists.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to e8dc0

The change preserves caller-provided tool schemas while retaining explicit forced subsets, with regression coverage for the affected multi-turn workflow; no actionable merge-blocking risk remains after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant QueryHandling
  participant ToolSelection
  participant ReducerContextPacking
  Caller->>QueryHandling: provide tools or allowed_tools
  QueryHandling->>ToolSelection: derive selected tools
  ToolSelection-->>QueryHandling: all tools or allowed subset
  QueryHandling->>ReducerContextPacking: pass selected tool schemas
  ReducerContextPacking-->>Caller: packed context with selected schemas
Loading

Possibly related PRs

Suggested reviewers: ndizazzo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving caller-provided tool schemas in MoA.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/moa-preserve-tool-schemas

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.

❤️ Share

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

@michaelneale
michaelneale merged commit 87346ef into main Aug 15, 2026
40 checks passed
@michaelneale
michaelneale deleted the fix/moa-preserve-tool-schemas branch August 15, 2026 09:20
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