Skip to content

feat: add multi-agent proxy support to dashboard backend#4

Open
ttupper92618 wants to merge 1 commit into
mainfrom
feat/multi-agent-backend
Open

feat: add multi-agent proxy support to dashboard backend#4
ttupper92618 wants to merge 1 commit into
mainfrom
feat/multi-agent-backend

Conversation

@ttupper92618

Copy link
Copy Markdown
Contributor

Summary

  • Adds tenant_memberships table to SQLite schema (user_id, tenant_id, role)
  • Adds foxmemoryUrl() helper that builds agent-scoped upstream URLs (/v2/agents/:agentId/...) when agentId query param is provided
  • All /api/foxmemory/* proxy routes accept optional ?agentId= and forward to agent-scoped endpoints
  • Adds GET /api/tenants and GET /api/tenants/:tenantId/agents proxy routes

Legacy behavior preserved — when agentId is omitted, routes proxy to /v2/... as before.

Test plan

  • yarn typecheck:server passes
  • GET /api/foxmemory/overview still works without agentId
  • GET /api/foxmemory/overview?agentId=X proxies to /v2/agents/X/...
  • GET /api/tenants returns tenant list from foxmemory-store
  • GET /api/tenants/:id/agents returns agent list

🤖 Generated with Claude Code

- server/db.ts: adds tenant_memberships table (user_id, tenant_id, role)
- server/index.ts: adds foxmemoryUrl() helper for agent-scoped upstream
  routing; all /api/foxmemory/* routes accept optional ?agentId= query
  param and proxy to /v2/agents/:agentId/... when provided; adds
  GET /api/tenants and GET /api/tenants/:tenantId/agents proxy routes

Legacy behavior preserved — when agentId is omitted, routes proxy to
/v2/... as before.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@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.

Reviewed commit: 755483cce8

ℹ️ 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 thread server/index.ts

// ── Helper: build upstream foxmemory URL (agent-scoped when agentId provided) ─
const foxmemoryUrl = (urlPath: string, agentId?: string) => {
const base = agentId ? `/v2/agents/${agentId}` : '/v2';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Encode agentId before interpolating upstream path

The agentId query param is inserted into the URL path without encodeURIComponent, so agent IDs containing reserved characters (for example /, ?, or #) will alter the upstream route and can target the wrong endpoint (or fail with 404s) instead of /v2/agents/:agentId/... for that exact ID. Since this value is user-controlled via query string, it should be encoded (or validated to a safe character set) before building the path.

Useful? React with 👍 / 👎.

Comment thread server/index.ts
try {
const overview = await probeFoxmemory();
const agentId = req.query.agentId as string | undefined;
const overview = await probeFoxmemory(agentId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep overview memoryCount scoped to selected agent

This now enables agent-scoped overview requests, but probeFoxmemory(agentId) still overwrites memoryCount from a global Qdrant count (/collections/foxmemory/points/count) with no agent filter; when ?agentId= is used, the cards/charts become internally inconsistent because most metrics are agent-scoped while memoryCount is global. In multi-agent deployments this produces inaccurate dashboard totals for the selected agent.

Useful? React with 👍 / 👎.

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