Skip to content

Remove default from twoStep schema requirement#2029

Merged
miguelg719 merged 1 commit into
mainfrom
non-nullable-twostep
Apr 22, 2026
Merged

Remove default from twoStep schema requirement#2029
miguelg719 merged 1 commit into
mainfrom
non-nullable-twostep

Conversation

@miguelg719
Copy link
Copy Markdown
Collaborator

@miguelg719 miguelg719 commented Apr 22, 2026

why

z.boolean().default(false) on line 448 is incompatible with OpenAI's strict structured-output mode.

OpenAI's error:

'required' is required to be supplied and to be an array including every key in properties. Missing 'twoStep'.

what changed

test plan


Summary by cubic

Made twoStep a required boolean in the act schema (no default). This removes the silent false default and forces callers to be explicit about two-step actions.

  • Migration
    • Always pass twoStep: true | false when calling act.
    • tsconfig.json change is formatting-only; no runtime impact.

Written for commit ca56e78. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

⚠️ No Changeset found

Latest commit: ca56e78

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@miguelg719 miguelg719 marked this pull request as ready for review April 22, 2026 21:48
Copy link
Copy Markdown
Contributor

@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

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant App as User Application
    participant Core as Inference (act)
    participant LLM as OpenAI API

    Note over App,LLM: Action Inference Flow (Strict Structured Output)

    App->>Core: act(instruction, ...)
    
    Core->>Core: Define Zod schema
    Note over Core: CHANGED: 'twoStep' boolean is now required<br/>(Removed .default(false) for OpenAI compatibility)

    Core->>LLM: Request completion with JSON Schema
    Note over Core,LLM: The 'required' array in the schema<br/>MUST now include 'twoStep'

    alt Success
        LLM-->>Core: NEW: Returns JSON including 'twoStep' key
        Core->>Core: Validate response with Zod
        Core-->>App: Return ActResponse
    else OpenAI Schema Error (Old Behavior)
        Note over LLM: OpenAI would reject schema if 'twoStep'<br/>had a default but was missing from 'required'
        LLM-->>Core: 400 Bad Request
        Core-->>App: Throw Error
    end
Loading

@miguelg719 miguelg719 merged commit 68d767a into main Apr 22, 2026
204 checks passed
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.

2 participants