fix(assistant): replace z.unknown() in settings tool with a typed union (fixes #2892)#2896
Open
alexcf wants to merge 1 commit into
elie222:mainelie222/inbox-zero:mainfrom
alexcf:fix/assistant-settings-strict-schemaalexcf/inbox-zero:fix/assistant-settings-strict-schemaCopy head branch name to clipboard
Open
fix(assistant): replace z.unknown() in settings tool with a typed union (fixes #2892)#2896alexcf wants to merge 1 commit intoelie222:mainelie222/inbox-zero:mainfrom alexcf:fix/assistant-settings-strict-schemaalexcf/inbox-zero:fix/assistant-settings-strict-schemaCopy head branch name to clipboard
alexcf wants to merge 1 commit into
elie222:mainelie222/inbox-zero:mainfrom
alexcf:fix/assistant-settings-strict-schemaalexcf/inbox-zero:fix/assistant-settings-strict-schemaCopy head branch name to clipboard
Conversation
The updateAssistantSettings tool declared its `value` as z.unknown(), which emits a JSON Schema node with no `type`. With supportsStructuredOutputs:true (openai-compatible provider), strict-schema endpoints (llama.cpp / vLLM / LM Studio) reject the typeless node when building a constrained-decoding grammar - "JSON schema conversion failed: Unrecognized schema" - which aborts the entire chat tool set, so the assistant returns nothing. Replace z.unknown() with an explicit union of the value shapes the settings paths accept (primitives, arrays of primitives, and the existing object schemas). The per-path type is still re-validated downstream against the strict settingsChangeSchema discriminated union, so this only needs to be a permissive, fully-typed superset.
|
@alexcf is attempting to deploy a commit to the Inbox Zero OSS Program Team on Vercel. A member of the Team first needs to authorize it. |
alexcf
force-pushed
the
fix/assistant-settings-strict-schema
branch
from
July 3, 2026 06:41
55f26cd to
814ca78
Compare
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.
Fixes #2892.
Problem
The AI chat assistant is fully broken on strict-schema
openai-compatibleendpoints (llama.cpp / vLLM / LM Studio with structured outputs). The browser throws:and the assistant returns nothing.
Root cause
updateAssistantSettingsdeclares itsvalueasz.unknown(), which emits a JSON Schema node with notype. WithsupportsStructuredOutputs: trueon the provider (utils/llms/model.ts), the tool schema goes to the endpoint’s structured-output path, where the server’s grammar builder (e.g. llama.cppjson-schema-to-grammar) rejects the typeless node — aborting the whole tool set.Fix
Replace
z.unknown()with an explicit union of the value shapes the settings paths accept (primitives, arrays of primitives, and the existing object schemas). The per-path type is still re-validated downstream against the strictsettingsChangeSchemadiscriminated union, so this only needs to be a permissive, fully-typed superset. A naivez.record(...)would emitadditionalProperties:falsewith nopropertiesand silently reject object values, so the union is the correct shape.Validation
Reproduced the emitted tool JSON Schema on the pinned SDK versions: the old schema emits the typeless node verbatim; the new one emits zero typeless nodes and accepts string/number/boolean/null/array/object.
🤖 Generated with Claude Code