Skip to content

fix(tools): add all config properties to sessionQuestionSchema and push_question#65

Open
vistar wants to merge 1 commit into
vtemian:mainfrom
vistar:fix/config-schema-stripping
Open

fix(tools): add all config properties to sessionQuestionSchema and push_question#65
vistar wants to merge 1 commit into
vtemian:mainfrom
vistar:fix/config-schema-stripping

Conversation

@vistar
Copy link
Copy Markdown

@vistar vistar commented May 28, 2026

Problem

Same bug as vtemian/octto#6 and vtemian/octto#28.

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 silently stripped by looseObject, causing options, min, max, recommended, etc. to be dropped before they reach the server.

Result: 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 sessionQuestionSchema and push_question config schemas. This preserves type safety (looseObject still 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) allows null/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 errors
  • npm test — 449 tests pass

Related: vtemian/octto#28


Summary by cubic

Adds all question config fields to sessionQuestionSchema and push_question so they aren’t stripped by Zod parsing. Fixes empty choices in the UI for choice, ranking, and rating questions.

  • Bug Fixes
    • Allow all known config fields via .any().optional() in both schemas to pass through looseObject.
    • Restores options and other settings for pick_one, pick_many, rank, and rate.
    • Keeps top-level schema validation while letting valid config fields through.

Written for commit 4a9fd6d. Summary will update on new commits.

Review in cubic

…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.
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant