fix(tools): add all config properties to sessionQuestionSchema and push_question#65
Open
vistar wants to merge 1 commit into
Open
fix(tools): add all config properties to sessionQuestionSchema and push_question#65vistar wants to merge 1 commit into
vistar wants to merge 1 commit into
Conversation
…sh_question The config schema in start_session (sessionQuestionSchema) and push_question only declared question and context fields. When opencode parses tool args through Zod, any undeclared fields are stripped by looseObject, causing options, min, max, recommended, etc. to be silently dropped. This resulted in empty options in the UI for pick_one, pick_many, rank, and rate question types — the form card showed question text and context but no interactive choices. Fix: declare all config properties used by any question type as .any().optional() in both schemas. This preserves type safety (looseObject still rejects unknown top-level keys) while allowing all legitimate config fields to pass through Zod parsing. Same fix as vtemian/octto#28.
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.
Problem
Same bug as vtemian/octto#6 and vtemian/octto#28.
The
configschema instart_session(sessionQuestionSchema) andpush_questiononly declaredquestionandcontextfields. When opencode parses tool args through Zod, any undeclared fields are silently stripped bylooseObject, causingoptions,min,max,recommended, etc. to be dropped before they reach the server.Result: Empty options in the UI for
pick_one,pick_many,rank, andratequestion types — the form card showed question text and context but no interactive choices.Fix
Declare all config properties used by any question type as
.any().optional()in bothsessionQuestionSchemaandpush_questionconfig schemas. This preserves type safety (looseObjectstill rejects unknown top-level keys) while allowing all legitimate config fields to pass through Zod parsing.Why
.any().optional()instead of.unknown()?Using
.unknown()(as in the previous octto PR #19) allowsnull/primitives and can break downstream code that expects object-shaped config. Using.looseObject()with explicit.any().optional()fields keeps the object shape guarantee while allowing all valid properties through.Testing
npm run build— compiles without errorsnpm test— 449 tests passRelated: vtemian/octto#28
Summary by cubic
Adds all question config fields to
sessionQuestionSchemaandpush_questionso they aren’t stripped by Zod parsing. Fixes empty choices in the UI for choice, ranking, and rating questions..any().optional()in both schemas to pass throughlooseObject.pick_one,pick_many,rank, andrate.Written for commit 4a9fd6d. Summary will update on new commits.
Review in cubic