Skip to content

feat(ai): list_maple_feedback, the Maple team's cross-org reader for agent feedback - #2330

Merged
Makisuo merged 3 commits into
mainfrom
feat/agent-feedback-triage
Nov 7, 2026
Merged

Makisuo merged 3 commits into
mainfrom
feat/agent-feedback-triage

Merge remote-tracking branch 'origin/main' into feat/agent-feedback-t…

7f2c60e
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Nov 7, 2026 in 2m 22s

Confidence 10/10 · No issues found

🟢 Confidence 10/10 · safe to merge. Cross-org read gated by MAPLE_INTERNAL_ORG_ID and the transport's credential class; both paths are pinned by the new service and registry tests.
no findings · tests covered · risk high · 2/2 new units observable

Adds AgentFeedbackService.triage, a cross-org newest-first read gated on MAPLE_INTERNAL_ORG_ID and on a person/API-key audit actor, and the list_maple_feedback MCP tool over it. The gate, LIKE escaping and filters are covered by tests; safe to merge. It does not touch the open McpQueryError issues: the registry diff is one import and one registration line, so those stacks are unchanged.

  • AgentFeedbackService.triage reads every org via .crossTenant() after the internal-org check
  • list_maple_feedback refuses a system or absent audit actor and maps the forbidden error to insufficient_scope
  • MAPLE_INTERNAL_ORG_ID bound on maple-ai as Env.MAPLE_INTERNAL_ORG_ID
  • ListMapleFeedbackOutput added to McpToolOutputs and the registry

Before merge

  • Manual · Confirm MAPLE_INTERNAL_ORG_ID in the maple-ai plain-var store for prd and dev, exactly equal to the internal org's tenant id

Production impact

Open errors in the changed files (2)
Issue Service Occurrences File
@maple/mcp/errors/McpQueryError (5 issues) maple-chat 33 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError (5 issues) maple-ai 15 apps/ai/src/mcp/tools/registry.ts

After this merges, Maple checks whether they stop.

Production traffic of the changed files (last 7 days)
File Calls/day Busiest operations
apps/ai/src/mcp/tools/list-maple-feedback.ts 58k POST /mcp 29k/day, 0.0% err
POST /mcp 29k/day, 0.0% err
GET /mcp 293/day, 0.0% err
apps/ai/src/worker.ts 58k POST /mcp 29k/day, 0.0% err
POST /mcp 29k/day, 0.0% err
GET /mcp 293/day, 0.0% err
Telemetry this change adds and removes (2)
  • ➕ span name McpTool.listMapleFeedback · apps/ai/src/mcp/tools/list-maple-feedback.ts:44
  • ➕ span name AgentFeedbackService.triage · packages/backend/src/services/feedback/AgentFeedbackService.ts:198
What was checked
  • Gate holds end to end: mcpAuditActor marks maple_svc_ bears as system (mcp/app.ts:117) and api forwards headers untouched (ai-forward.ts:103)
  • related_to escapes \, % and _; the runXsql decoy in AgentFeedbackService.test.ts proves _ is literal
  • start_time decodes through WarehouseTimeInput and limit clamps 1..200, so no NaN reaches the column compare
Observability coverage: 2 of 2 changes observable
Change Kind Observable Evidence
list_maple_feedback MCP tool handler inbound tool call yes Effect.fn("McpTool.listMapleFeedback") span at list-maple-feedback.ts:44
AgentFeedbackService.triage cross-org Postgres read database query yes Effect.fn("AgentFeedbackService.triage") with orgId/limit/result.rowCount, plus the dbExecute span at AgentFeedbackService.ts:198-229

7f2c60e · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.