[PR #11465] fix: address tool/plugin issues #11413, #11130, #11436 #13799

Open
opened 2026-02-16 18:18:38 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11465

State: open
Merged: No


Summary

This PR fixes three tool/plugin related issues:

#11413 - question tool schema causes 400 with Gemini

Problem: The question tool's JSON Schema contains non-standard fields (ref, $schema) from Zod's .meta() that Gemini API rejects.

Fix: Updated sanitizeGemini function in transform.ts to skip these non-standard fields when preparing schemas for Gemini.

#11130 - plugins silently fail with bad syntax

Problem: Duplicate keys in opencode.json (e.g., two "plugin" entries) are silently ignored, with the second value overwriting the first.

Fix: Added duplicate key detection using jsonc-parser's visit function. Now throws a helpful error message suggesting array syntax:

Duplicate key "plugin" at line 3, column 3. Use an array for multiple values, e.g. "plugin": ["value1", "value2"]

#11436 - file has been modified since it was last read

Problem: False positive errors when file mtime differs from read time by only a few milliseconds (e.g., 14ms difference) due to filesystem timestamp precision.

Fix: Added 100ms tolerance to the file modification time check in time.ts.

Testing

  • bun run typecheck passes

Files Changed

  • packages/opencode/src/provider/transform.ts - Gemini schema sanitization
  • packages/opencode/src/config/config.ts - Duplicate key detection
  • packages/opencode/src/file/time.ts - File time tolerance
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11465 **State:** open **Merged:** No --- ## Summary This PR fixes three tool/plugin related issues: ### #11413 - question tool schema causes 400 with Gemini **Problem**: The `question` tool's JSON Schema contains non-standard fields (`ref`, `$schema`) from Zod's `.meta()` that Gemini API rejects. **Fix**: Updated `sanitizeGemini` function in `transform.ts` to skip these non-standard fields when preparing schemas for Gemini. ### #11130 - plugins silently fail with bad syntax **Problem**: Duplicate keys in `opencode.json` (e.g., two `"plugin"` entries) are silently ignored, with the second value overwriting the first. **Fix**: Added duplicate key detection using `jsonc-parser`'s `visit` function. Now throws a helpful error message suggesting array syntax: ``` Duplicate key "plugin" at line 3, column 3. Use an array for multiple values, e.g. "plugin": ["value1", "value2"] ``` ### #11436 - file has been modified since it was last read **Problem**: False positive errors when file mtime differs from read time by only a few milliseconds (e.g., 14ms difference) due to filesystem timestamp precision. **Fix**: Added 100ms tolerance to the file modification time check in `time.ts`. ## Testing - `bun run typecheck` passes ## Files Changed - `packages/opencode/src/provider/transform.ts` - Gemini schema sanitization - `packages/opencode/src/config/config.ts` - Duplicate key detection - `packages/opencode/src/file/time.ts` - File time tolerance
yindo added the pull-request label 2026-02-16 18:18:38 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13799