Skip to content

fix(gateway): guard non-array tools in api metrics#1967

Closed
kirillk wants to merge 2 commits intomainfrom
fix/gateway-tools-array-guard
Closed

fix(gateway): guard non-array tools in api metrics#1967
kirillk wants to merge 2 commits intomainfrom
fix/gateway-tools-array-guard

Conversation

@kirillk
Copy link
Copy Markdown

@kirillk kirillk commented Apr 3, 2026

Summary

  • guard API metrics tool extraction against truthy non-array tools payloads so /api/gateway/chat/completions does not throw before reaching the upstream provider
  • add regression coverage for object-shaped tools payloads while preserving existing array-based extraction behavior
  • keep the fix scoped to observability preprocessing, matching the incident where the crash happened in getToolsAvailable

Validation

  • pnpm lint src/lib/o11y/api-metrics.server.ts src/lib/o11y/api-metrics.server.test.ts
  • pnpm test -- --runInBand src/lib/o11y/api-metrics.server.test.ts

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 3, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/lib/o11y/api-metrics.server.ts
  • src/lib/o11y/api-metrics.server.test.ts

Reviewed by gpt-5.4-20260305 · 152,082 tokens

@jeanduplessis
Copy link
Copy Markdown
Contributor

Due to the monorepo restructure you will need to recreate this PR on a new branch from main. Pass the prompt found at, https://github.com/Kilo-Org/cloud/blob/main/plans/monorepo-migration-prompt.md, to your coding agent while running in this branch. Please close this PR once done or if you don't plan to proceed with it.

@kirillk kirillk closed this Apr 6, 2026
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.

2 participants