Skip to content

remove googleSheetsAgent#1394

Merged
sweetmantech merged 1 commit into
mainfrom
sweetmantech/myc-3497-remove-googlesheetsagent
Nov 21, 2025
Merged

remove googleSheetsAgent#1394
sweetmantech merged 1 commit into
mainfrom
sweetmantech/myc-3497-remove-googlesheetsagent

Conversation

@sweetmantech

@sweetmantech sweetmantech commented Nov 21, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Refactor
    • Consolidated Google Sheets capabilities into the general agent.
    • Simplified agent routing by removing the dedicated routing layer.
    • Streamlined chat request handling to directly invoke the general agent.

✏️ Tip: You can customize this high-level summary in your review settings.

@cursor

cursor Bot commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 17.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@vercel

vercel Bot commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
recoup-chat Ready Ready Preview Nov 21, 2025 5:08pm

@supabase

supabase Bot commented Nov 21, 2025

Copy link
Copy Markdown

This pull request has been ignored for the connected project godremdqwajrwazhbrue because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The pull request consolidates the agent routing architecture by removing the dedicated routing layer and merging Google Sheets tools directly into the general agent. The routing agent and its decision logic are deleted, and the general agent now handles both general and Google Sheets tasks through a unified toolset.

Changes

Cohort / File(s) Summary
Agent Consolidation
lib/agents/googleSheetsAgent/getGoogleSheetsAgent.ts, lib/agents/routingAgent/getRoutingDecision.ts, lib/agents/routingAgent/routingAgent.ts
Removed dedicated agent modules: deleted Google Sheets agent creator, routing decision logic, and routing agent implementation.
General Agent Enhancement
lib/agents/generalAgent/getGeneralAgent.ts
Added import of getGoogleSheetsTools, now merges Google Sheets tools with existing tools via await statement.
Module Exports Simplification
lib/agents/googleSheetsAgent/index.ts, lib/agents/routingAgent/index.ts
Updated exports: changed getGoogleSheetsAgent to getGoogleSheetsTools in googleSheetsAgent index; removed all exports from routingAgent index.
Chat Setup Refactoring
lib/chat/setupChatRequest.ts
Replaced getRoutingDecision import and invocation with getGeneralAgent, eliminating routing logic from chat initialization.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant General Agent
    participant General Tools
    participant Google Sheets Tools
    
    rect rgb(200, 220, 240)
    Note over User,Google Sheets Tools: New Consolidated Flow
    User->>General Agent: setupChatRequest(body)
    General Agent->>General Tools: Load recoupTools
    General Agent->>Google Sheets Tools: await getGoogleSheetsTools(body)
    Google Sheets Tools-->>General Agent: Tools loaded
    General Agent->>General Agent: Merge tools
    General Agent-->>User: Agent ready with unified toolset
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Files to verify: Confirm all references to removed functions (getRoutingDecision, routingAgent, getGoogleSheetsAgent) have been updated or eliminated throughout the codebase.
  • Import paths: Verify that the new import path for getGeneralAgent in setupChatRequest.ts is correct and that no circular dependencies exist.
  • Google Sheets tool integration: Ensure the await pattern for getGoogleSheetsTools(body) properly handles async loading and tool merging within the general agent.

Possibly related PRs

Poem

🛣️ The routing fork is gone today,
One path now leads the agent's way—
With sheets and tools in harmony,
The general agent flows so free! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Solid & Clean Code ⚠️ Warning PR violates SRP and OCP by consolidating agent creation without defensive programming. Tool merging lacks collision detection, error handling, and extensibility mechanisms required for maintainable code. Add tool collision detection with logging, wrap getGoogleSheetsTools in try-catch, document merge strategy, and consider factory pattern for extensible tool registration.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sweetmantech/myc-3497-remove-googlesheetsagent

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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 and usage tips.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

  • ✅ No prior actionable review threads to mark resolved.
  • ⚠️ Logic: In lib/agents/generalAgent/getGeneralAgent.ts, merging recoupTools and googleSheetsTools with { ...recoupTools, ...googleSheetsTools } risks silent key collisions and unexpected overrides. Please ensure tool names are unique or namespace them to avoid masking tools.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +42 to +44
const recoupTools = setupToolsForRequest(finalExcludeTools);
const googleSheetsTools = await getGoogleSheetsTools(body);
const tools = { ...recoupTools, ...googleSheetsTools };

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate Composio tool setup when key is absent

The general agent now always calls getGoogleSheetsTools before constructing tools (lines 42-44), but that helper instantiates getComposioClient, which throws if COMPOSIO_API_KEY is missing (lib/composio/client.ts lines 4-8). Environments that previously handled non–Google Sheets chats without that key will now fail on every request during tool setup, preventing any chat from running. Consider skipping Sheets tooling or handling the missing key instead of unconditionally invoking it.

Useful? React with 👍 / 👎.

@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 (1)
lib/agents/generalAgent/getGeneralAgent.ts (1)

43-43: Add error handling for async tool retrieval.

The call to getGoogleSheetsTools(body) lacks error handling. If this call throws an exception, the entire agent initialization will fail without context.

Consider wrapping the call in a try-catch block or allowing errors to propagate with clear context.

 const recoupTools = setupToolsForRequest(finalExcludeTools);
