You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wrap raw JSON schemas with AI SDK v6 jsonSchema() when building gateway tools.
Feed tool results back as role: 'tool' messages with v6-compatible { type: 'json' | 'error-text', value } outputs.
Reuse the central paramDefToSchema() mapper for SkillOpt rollout tools so enum/default/items metadata survives.
Persist the accepted proposal artifact in --no-mutate SkillOpt runs by writing skillopt/best.md atomically.
Why
While testing gbrain skillopt with an OpenAI-compatible chat provider, tool calls failed with schema/tool-result shape errors under AI SDK v6. After the gateway fixes, chat, forced toolLoop, and one SkillOpt rollout all complete successfully.
Test Plan
bun --check src/core/ai/gateway.ts src/core/skillopt/rollout.ts src/core/skillopt/orchestrator.ts test/ai/gateway-tool-loop.test.ts test/skillopt/rollout-schema.test.ts
bun test test/ai/gateway-tool-loop.test.ts test/skillopt/rollout-schema.test.ts
bun run typecheck
Local note: full bun run verify is not reliable in my Windows/MSYS checkout because many package scripts invoke bare scripts/*.sh paths that Bun for Windows cannot dispatch directly; the focused checks and typecheck above are green.
Follow-up verification from Windows sandbox:\n\n- Branch is current with upstream master (0 behind / 1 ahead).\n- Focused regression tests pass: bun test test/ai/gateway-tool-loop.test.ts test/skillopt/rollout-schema.test.ts → 9 pass / 0 fail.\n- TypeScript check passes: bun run typecheck.\n\nGitHub status checks are not currently present on the PR, so local focused verification is green.
Landed in #1809 (v0.42.19.0). Your tool-result-shape work (role:'tool' + typed output) is the heart of the fix — thank you. We reworked it into a single toModelMessages() boundary adapter at the chat() edge (instead of scattering the conversion across toolLoop's push sites), which keeps toolLoop provider-neutral and also handles output normalization + dropping the v6-invalid isError field. Crediting you as Co-Author. The skillopt best.md change is filed as a P2 follow-up. Closing in favor of the combined wave.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jsonSchema()when building gateway tools.role: 'tool'messages with v6-compatible{ type: 'json' | 'error-text', value }outputs.paramDefToSchema()mapper for SkillOpt rollout tools so enum/default/items metadata survives.--no-mutateSkillOpt runs by writingskillopt/best.mdatomically.Why
While testing
gbrain skilloptwith an OpenAI-compatible chat provider, tool calls failed with schema/tool-result shape errors under AI SDK v6. After the gateway fixes, chat, forced toolLoop, and one SkillOpt rollout all complete successfully.Test Plan
bun --check src/core/ai/gateway.ts src/core/skillopt/rollout.ts src/core/skillopt/orchestrator.ts test/ai/gateway-tool-loop.test.ts test/skillopt/rollout-schema.test.tsbun test test/ai/gateway-tool-loop.test.ts test/skillopt/rollout-schema.test.tsbun run typecheckLocal note: full
bun run verifyis not reliable in my Windows/MSYS checkout because many package scripts invoke barescripts/*.shpaths that Bun for Windows cannot dispatch directly; the focused checks and typecheck above are green.