added option to choose connection by name from jeen metadata - #31
Conversation
📝 WalkthroughWalkthroughThe PR adds catalog connection selection. It sends ChangesConnection-aware agent flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AgentTestingPage
participant AgentRouter
participant Agent
participant JeenMCP
AgentTestingPage->>AgentRouter: GET /agent/connections
AgentRouter->>JeenMCP: list_connections
JeenMCP-->>AgentRouter: connections
AgentRouter-->>AgentTestingPage: connection list
AgentTestingPage->>AgentRouter: ChatRequest(connection_id)
AgentRouter->>Agent: chat_with_agent(connection_id)
Agent->>JeenMCP: get_catalog_prompt(connection_id)
JeenMCP-->>Agent: catalog prompt
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
frontend/src/pages/AgentTestingPage.tsx (1)
385-396: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winBind the connection to the active thread.
The catalog selector remains changeable while the thread is interrupted.
handleApproveandhandleRejectthen use the currentselectedConnection, butagent/src/agent/mcp_server.py:59-87resumes the persisted graph without replacing its originalconnection_id. If the user changes the selector, the UI sends one connection while the agent continues with another. Disable the selector for an active thread, or store and reuse the thread's connection ID.Also applies to: 1054-1066
🤖 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 `@frontend/src/pages/AgentTestingPage.tsx` around lines 385 - 396, The Catalog Select bound to selectedConnection must not diverge from the active thread’s persisted connection_id. Update the AgentTestingPage thread state and approval/rejection flow around handleApprove and handleReject so an active thread either disables the selector or reuses its stored connection ID; apply the same behavior to the corresponding selector instance near the alternate location.backend/app/routers/agent.py (1)
360-362: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winSurface connection-discovery failures instead of treating them as an empty catalog.
The backend returns success with an empty list for MCP failures, and the frontend only logs rejected requests. Users cannot distinguish “no connections” from an unavailable or unauthorized catalog service.
backend/app/routers/agent.py#L360-L362: return a failure response or explicit error payload.frontend/src/pages/AgentTestingPage.tsx#L912-L915: render the failure and provide retry feedback.🤖 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 `@backend/app/routers/agent.py` around lines 360 - 362, Surface the MCP connection-discovery failure instead of converting it to an empty list: update the error path in agent.py around the list-connections handler so it returns a failure response or explicit error payload from the same exception branch that currently logs and returns {"connections": []}. Then update AgentTestingPage.tsx in the request-handling/rendering path to detect that failure payload, show the error state to the user, and offer retry feedback instead of treating it as an empty catalog or only logging the rejection.
🤖 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.
Outside diff comments:
In `@backend/app/routers/agent.py`:
- Around line 360-362: Surface the MCP connection-discovery failure instead of
converting it to an empty list: update the error path in agent.py around the
list-connections handler so it returns a failure response or explicit error
payload from the same exception branch that currently logs and returns
{"connections": []}. Then update AgentTestingPage.tsx in the
request-handling/rendering path to detect that failure payload, show the error
state to the user, and offer retry feedback instead of treating it as an empty
catalog or only logging the rejection.
In `@frontend/src/pages/AgentTestingPage.tsx`:
- Around line 385-396: The Catalog Select bound to selectedConnection must not
diverge from the active thread’s persisted connection_id. Update the
AgentTestingPage thread state and approval/rejection flow around handleApprove
and handleReject so an active thread either disables the selector or reuses its
stored connection ID; apply the same behavior to the corresponding selector
instance near the alternate location.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6a4094c8-aa97-4766-8aaa-0d011f265d0a
📒 Files selected for processing (4)
agent/src/agent/mcp_server.pyagent/src/agent/state.pybackend/app/routers/agent.pyfrontend/src/pages/AgentTestingPage.tsx
Summary by CodeRabbit