-const googleSheetsTools = await getGoogleSheetsTools(body);
+let googleSheetsTools;
+try {
+  googleSheetsTools = await getGoogleSheetsTools(body);
+} catch (error) {
+  console.error('Failed to load Google Sheets tools:', error);
+  googleSheetsTools = {}; // Fallback to empty toolset
+}
 const tools = { ...recoupTools, ...googleSheetsTools };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a859534 and 905f9ab.

📒 Files selected for processing (7)
  • lib/agents/generalAgent/getGeneralAgent.ts (2 hunks)
  • lib/agents/googleSheetsAgent/getGoogleSheetsAgent.ts (0 hunks)
  • lib/agents/googleSheetsAgent/index.ts (1 hunks)
  • lib/agents/routingAgent/getRoutingDecision.ts (0 hunks)
  • lib/agents/routingAgent/index.ts (0 hunks)
  • lib/agents/routingAgent/routingAgent.ts (0 hunks)
  • lib/chat/setupChatRequest.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • lib/agents/routingAgent/index.ts
  • lib/agents/googleSheetsAgent/getGoogleSheetsAgent.ts
  • lib/agents/routingAgent/routingAgent.ts
  • lib/agents/routingAgent/getRoutingDecision.ts
🧰 Additional context used
📓 Path-based instructions (1)
lib/**/*.ts

⚙️ CodeRabbit configuration file

lib/**/*.ts: For utility functions, ensure:

  • Pure functions when possible
  • Single responsibility per function
  • Proper error handling
  • Use TypeScript for type safety
  • Avoid side effects
  • Keep functions under 50 lines
  • DRY: Consolidate similar logic into shared utilities
  • KISS: Prefer simple, readable implementations over clever optimizations

Files:

  • lib/agents/generalAgent/getGeneralAgent.ts
  • lib/agents/googleSheetsAgent/index.ts
  • lib/chat/setupChatRequest.ts
🧬 Code graph analysis (2)
lib/agents/generalAgent/getGeneralAgent.ts (2)
lib/chat/setupToolsForRequest.ts (1)
  • setupToolsForRequest (10-14)
lib/agents/googleSheetsAgent/index.ts (1)
  • getGoogleSheetsTools (3-3)
lib/chat/setupChatRequest.ts (2)
lib/chat/types.ts (2)
  • ChatRequest (14-25)
  • ChatConfig (37-53)
lib/agents/generalAgent/getGeneralAgent.ts (1)
  • getGeneralAgent (11-61)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Vercel Agent Review
  • GitHub Check: code-review
🔇 Additional comments (3)
lib/agents/generalAgent/getGeneralAgent.ts (1)

9-9: LGTM: Import aligns with the new tool-based composition.

The import of getGoogleSheetsTools correctly reflects the architectural shift from a dedicated agent to composable tools.

lib/agents/googleSheetsAgent/index.ts (1)

1-3: Export rename verified and complete.

The change from getGoogleSheetsAgent to getGoogleSheetsTools has been successfully executed:

  • No remaining references to the old export name
  • Consumer in getGeneralAgent.ts correctly imports and uses getGoogleSheetsTools
  • Export structure is clean and properly centralized through index.ts
lib/chat/setupChatRequest.ts (1)

7-7: Architectural consolidation verified—consolidation is clean and complete.

The transition from routing-based to unified agent is properly implemented. The general agent successfully incorporates both recoup tools and Google Sheets tools into a single merged toolset (lines 42–43), which is then passed to the ToolLoopAgent. No orphaned routing references exist, and all previous scenarios are now handled through this unified path with the expanded tool availability.

Comment on lines +42 to +44
const recoupTools = setupToolsForRequest(finalExcludeTools);
const googleSheetsTools = await getGoogleSheetsTools(body);
const tools = { ...recoupTools, ...googleSheetsTools };

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.

⚠️ Potential issue | 🟠 Major

Risk of silent tool name collisions during merge.

The spread operator merge { ...recoupTools, ...googleSheetsTools } will silently override any tools in recoupTools if googleSheetsTools contains tools with the same name. This could lead to unexpected behavior where a general tool is inadvertently replaced.

Consider adding validation to detect and log/error on tool name collisions, or document the override precedence explicitly.

const recoupTools = setupToolsForRequest(finalExcludeTools);
const googleSheetsTools = await getGoogleSheetsTools(body);

// Detect collisions
const recoupToolNames = Object.keys(recoupTools);
const googleToolNames = Object.keys(googleSheetsTools);
const collisions = recoupToolNames.filter(name => googleToolNames.includes(name));

if (collisions.length > 0) {
  console.warn(`Tool name collision detected: ${collisions.join(', ')}. Google Sheets tools will override.`);
}

const tools = { ...recoupTools, ...googleSheetsTools };
🤖 Prompt for AI Agents
In lib/agents/generalAgent/getGeneralAgent.ts around lines 42 to 44, merging
recoupTools and googleSheetsTools with a spread can silently override tools with
the same name; add a collision check that computes the intersection of
Object.keys(recoupTools) and Object.keys(googleSheetsTools), and if any
collisions exist either log a warning listing the colliding tool names and the
override behavior or throw an error to prevent unintended replacement; then only
perform the merge after handling collisions so the code explicitly documents or
prevents name conflicts.

@sweetmantech sweetmantech merged commit 5e4b861 into main Nov 21, 2025
6 checks passed
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