Skip to content

fix: preserve 'type' field in TaskGroup JSON schema enum items#5073

Open
weiguangli-io wants to merge 1 commit intolivekit:mainfrom
weiguangli-io:fix/taskgroup-schema-type-5044
Open

fix: preserve 'type' field in TaskGroup JSON schema enum items#5073
weiguangli-io wants to merge 1 commit intolivekit:mainfrom
weiguangli-io:fix/taskgroup-schema-type-5044

Conversation

@weiguangli-io
Copy link

Summary

Fixes #5044 — The json_schema_extra override in task_group.py (line 173) replaces the items sub-schema entirely, dropping "type": "string". This causes Gemini API to reject the schema with a 400 INVALID_ARGUMENT error since it requires explicit type on every schema node.

  • Adds "type": "string" alongside "enum" in the items sub-schema
  • The Google plugin (_GeminiJsonSchema._simplify()) has a downstream workaround that infers type from enum values, so this may not reproduce on 1.4.x with the Google plugin (per @davidzhao's question) — but the source schema should still be correct
  • One-line fix, no behavioral change for providers that already tolerate missing type

Test plan

  • Verify generated JSON schema for out_of_scope tool includes {"type": "array", "items": {"type": "string", "enum": [...]}}
  • Confirm Gemini API no longer returns 400 when using TaskGroup workflows

🤖 Generated with Claude Code

…it#5044)

The json_schema_extra override for the out_of_scope tool's task_ids
parameter was missing "type": "string" in the items sub-schema, causing
Gemini API to reject the schema with a 400 INVALID_ARGUMENT error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

[livekit-agents 1.3.5] TaskGroup out_of_scope tool — missing type in items schema causes Gemini 400 error

1 participant