feat: add multi-agent support to dashboard frontend#5
Conversation
- uiSlice: adds selectedAgentId to persisted Redux state - types.ts: adds TenantRecord and AgentRecord interfaces - dashboardApi.ts: parameterizes all foxmemory RTK Query endpoints with optional agentId; adds getTenants and getAgents endpoints; scopes cache tags by agentId - AgentSelector: new component — dropdown that fetches tenants/agents and lets users switch between agents (persisted via redux-persist) - App.tsx: renders AgentSelector in sidebar, passes selectedAgentId to FoxMemorySection and ModelConfigSection - FoxMemorySection, FoxMemoryAgentsView, FoxMemoryGraphView, ModelConfigSection: accept agentId prop, pass to RTK Query hooks and mutation calls - Sidebar: accepts children prop for rendering AgentSelector When no agent is selected, all queries fall back to global (legacy) behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 547a0ac2d4
ℹ️ 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".
| if (agents.length === 0) { | ||
| return ( |
There was a problem hiding this comment.
Clear stale agent selection when no agents are returned
When agents.length === 0, this branch replaces the selector with static text and never calls onAgentChange(null). Since selectedAgentId is persisted and used to scope FoxMemory requests, a previously selected (now deleted/inaccessible) agent can leave the app permanently querying with an invalid agentId, and the user has no UI path back to Default (all) because the dropdown is hidden in this state.
Useful? React with 👍 / 👎.
| const effectiveAgentId = agentId ?? undefined; | ||
| const { data, isLoading } = useGetFoxmemoryGraphDataQuery(effectiveAgentId); | ||
| const [searchGraph, { data: richData, isLoading: richLoading, reset: resetRich }] = useSearchFoxmemoryGraphMutation(); | ||
| const [searchMemories, { data: memoriesData, isLoading: memoriesLoading, reset: resetMemories }] = useSearchFoxmemoryMemoriesMutation(); | ||
| const [selectedNode, setSelectedNode] = useState<FoxmemoryGraphNode | null>(null); |
There was a problem hiding this comment.
Reset graph detail state when switching agents
This component now changes graph queries by agentId, but it keeps local selection/search state across agent switches. If a user changes agents while a node is selected, the details panel can continue showing richData/memory results from the previous agent until manually cleared, which mixes data scopes and presents stale relationships for the new graph context.
Useful? React with 👍 / 👎.
Summary
selectedAgentIdto persisted Redux stateagentId; addsgetTenantsandgetAgentsendpoints; scopes cache tags by agentIdagentIdprop, pass to RTK Query hooks and mutation callschildrenprop for rendering AgentSelectorWhen no agent is selected, all queries fall back to global (legacy) behavior.
Companion to #4 (backend proxy support).
Test plan
yarn typecheck:webpasses (only pre-existingshadowswarning)🤖 Generated with Claude Code