Skip to content

update test - #1189

Merged
isamu merged 1 commit into
receptron:mainfrom
isamu:updateTest
Aug 11, 2025
Merged

isamu merged 1 commit into
receptron:mainfrom
isamu:updateTest

Conversation

@isamu

@isamu isamu commented Aug 11, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • New Features

    • Added support for multi-step tool interactions, enabling the assistant to initiate tool calls, process tool responses, and continue the conversation seamlessly.
    • Improved message sequencing to reflect tool invocation, tool results, and follow-up assistant messages.
  • Tests

    • Expanded test coverage to validate multi-turn tool flows, including tool call propagation and subsequent assistant responses.
    • Renamed and added test cases to cover no-tool and next-step scenarios, with updated expectations and inputs.

@coderabbitai

coderabbitai Bot commented Aug 11, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adds multi-step tool orchestration to the llmDummy test agent and updates the test to validate tool_calls propagation across assistant/tool turns, including a follow-up assistant turn signaling continuation.

Changes

Cohort / File(s) Summary of Changes
Tests: tools agent multi-turn orchestration
llm_agents/tools_agent/tests/test_tools.ts
Implements desugaring from namedInputs, emits assistant messages with tool_calls when a tool is present, handles post-tool assistant continuation (“tool”), renames/extends tests (“no tools”, “with next”), updates tool args (hello tokyo!!), and adjusts expected message sequence (assistant with tool_calls → tool response → assistant).

Sequence Diagram(s)

sequenceDiagram
  participant U as User/Test
  participant A as llmDummy Agent
  participant T as Tool

  U->>A: Send messages (namedInputs)
  A-->>U: Assistant with tool_calls (when tool is set)
  A->>T: Invoke tool with arguments
  T-->>A: Tool response (role: tool)
  A-->>U: Assistant message "tool" (continue flow)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • add test #1187: Also modifies the same test to validate multi-step tool_calls flow (textSpeech/hasNext), indicating a directly related tool orchestration test evolution.

Poem

I twitch my whiskers, tap-tap the keys,
Tools hop in sequence, as smooth as a breeze.
One call, then another—responses in queue,
“Hello Tokyo!!” and onward we chew.
In multi-turn meadows, assertions take flight—
A rabbit debugs by the moon’s gentle light. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
llm_agents/tools_agent/tests/test_tools.ts (3)

47-56: Avoid duplicating tool_calls at top-level and inside message unless both are required

You return tool_calls both in message.tool_calls and at the top level, plus tool. If toolsAgent only needs tool and the assistant message carries tool_calls, consider dropping the top-level tool_calls to reduce duplication. If both are required by consumers, keep as-is.

If optional, a minimal trim could be:

   if (tool) {
     return {
       message: {
         role: "assistant",
         tool_calls: [tool],
       },
-      tool,
-      tool_calls: [tool],
+      tool,
     };
   }

88-90: tools: [{}] placeholder may confuse schema expectations

You pass tools: [{}] in tests with a comment explaining it’s a placeholder. If permissible, consider tools: [] for the “no tools” case or a minimal valid schema object where a tool is expected. This reduces confusion around what fields are actually required by toolsAgent.

Example for the “no tools” case:

-          tools: [{}], // In fact, you set the tools schema here.
+          tools: [],

Also applies to: 124-126, 191-193


170-170: Use a clearer continuation signal than literal "tool"

A magic string like "tool" can be brittle. Consider a clearer sentinel (e.g., "continue") or an explicit flag (e.g., continue: true) in the agent output, and assert on that in tests.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 423b3df and 4985456.

📒 Files selected for processing (1)
  • llm_agents/tools_agent/tests/test_tools.ts (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
llm_agents/tools_agent/tests/test_tools.ts (1)
agent_filters/http_client_agent_filter/lib/http_client.js (1)
  • messages (34-34)
🔇 Additional comments (4)
llm_agents/tools_agent/tests/test_tools.ts (4)

29-46: Tool-selection logic reads cleanly and returns null when no tool is applicable

The desugaring from prompt to a specific tool call is straightforward and correctly falls back to null.


41-41: Argument update for textSpeach scenario is consistent with the new expectations

The updated arguments align with the test’s expected transcript.


69-69: LGTM: default assistant reply

The neutral assistant response for the no-tool path matches the test.


57-64: Prompt forwarding on follow-ups is correctly omitted
Verified that only messages—not prompt—are passed in the follow-up LLM call, so the continuation guard (last.role === "tool") will fire and prevent an infinite loop.

• In src/tools_agent.ts, under toLLMToolCallAgentResponse.graph.nodes.toolsResponseLLM, the inputs object is { messages: ":toolsMessages" } with no prompt field.
• The initial LLM invocation still uses prompt: userInput.text, but all subsequent calls derive solely from the accumulated messages array.


const llmDummy: AgentFunction = async ({ namedInputs }) => {
const { prompt } = namedInputs;
const { prompt, messages } = namedInputs;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Default messages to an empty array to avoid undefined access

messages may be undefined; accessing messages.length would throw. Default it defensively.

-  const { prompt, messages } = namedInputs;
+  const { prompt, messages = [] } = namedInputs;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const { prompt, messages } = namedInputs;
const { prompt, messages = [] } = namedInputs;
🤖 Prompt for AI Agents
In llm_agents/tools_agent/tests/test_tools.ts around line 27, the test
destructures namedInputs but does not provide a default for messages, so
messages can be undefined and accessing messages.length will throw; fix by
defaulting messages to an empty array when destructuring (or immediately after)
so subsequent code can safely call array methods.

@isamu
isamu merged commit b658ad0 into receptron:main Aug 11, 2025
This was referenced Aug 15, 2025
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