#5447: fix(schema): preserve sibling properties when resolving $ref
agents
Cluster:
Tool Schema Fixes and Enhancements
When resolving local $ref entries, the schema sanitizer only preserved
"description", "title", and "default" from the original node.
This caused other valid JSON Schema sibling properties (e.g. deprecated,
readOnly, writeOnly, examples, etc.) to be silently dropped.
This patch preserves all sibling properties except "$ref" itself,
while still resolving the referenced definition.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates `cleanSchemaForGeminiWithDefs` to preserve *all* sibling properties alongside a locally-resolved `$ref`, instead of only forwarding `description`, `title`, and `default`. This prevents valid JSON Schema annotations/keywords (e.g. `deprecated`, `readOnly`, `writeOnly`, etc.) from being dropped while still expanding the referenced definition.
The main functional behavior remains the same (local `$ref` resolution with cycle protection), but the PR introduces an indentation/formatting regression in the new sibling-copy loop that is likely to trip formatting/linting checks.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge once formatting is corrected.
- The change is small and targeted (copy sibling keys when resolving local `$ref`), with low behavioral risk, but the current diff shows an indentation regression that may break lint/format checks or readability standards.
- src/agents/schema/clean-for-gemini.ts
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#11141: Fix JSON schema conversion error when using llama.cpp backend
by 9nix00 · 2026-02-07
73.5%
#4767: fix(agents): handle read alias required schema
by RomeroYang · 2026-01-30
73.5%
#15852: fix: pass agentId when resolving IRC session paths
by MisterGuy420 · 2026-02-14
73.3%
#22214: fix(tools): sanitize google-antigravity schemas for Gemini-compatib...
by Kansodata · 2026-02-20
73.0%
#21835: fix: apply schema cleaning for google-antigravity in normalizeToolP...
by ephraimm · 2026-02-20
72.9%
#4243: fix: resolve Node.js punycode deprecation warning
by dylanneve1 · 2026-01-29
72.1%
#9974: refactor(agents): replace console.warn with SubsystemLogger in comp...
by dinakars777 · 2026-02-05
71.7%
#6110: refactor: simplify boolean logic using nullish coalescing
by T1mn · 2026-02-01
70.2%
#22321: fix: sanitize tool schemas for all Cloud Code Assist providers
by Sr-0w · 2026-02-21
70.2%
#22846: Config: add secret ref schema and redaction foundations
by joshavant · 2026-02-21
70.1%