Skip to content

feat(platform): nested workflow schemas and arg normalization#827

Merged
larryro merged 1 commit into
mainfrom
feat/workflow-nested-schema-normalization
Mar 21, 2026
Merged

feat(platform): nested workflow schemas and arg normalization#827
larryro merged 1 commit into
mainfrom
feat/workflow-nested-schema-normalization

Conversation

@larryro
Copy link
Copy Markdown
Collaborator

@larryro larryro commented Mar 21, 2026

Summary

  • Build proper Zod schemas for nested object and array properties in workflow tools instead of falling back to z.string(), enabling structured validation for complex inputs like file objects.
  • Auto-parse stringified object/array args from models that serialize values despite receiving structured schemas (cross-model resilience).
  • Replace human-readable input parameter descriptions with raw JSON schema in tool descriptions for better model comprehension.

Test plan

  • Added test for nested object properties in tool description
  • Added test for normalizing stringified object args before validation
  • Added test for normalizing stringified array items
  • Added test that native object args pass through unchanged
  • Added test that legitimate string fields are not parsed
  • Existing tests updated and passing

Summary by CodeRabbit

  • Bug Fixes
    • Improved JSON argument normalization in workflow tools: stringified JSON inputs are now properly converted to native objects for validation and execution.
    • Enhanced input schema display formatting with detailed JSON schema information.
    • Better support for nested objects and arrays in workflow input parameters.

…ed args in workflow tools

Build proper Zod schemas for nested object/array properties instead of
falling back to z.string(), and auto-parse stringified objects/arrays
from models that serialize despite receiving structured schemas.
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@larryro larryro merged commit 7b282f1 into main Mar 21, 2026
15 of 16 checks passed
@larryro larryro deleted the feat/workflow-nested-schema-normalization branch March 21, 2026 08:56
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 21, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: e647ac9a-4d00-4371-89f3-51e857c1e2fa

📥 Commits

Reviewing files that changed from the base of the PR and between 88c88d7 and 50fcbf1.

📒 Files selected for processing (2)
  • services/platform/convex/agent_tools/workflows/__tests__/create_bound_workflow_tool.test.ts
  • services/platform/convex/agent_tools/workflows/create_bound_workflow_tool.ts

📝 Walkthrough

Walkthrough

The implementation introduces schema-aware argument normalization for workflow tools. The changes replace a basic Zod type mapping with helper functions that construct schema types for nested objects and arrays based on explicit properties. A new normalizeArgs function conditionally JSON-parses string arguments when the schema declares those fields as object or array types. The tool handler validates normalized arguments instead of raw ones. Additionally, workflow descriptions now embed raw JSON schema output using JSON.stringify instead of a dedicated formatter. The test suite verifies that normalized arguments are correctly parsed, that native objects pass through unmodified, and that legitimately string values are not parsed.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/workflow-nested-schema-normalization

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can use TruffleHog to scan for secrets in your code with verification capabilities.

Add a TruffleHog config file (e.g. trufflehog-config.yml, trufflehog.yml) to your project to customize detectors and scanning behavior. The tool runs only when a config file is present.

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