v0.42.19.0 fix(skillopt): close the last gap in the AI SDK v6 tool-loop fix (write-capture mapper + regression test)#1809
Merged
Conversation
#1764) v6's asSchema() rejected the bare { jsonSchema } object and called it as a function ("schema is not a function"), killing every tool-using agent run on non-Anthropic providers and skillopt on all providers. Wrap tool inputSchema with the SDK jsonSchema() helper, and add a pure toModelMessages() boundary adapter in chat() that converts tool results to the v6 ModelMessage shape (role:'tool' + typed output:{type:'json'|'error-text',value}, isError dropped, non-JSON-safe output normalized). toolLoop stays provider-neutral and unchanged. Both skillopt tool builders (rollout.ts, write-capture.ts) switch to the shared paramDefToSchema mapper so enum/default/items survive. Tests run the produced shapes through real generateText + MockLanguageModelV3. Co-Authored-By: michaeladair44 <michaeladair44@users.noreply.github.com> Co-Authored-By: justemu <justemu@users.noreply.github.com> Co-Authored-By: JE4NVRG <JE4NVRG@users.noreply.github.com> Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jun 3, 2026
…-tool-schema # Conflicts: # CHANGELOG.md # CLAUDE.md # TODOS.md # VERSION # llms-full.txt # package.json # src/core/ai/gateway.ts # src/core/skillopt/rollout.ts
…-tool-schema # Conflicts: # CHANGELOG.md # VERSION # package.json
garrytan
added a commit
that referenced
this pull request
Jun 3, 2026
Resolve conflicts: - VERSION / package.json: keep wave version 0.42.20.0 (> master 0.42.19.0). - CHANGELOG.md: keep both entries, 0.42.20.0 on top of master's stack (0.42.20.0 > 0.42.19.0 > 0.42.18.0 > ...). - master's #1809 skillopt fix auto-merged into source; llms regenerated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mgunnin
added a commit
to mgunnin/gbrain
that referenced
this pull request
Jun 3, 2026
* upstream/master: v0.42.23.0 feat(jobs): --nice scheduling-priority flag for jobs work/supervisor (garrytan#1815) (garrytan#1820) v0.42.22.0 fix(minions): supervisor progress watchdog + worker DB self-defense — alive-but-wedged worker self-heals (garrytan#1801) (garrytan#1824) v0.42.21.0 fix(postgres): module-singleton ownership — canonical landing for the dream-cycle "connect() has not been called" class (garrytan#1404/garrytan#1471/garrytan#1619) (garrytan#1805) v0.42.20.0 fix: reliability wave — PGLite capture lock-pin + Postgres reconnect race + search embed-hang (garrytan#1762 garrytan#1745 garrytan#1775) (garrytan#1810) v0.42.19.0 fix(skillopt): close the last gap in the AI SDK v6 tool-loop fix (write-capture mapper + regression test) (garrytan#1809) v0.42.18.0 fix: sync orphan-pileup watchdog (garrytan#1633) + links-lag µs stamp (garrytan#1768) (garrytan#1807) v0.42.17.0 fix(sync): resumable incremental sync — killed mid-import no longer loses progress (garrytan#1794) (garrytan#1808) v0.42.16.0 feat(doctor): brain health as a solved problem — cause-ranked doctor + OOM-loop line + auto-drain + pool-reap (garrytan#1685) (garrytan#1802) v0.42.15.0 fix: decouple CLI primary output from process.stdout.isTTY (garrytan#1784) (garrytan#1806) v0.42.14.0 fix(zero-config): code-* readiness signal + init embedding-key validation + lock self-heal (garrytan#1780) (garrytan#1804) v0.42.13.0 fix(search): archive/ content findable by default, demoted not hard-excluded (garrytan#1777) (garrytan#1797) v0.42.12.0 feat: self-upgrading gbrain — invocation-riding update check + opt-in auto-upgrade (garrytan#1798) v0.42.11.0 feat(skillopt): held-out eval gate, honest receipts, ENFORCE + ablation opts (garrytan#1759) v0.42.10.0 feat(extract): opt-in global-basename wikilink resolution (closes garrytan#972) (garrytan#1388)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context: master already landed the core fix
After merging
origin/master, it turned out master independently landed the convergent AI SDK v6 tool-loop fix (toModelMessages+jsonSchema()wrap) in v0.42.11.0 (PR #1759, surfaced by the SkillOpt real-LLM eval). Same function name, same approach. So this PR is no longer "the v6 fix" — that's done. The merge took master's canonicalgateway.ts+rollout.tsand dropped my now-redundant duplicate adapter + its unit test.What this PR adds over master (the net delta)
Master's 0.42.11.0 fixed one of the two places skillopt builds tool definitions. This closes the other:
src/core/skillopt/write-capture.ts— the--write-capturevirtual-write tool builder (put_page/submit_job/file_upload) still used the old{type,description}-only mapper, silently droppingenum/default/itemsfrom the schema the model sees. Now uses the sharedparamDefToSchema, matching therollout.tsbuilder master fixed.test/ai/gateway-tools-schema.test.ts— real-AI-SDK integration test (generateText+MockLanguageModelV3, no network) that pins the gateway's tool-schema + tool-result shapes are accepted by AI SDK v6, with regression guards that the pre-fix bare-{jsonSchema}object AND raw-tool-result-in-a-user-message shapes both throw. The original fix lacked this; it makes the convergent fix impossible to silently regress.test/skillopt/rollout-schema.test.ts— assertsenumsurvives in BOTH tool builders.Verification
bun run verify30/30 · 25 tests pass across the merged gateway/skillopt suites (incl. master'stoModelMessagesunit test).0.42.19.0(> master0.42.16.0); CHANGELOG + TODOS merged.The three original community PRs
Closed earlier with attribution — the core fix was convergent across master + #1748 (michaeladair44), #1742 (justemu, rejected: v4
parameterskey), #1708 (JE4NVRG). Closes the remaining surface of #1782 / #1764.🤖 Generated with Claude Code