Skip to content

feat(ai): MCP tools for the Infrastructure pages (list_infra, inspect_infra) - #1387

Merged
Makisuo merged 3 commits into
mainfrom
feat/mcp-infra-tools
Oct 10, 2026
Merged

Makisuo merged 3 commits into
mainfrom
feat/mcp-infra-tools

fix(ai): key pod restarts by namespace and pod name

d8c5987
Select commit
Loading
Failed to load commit list.
Maple Review Bot / Maple / review succeeded Oct 10, 2026 in 2m 11s

Confidence 9/10 · No issues found

🟢 Confidence 9/10 · safe to merge
The one open finding is fixed and pinned by a test that fails without the namespace key; the four files changed since the last review were read in full.
quality 100/100 · no findings · tests covered · risk low · 1/1 new units observable

The last commit fixes podRestarts summing same-named pods across namespaces: the query now groups by namespace and the list keys on namespace plus pod name, with a test that fails without it. The changed files are safe to merge; none of the open registry errors touch this diff.

  • podRestartsQuery selects and groups by k8s.namespace.name
  • podKey matches restarts to a pod by namespace and name
  • Infra fixture answers restarts per namespace

Fixed since the last review

  • ✅ F1 · podRestarts sums restarts across namespaces by pod name

Production impact

Open errors in the changed files
Issue Service Occurrences File
@maple/api/vcs/VcsSourceRepositoryNotFoundError maple-ai 68 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 42 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 36 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 18 apps/ai/src/mcp/tools/registry.ts
@maple/api/vcs/GithubAppError maple-chat 14 apps/ai/src/mcp/tools/registry.ts
@maple/http/errors/IntegrationsUpstreamError maple-chat 14 apps/ai/src/mcp/tools/registry.ts
@maple/http/errors/IntegrationsUpstreamError maple-chat 11 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 9 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-ai 9 apps/ai/src/mcp/tools/registry.ts
@maple/mcp/errors/McpQueryError maple-chat 8 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/lib/infra.ts 58 infraPresence 48/day, 2.4% err
listHosts 4/day, 6.7% err
listPods 3/day, 0.0% err
apps/ai/src/mcp/lib/infra-inspect.ts 6 podInfraTimeseries 5/day, 0.0% err
podDetailSummary 1/day, 0.0% err
Telemetry this change adds and removes (2)
  • ➕ span name McpTool.inspectInfra · apps/ai/src/mcp/tools/inspect-infra.ts:111
  • ➕ span name McpTool.listInfra · apps/ai/src/mcp/tools/list-infra.ts:108
What was checked
  • podKey reads the same k8s.namespace.name resource attribute as the list row (infra.ts:250, infra.ts:352)
  • Row schema is derived from the SELECT, so the new namespace column decodes (packages/query-engine/src/ch/queries/infra.ts:275)
  • The new test fails under name-only keying: the fixture answers 1 and 7 for the two namespaces (infra-tools.test.ts:70)
Observability coverage: 1 of 1 changes observable
Change Kind Observable Evidence
pod restarts warehouse query outbound yes WarehouseExecutor.compiledQuery with { profile: "aggregation", context: "podRestarts" } (apps/ai/src/mcp/lib/infra.ts:259)

d8c5987 · Updated on every push. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.