Skip to content

fix(web): sanitize Gemini JSON ref tool results - #6055

Open
chrarnoldus wants to merge 3 commits into
mainfrom
slime-lantern
Open

fix(web): sanitize Gemini JSON ref tool results#6055
chrarnoldus wants to merge 3 commits into
mainfrom
slime-lantern

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Summary

  • extract sanitizeJsonRefToolResults into a shared provider utility
  • sanitize JSON $ref fields for Gemini tool results in provider-specific request handling
  • retain opt-in sanitization for direct custom and experiment providers
  • cover Gemini and non-Gemini provider-specific behavior

Testing

  • Not run locally; CI will validate the change as requested.
  • oxfmt --list-different passed for all touched files.
  • git diff --check passed.

@chrarnoldus chrarnoldus self-assigned this Sep 10, 2026
@kilo-code-bot

kilo-code-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts
Previous Review Summaries (2 snapshots, latest commit d9b1246)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit d9b1246)

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts 164 Orphan tool result is stripped before assertion
Files Reviewed (4 files)
  • apps/web/src/lib/ai-gateway/experiments/build-direct-provider.ts
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts - 1 issue
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts
  • apps/web/src/lib/ai-gateway/providers/sanitize-json-ref-tool-results.ts

Fix these issues in Kilo Cloud

Previous review

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts 161 Orphan tool result is stripped before assertion
Files Reviewed (4 files)
  • apps/web/src/lib/ai-gateway/experiments/build-direct-provider.ts
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts - 1 issue
  • apps/web/src/lib/ai-gateway/providers/apply-provider-specific-logic.ts
  • apps/web/src/lib/ai-gateway/providers/sanitize-json-ref-tool-results.ts

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 63.7K · Output: 5.1K · Cached: 144.1K

Review guidance: REVIEW.md from base branch main

@chrarnoldus

Copy link
Copy Markdown
Contributor Author

Addressed the review warning in 1c93d14. The provider-specific tests now use a valid assistant tool-call followed by its matching tool result, and the assertion locates the retained tool message after repair.

Validation:

  • NODE_ENV=test pnpm --filter web exec jest --runInBand src/lib/ai-gateway/providers/apply-provider-specific-logic.test.ts (38 passed)
  • scripts/typecheck-all.sh (passed)

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