Repository navigation
fix: accept null Cloudflare reasoning fields - #134
stackbilt-admin merged 4 commits into
Conversation
There was a problem hiding this comment.
Thanks for this. The fix is correct and as narrow as it should be. string-or-null still rejects numbers and objects (your second test checks numeric values), and joinReasoning already turns null into undefined, so no null reaches LLMResponse.reasoning. Both new tests fail when the schema change is reverted, so they guard the regression.
Two small changes before merge:
- Internal types:
WorkersAIChoice.message.reasoningandreasoning_contentinsrc/providers/cloudflare.tsare still typedstring. Please make themstring | nullto match the schema and the existingcontentfield. This has no runtime effect, but it keeps later code that reads these fields from assuming a string. - Fixture provenance: #130 says the raw response wasn't captured, so
cloudflare-reasoning-null.jsonis synthetic. Please say so in the PR description and/or a nearby test comment, rather than calling it live-shaped. If you later capture a real payload, we'd welcome it as a replacement.
Optional: add a case where both reasoning fields are null together, and a case where content: null comes with null reasoning.
Not in scope here: the same strict string schema exists for reasoning fields in the Groq, OpenAI and Cerebras adapters. That's tracked in #138, so this PR can stay Cloudflare-only.
CI is waiting on maintainer approval for fork PRs. We'll require normal CI to pass on the final commit before merging. The failing supply-chain check is a known repo-level problem unrelated to this PR, tracked in #137.
The #134 regression test triggered two SchemaDriftErrors in one test; the degraded breaker then rejected the second request about 10% of the time. Also cite release PR #141 in the issue-sweep checkpoint. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Accept null Workers AI reasoning fields (#134, fixes #130). Bumps package.json, package-lock.json and src/version.ts to 1.24.1, adds the CHANGELOG entry, refreshes the issue-sweep checkpoint, and resets the circuit breaker between the schema-drift cases in #134's regression test so it no longer fails at random. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Summary
Cloudflare Workers AI can return
nullfor optionalmessage.reasoningandmessage.reasoning_contentfields. Treat those values as absent while preserving the generated message and rejecting other invalid field types.Fixes #130
#130
The
cloudflare-reasoning-null.jsonfixture is synthetic because #130 did not include a captured raw response payload.Validation
npm test(792 passed)npm run typechecknpm run buildnpm run test:worker-import